小编eli*_*eli的帖子

为什么 matlab 中的 psnr 函数对于被柯西噪声损坏的图像返回负值?

我编写了以下 matlab 代码,用于生成被柯西噪声损坏的噪声图像,但是当我使用 matlab 中的 psnr 函数计算噪声图像的 psnr 值时,它返回一个负值,而根据我已经实现其结果的论文,尺寸为 256 x 256 且柯西噪声为 0.02 的摄影师测试图像的 psnr 值必须在 19 左右。如果有人能帮助我解决这个问题,我将不胜感激。

refimg = im2double(imread('cameraman.png')); % original image
img_height = size(refimg,1);
img_width = size(refimg,2);
refimg = refimg(1:img_height,1:img_width);

rng(0);
r1 = random('Normal',0, 1,[img_height img_width]);
r2 = random('Normal',0, 1,[img_height img_width]);

n = 0.02; % the noise level
u0 = refimg + n.*(r1./r2);

figure(1); imshow(u0);

PSNR_noisy = psnr(refimg,u0)
Run Code Online (Sandbox Code Playgroud)

matlab image-processing

0
推荐指数
2
解决办法
314
查看次数

标签 统计

image-processing ×1

matlab ×1