-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathpsnr.m
27 lines (23 loc) · 965 Bytes
/
psnr.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
% 感谢亲亲使用此代码,此代码解决您的问题了吗~(@^_^@)~
% 没解决的话告诉亲亲一个好消息,我这里可以1分钱帮助代码改错,还提供1分钱成品代码(′▽`〃)哦~
% 登录淘宝店铺“大成软件工作室”便可领取
% 是的,亲亲真的没有看错,挠破头皮的问题真的1分钱就可以解决了\(^o^)/YES!
% 小的这就把传送门给您,记得要收藏好哦(づ ̄3 ̄)づ╭~
% 传送门:https://item.taobao.com/item.htm?spm=a1z10.1-c.w4004-15151018122.5.uwGoq5&id=538759553146
% 如果传送门失效,亲亲可以来店铺讨要,客服MM等亲亲来骚扰哦~(*/ω╲*)
function psnr = psnr(originalimg, restoredimg)
%PSNR Summary of this function goes here
% Detailed explanation goes here
%Peak Signal to Noise Ratio (PSNR)峰值信噪比
md = (originalimg - restoredimg).^2;
mdsize = size(md);
summation = 0;
for i = 1:mdsize(1)
for j = 1:mdsize(2)
summation = summation + abs(md(i,j));
end
end
psnr = size(originalimg, 1) * size(originalimg, 2) * max(max(originalimg.^2))/summation;
psnr = 10 * log10(psnr);
%}
end