Calculation of psnr value in RGB image. I have calculated psnr using this code. But the result obtained is a complex number. What should be the error??

2 次查看(过去 30 天)
if true
function PSNR = psnrgb(I,W)
[m,n,p] = size(I); [h,w,q] = size(W); if m ~= h n ~= w p~=q error('Two images must have the same size.') end for k=1:p for i=1:m for j=1:n delta=sum(I(i,j,k)-W(i,j,k).^2); end end end
delta = 1/(m*n*p) * delta ; PSNR = 10 * log10( 255^2/delta );
end end

回答(0 个)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by