I got a code to calculate CR,bpp, MSE and PSNR. I works well for *.jpeg image but not for *.tiff. A message
"Error using - Integers can only be combined with integers of the same class, or scalar doubles.Error in sphit (line 38)D = abs(X-Xc).^2;"
I cannot figure why it happen. The full code is:
X= imread ('lena.tif'); [cr,bpp] = wcompress('c',X,'mask.wtc','spiht','maxloop',12)Xc = wcompress('u','mask.wtc');delete('mask.wtc')colormap(pink(255))subplot(1,2,1); image(X); title('Original image')axis squaresubplot(1,2,2); image(Xc); title('Compressed image')axis square% Finally the MSE and the PSNR are computed.
D = abs(X-Xc).^2;mse = sum(D(:))/numel(X)psnr = 10*log10(255*255/mse)
Best Answer