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......

댓글 수: 4

Geoff Hayes
Geoff Hayes 2014년 5월 31일
What is the error message? You will need the Wavelet Toolbox in order to use the command/function measerr.
Error in ==> measerr at 30
A = absD.^2;
Error in ==> maculaedema at 17
[PSNR,MSE,MAXERR,L2RAT] = measerr(X , Xapp)
This is the error that i am getting....
Image Analyst
Image Analyst 2014년 6월 2일
That is not the full error message! Geoff asked you for the error message and instead you snipped out a small part of it. Importantly, you forgot to include the actual error message - you only included the line numbers. So while we know something went wrong with those lines of code, we don't know what. Please copy and paste ALL THE RED TEXT, not just part of it, if you want help.
Preeti Mistry
Preeti Mistry 2014년 6월 3일
??? Out of memory. Type HELP MEMORY for your options.
Error in ==> measerr at 35
B = Xapp.*Xapp;
Error in ==> maculaedema at 17
[PSNR , MSE , MAXERR , L2RAT] = measerr(X , Xapp)
This is all that is shown as an error.....

댓글을 달려면 로그인하십시오.

 채택된 답변

Image Analyst
Image Analyst 2014년 5월 31일
편집: Image Analyst 2014년 5월 31일

0 개 추천

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.

댓글 수: 5

Image Analyst
Image Analyst 2014년 6월 2일
Preeti's "Answer" moved here since it's not an Answer to the original question but a rely to me.
Thank you for your reply....
I used your code to calculate PSNR and MSE to determine image quality. The code is running properly. I am values of PSNR and MSE.
But i had a doubt. In the code we used two images: One original and other noisy. So how can we conclude that PSNR and MSE values indicate that quality of image is more in original than in noisy image.
Image Analyst
Image Analyst 2014년 6월 2일
Glad it's running properly. Can you mark my answer as accepted yet?
MSE and PSNR compare two images and tells how different they are. It doesn't know which is the "correct" one and which is the "noisy" one. You'll have to have other criteria for that. And you can't necessarily just go with whichever has higher standard deviation because maybe the image with higher standard deviation is the better one because it's in focus and the one with lower standard deviation is the bad one because it's blurred.
Image Analyst
Image Analyst 2014년 6월 3일
I guess it's not running properly after all. What does size(Xapp) report?
nithya b
nithya b 2020년 8월 24일
my first question is whether quality of image can be identifed for single image? first one i want to get quality of image before preprocessing (aquired from sensor) and second one is after pre-processing.
my second doubt is when calculating psnr value it is asking for two images as input image one is destImg and the other is original image. i have two images one is the output of median filter of my input fingerprint image and then mean filter of input fingerprint image. So here i want to know which output gives better psnr. so i gave as psnr(medianfilteroutput, meanfilteroutput). got psnr value of 24.69. is this correct way of finding psnr value? if correct shall i assume this psnr is for medianfilter?
if it is wrong how to find correct psnr of a method's output? how to compare two methods' output?
Image Analyst
Image Analyst 2020년 8월 24일
There are quality metrics that don't use a reference:

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

pranay yadav
pranay yadav 2017년 2월 23일

1 개 추천

What is the Formula MAXER and L2RAT
remos remos
remos remos 2015년 1월 9일

0 개 추천

in the same subject I work on the mosaic of images with two different method So I have two different results. Visually a method from the two gives good result I want to compare the quality of both results and conclude one that gives good results and I don't know how to use your code to get that

질문:

2014년 5월 31일

댓글:

2020년 8월 24일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by