0

到目前为止,我已经这样做了。在评估频域图像增强后,我计算了 PSNR。PSNR 和 SNR 的值为负。

此外,输入和输出图像的类别是双重的。

ref = imread('img.tif');
ref=im2double(ref);
%A = processing(ref);
%Calculate the PSNR.
[peaksnr, snr] = psnr(A, ref);

有人可以进一步帮助我吗?

4

1 回答 1

2

我认为您正在转换ref为双倍,为什么要将其转换为双倍?根据PSNRpsnr的定义,永远不会是负数

请先尝试这些代码,然后再解决您的问题:

ref = imread('pout.tif');
A = imnoise(ref,'salt & pepper', 0.02);
% Calculate the PSNR.
[peaksnr, snr] = psnr(A, ref);
fprintf('\n The Peak-SNR value is %0.4f', peaksnr);
fprintf('\n The SNR value is %0.4f \n', snr);

上面的代码是:

The Peak-SNR value is 22.6437
The SNR value is 15.5524 

在您的情况下,只需尝试以下操作:

ref = imread('img.tif');
A = processing(im2double(ref));% what does it do?
% Check the type of A, is it uint8 data type, if not then convert it to that 
%Calculate the PSNR.
[peaksnr, snr] = psnr(uint8(A), ref);

希望这会帮助你。

于 2016-05-16T03:30:49.450 回答