MATLAB: How to measure quality of an image

Image Processing Toolboxmsepsnrquality of image

I need to find quality of an image before and after pre-processing.
For this, i need to calculate PSNR (Peak Signal to Noise Ratio), MSE (Mean Square Error),MAXERR (Maximum Squared Error) and L2RAT (Ratio of Squared Norms)
X = imread('africasculpt.jpg');
Xapp = X;
Xapp(X<=100) = 1;
[psnr,mse,maxerr,L2rat] = measerr (X,Xapp)
figure;
subplot(1,2,1); image(X);
subplot(1,2,2); image(Xapp);
This is the program that i got in Help menu in matlab.
However it is showing an error. Can anyone help me in this……

Best Answer

There are psnr() and ssim() functions for image quality in the Image Processing Toolbox. If you don't have a recent version, I have some code you can use in older versions in the attached file.
Related Question