function PSNR(A,B)
% PURPOSE: To find the PSNR (peak signal-to-noise ratio) between two
% intensity images A and B, each having values in the interval
% [0,1]. The answer is in decibels (dB).
%
% SYNOPSIS: PSNR(A,B)
%
% DESCRIPTION: The following is quoted from "Fractal Image Compression",
% by Yuval Fisher et al.,(Springer Verlag, 1995),
% section 2.4, "Pixelized Data".
%
% "...PSNR is used to measure the difference between two
% images. It is defined as
%
% PSNR = 20 * log10(b/rms)
%
% where b is the largest possible value of the signal
% (typically 255 or 1), and rms is the root mean square
% difference between two images. The PSNR is given in
% decibel units (dB), which measure the ratio of the peak
% signal and the difference between two images. An increase
% of 20 dB corresponds to a ten-fold decrease in the rms
% difference between two images.
%
% There are many versions of signal-to-noise ratios, but
% the PSNR is very common in image processing, probably
% because it gives better-sounding numbers than other
% measures."
%
% EXAMPLE 1: load clown
% A = ind2gray(X,map); % Convert to an intensity image in [0,1].
% B = 0.95 * A; % Make B close to, but different from, A.
% PSNR(A,B) % ---> "PSNR = +33.49 dB"
%
% EXAMPLE 2: A = rand(256); % A is a random 256 X 256 matrix in [0,1].
% B = 0.9 * A; % Make B close to, but different from, A.
% PSNR(A,B) % ---> "PSNR = +24.76 dB (approx)"
if A == B
error('Images are identical: PSNR has infinite value')
end
max2_A = max(max(A));
max2_B = max(max(B));
min2_A = min(min(A));
min2_B = min(min(B));
if max2_A > 1 | max2_B > 1 | min2_A < 0 | min2_B < 0
error('input matrices must have values in the interval [0,1]')
end
err = A - B;
decibels = 20*log10(1/(sqrt(mean(mean(err.^2)))));
disp(sprintf('PSNR = +%5.2f dB',decibels))
没有合适的资源?快使用搜索试试~ 我知道了~
分数阶傅里叶变换数字水印matlab程序.zip
共6个文件
m:5个
jpg:1个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 57 浏览量
2023-01-30
19:42:37
上传
评论
收藏 148KB ZIP 举报
温馨提示
分数阶傅里叶变换数字水印matlab程序.zip
资源推荐
资源详情
资源评论
收起资源包目录
分数阶傅里叶变换数字水印matlab程序.zip (6个子文件)
lena.jpg 146KB
centralcrop.m 533B
nwcrop.m 402B
frft2d.m 352B
addnoise.m 197B
PSNR.m 2KB
2
G2
共 6 条
- 1
资源评论
处处清欢
- 粉丝: 174
- 资源: 2534
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功