Advertisement
Guest User

Untitled

a guest
Sep 18th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.22 KB | None | 0 0
  1. function psnr_out = calculate_psnr(f, g)
  2.     df = double(f);
  3.     dg = double(g);
  4.     [m, n] = size(df);
  5.     mse = sum((df - dg).^2, 'all') / (m*n);
  6.     ratio = max(df(:))^2 / mse;
  7.     psnr_out = 10*log10(ratio);
  8. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement