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

2 件のコメント

Aniket Paranjpe
Aniket Paranjpe 2017 年 12 月 19 日
How to compute three PSNR Values , one for each channel?
siva shangari
siva shangari 2020 年 7 月 16 日
how to compute mean and variance for each channel?

サインインしてコメントする。

 採用された回答

B.k Sumedha
B.k Sumedha 2015 年 5 月 21 日
編集済み: B.k Sumedha 2015 年 6 月 16 日

0 投票

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

12 件のコメント

AKSHAY PUSHPAD
AKSHAY PUSHPAD 2016 年 9 月 23 日
While using above mentioned program..i am getting this error command.. Error: File: Untitled.m Line:4 column: 11 Unexpected MATLAB operator.
What does this mean??
Image Analyst
Image Analyst 2016 年 9 月 23 日
Looks okay to me. You might try my attached demo instead and see if that works.
Atika Nugraheni
Atika Nugraheni 2016 年 10 月 26 日
why I only got the result of PSNR is one value? why does it not give 3 value? the format of both images is RGB, right? and how to show the value of MSE?
Image Analyst
Image Analyst 2016 年 10 月 26 日
I don't know what code you ran. Make sure you're running it only one color channel at a time and do it for each color channel if you want 3 PSNR's out.
Atika Nugraheni
Atika Nugraheni 2016 年 10 月 28 日
Ok Thankyou
Atika Nugraheni
Atika Nugraheni 2016 年 11 月 21 日
I want to ask, actually if both images is RGB, then the MSE value consist of 3, MSE for Red, Green, and Blue. And how about the PSNR of the RGB image? The correct way, Is the PSNR produce three value of color channel or just one value used the average of MSE? Please explain.
Image Analyst
Image Analyst 2016 年 11 月 21 日
They're both 3 values - one for each color channel. You can average them together, if you want, to produce one number. Whatever meets your needs.
Atika Nugraheni
Atika Nugraheni 2016 年 11 月 22 日
Is it possible if the result of PSNR is negative? Because I obtained the value of PSNR is negative. If the MSE result is high then the PSNR result is low? am I right? Please explain. thankyou
Chidiebere Ike
Chidiebere Ike 2018 年 11 月 17 日
@ Image Analyst...I observed that the attached PNSR code is for Gray scale images, it this code applicable to Color images ?? also
siva shangari
siva shangari 2020 年 7 月 16 日
@Image Analyst... how to compute mean and variance for each channel?
Walter Roberson
Walter Roberson 2020 年 7 月 17 日
mean(YourSignal,2) %mean over columns
var(YourSignal, [], 2) %variance over columns
If "channel" means color pane in this case, then
mean(YourSignal, [1 2])
var(YourSignal, [], [1 2])

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by