How can I calculate the MSE between 2 images?

조회 수: 24 (최근 30일)
Tanish Mehta
Tanish Mehta 2019년 10월 31일
편집: KALYAN ACHARJYA 2019년 11월 5일
ref=imread("birdmiddle.png");
A=imread("birdmiddle2.png");
err = immse(A, ref);
fprintf('\n The mean-squared error is %0.4f\n', err);
** I am trying to find the MSE but the following error shows. Image 'A' is the original image 'ref' compressed using lossy jpeg compression, and then the compressed jpeg is converted back into a png. Why is there an error?**
Error using immse (line 34)
A and B must have the same class.

답변 (1개)

KALYAN ACHARJYA
KALYAN ACHARJYA 2019년 10월 31일
편집: KALYAN ACHARJYA 2019년 10월 31일
ref=imread('birdmiddle.png');
A=imread('birdmiddle2.png');
err = immse(A, ref);
fprintf('\n The mean-squared error is %0.4f\n', err);
Still problem is not solved, please attached two images
  댓글 수: 2
Tanish Mehta
Tanish Mehta 2019년 11월 1일
I think the problem earlier was that the original picture was uint16 but the second image was uint8. So i converted the second image to uint16 so both images would have the same class. The MSE calculation was successful however the number is very high. The MSE was '2041744502.9629'. Can this be correct?
Thanks a lot for the help!
KALYAN ACHARJYA
KALYAN ACHARJYA 2019년 11월 5일
편집: KALYAN ACHARJYA 2019년 11월 5일
Can you attach the two original images? One suggestion, convert the both to uint8 and find the same, do share the result value (MSE)?
psnr-and-mse.png
Tanish do calculate (samples) on notebook, you get the idea.

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

Community Treasure Hunt

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

Start Hunting!

Translated by