how can i calculate MSE and PSNR of RGB color image?

H
Harrison · Oct 15, 2020 · 2.3K views
Question
i embeded a watermark in RGB color image now i want to calculate PSNR and MSE of original and watermarked images . how can i find PSNR and MSE of original and watermarked images
Expert Answer
Profile picture of John Michell
John Michell PhD Expert
Answered Aug 16, 2026
clc;

[filename1,pathname]=uigetfile('*.*','Select the original image'); 

image1=imread(num2str(filename1));

[filename2,pathname]=uigetfile('*.*','Select the watermarked image'); 

image2=imread(num2str(filename2));

figure(1);

imshow(image1); title('Original image'); 

figure(2);

imshow(image2); title('Watermarked image');    

[row,col] = size(image1)

size_host = row*col;

o_double = double(image1);

w_double = double(image2);

s=0;

for j = 1:size_host; % the size of the original image

s = s+(w_double(j) - o_double(j))^2 ; 
end

mes=s/size_host;

psnr =10*log10((255)^2/mes);

display 'Value of',psnr
100% Run Guarantee 3-Hour Fast-Track Delivery

Need a Custom Version or Complete Simulation for This Problem?

Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.

Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here

Get a Free Consultation or a Sample Assignment Review!