I have written the following matlab code for producing a noisy image corrupted by Cauchy noise but when I compute the psnr value of the noisy image using psnr function in matlab, it returns a negative value while according to the paper that I have implemented its results, the psnr value for the cameraman test image of size 256 by 256 and 0.02 of Cauchy noise must be around 19. I appreciate it if someone could please help me to solve this problem.

The image intensity range is [0,1] for cameraman test image.

refimg = im2double(imread('cameraman.png')); % original image
img_height = size(refimg,1);
img_width = size(refimg,2);
refimg = refimg(1:img_height,1:img_width);

r1 = random('Normal',0, 1,[img_height img_width]);
r2 = random('Normal',0, 1,[img_height img_width]);

n = 0.02; % the noise level
u0 = refimg + n.*(r1./r2);

figure(1); imshow(u0);

PSNR_noisy = psnr(refimg,u0)
  • $\begingroup$ Your noise level is 0.02. What is the level of your signal ? $\endgroup$
    – Hilmar
    Nov 7, 2021 at 19:32
  • $\begingroup$ This is a duplicate question, asked and answered over on SO: stackoverflow.com/q/69872113/7328782 $\endgroup$ Nov 8, 2021 at 2:18


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.