how to overcome this error?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
STUDENT_HUB
am 29 Mai 2014
Kommentiert: STUDENT_HUB
am 30 Mai 2014
??? 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 Kommentare
Akzeptierte Antwort
dpb
am 29 Mai 2014
f (size(A) ~= size(B)) error('The size of the 2 matrix are unequal')
The function is designed for images that are the same size -- to "solve" the problem, use it as intended. Either make sure are using images that are fundamentally the same resolution or clip the larger to be the size of the smaller before calling the function.
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!