MATLAB 中图像增强的 PSNR 负值
Negative value for PSNR after image enhancment in MATLAB
到目前为止我已经这样做了。在频域图像增强进行评估后,我计算了 PSNR。 PSNR和SNR的值为负。
另外,输入输出图像class是double。
ref = imread('img.tif');
ref=im2double(ref);
%A = processing(ref);
%Calculate the PSNR.
[peaksnr, snr] = psnr(A, ref);
有人可以进一步帮助我吗?
我认为您正在将 ref
转换为 double,为什么要将其转换为 double?根据 PSNR
的定义,psnr
永远不会为负
请先尝试这些代码,然后再解决您的问题:
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);
希望对您有所帮助。
到目前为止我已经这样做了。在频域图像增强进行评估后,我计算了 PSNR。 PSNR和SNR的值为负。
另外,输入输出图像class是double。
ref = imread('img.tif');
ref=im2double(ref);
%A = processing(ref);
%Calculate the PSNR.
[peaksnr, snr] = psnr(A, ref);
有人可以进一步帮助我吗?
我认为您正在将 ref
转换为 double,为什么要将其转换为 double?根据 PSNR
psnr
永远不会为负
请先尝试这些代码,然后再解决您的问题:
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);
希望对您有所帮助。