How to Calculate mse? This is correct mse = mean(mean((originalImage-embeddedImage).^2));

Réponses (1)

Image Analyst
Image Analyst le 8 Mai 2015

0 votes

No, only if they're floating point images, not integer images like uint8. You need to cast them to double so that your numbers don't get clipped at 0 if they would go negative.
You're best off using the built-in immse(). Otherwise if you want to do it yourself because you're missing the toolbox, see my attached code.

2 commentaires

Reem's "Answer" moved here:
function [PSNR]=psnr(originalImage,embeddedImage)
mse = mean(mean((originalImage-embeddedImage).^2));
MAXI=255; %MAXI is the maximum possible pixel value of the image.
%When the pixels are represented using 8 bits per sample, this is 255.
PSNR=10*log10(MAXI^2/mse);
end
This code
Not if they're typical images. Like I explained and showed you in the psnr.m file I attached for you, you need to case to double if they're uint8 which most images are.
mse = mean2((double(originalImage) - double(embeddedImage)).^2);

Connectez-vous pour commenter.

Catégories

En savoir plus sur Convert Image Type dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by