how to overcome this error?
显示 更早的评论
??? Error using ==> PSNR at 5 The size of the 2 matrix are unequal
Error in ==> SN at 71 psn(1,ii)=PSNR(im1,img1);
- SN.m CODE attached
- PSNR.m CODE
function psnr_Value = PSNRN(A,B) % PSNR (Peak Signal to noise ratio)
if (size(A) ~= size(B)) error('The size of the 2 matrix are unequal')
psnr_Value = NaN;
return;
elseif (A == B)
disp('Images are identical: PSNR has infinite value')
psnr_Value = 100;
return;
else
maxValue = double(max(A(:)));
% Calculate MSE, mean square error.
mseImage = (double(A) - double(B)) .^ 2;
[rows columns] = size(A);
mse = sum(mseImage(:)) / (rows * columns);
% Calculate PSNR (Peak Signal to noise ratio)
psnr_Value = 10 * log10( 256^2 / mse);
end
end % function END
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Image Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!