I loaded an image in Matlab which has properties:
Name(X) , Size (512x512) , Bytes (262144) , Class(uint8) ,
I added gaussian noise and remove that noise by using wavelet transform. By doing Inverse wavelet transform I get the final output image:
Name(Xsyn) , Size (504x504) , Bytes (2032128) , Class(Double)
Now I am trying to calculate the signal-to-noise ratio (SNR) by using
SNR = 20*log10(norm(X(:))/norm(X(:)-Xsyn(:)));
But it show the following error:
??? Error using ==> minus
Matrix dimensions must agree.
So I think I should change my matrix dimension of the final image (Xsyn). Now how can I change this matrix dimension of image Xsyn (504×504 ) to Xsyn size (512×512)?
Or is there another way to find out the SNR?
Given that the function you use doesn’t have a handle that keeps the original size of the matrix (for instance conv2 has the option to output the same size using (
conv2(Image,filer,'same')) , you can always do this quick and dirty fix:and the rest will follow…