I am working on Speckle Noise reduction in Ultrasound Images using MATLAB R2013. I have designed 10 basic filters and trying out hybrid combination using these filters. When I run my program I get different results at different time for the same input image, no other input parameters were changed. When I ran my program at 1.17 am, I got the PSNR = 74.5424 and when I ran the same program at 1.21 am, I got PSNR = 75.04. Why this is happening ?

If it is coming different values at every time I run my program, how could I conclude on a single value ? Please help. I have attached the screenshot below, see the values of SNR, PSNR, Beta and Speckle Index.

problem with my program

  • 3
    $\begingroup$ Two comments: 1) this is more of a programming question than a signal processing question, and 2) the program probably "remembers" its state from one run to another, so the different initial states are changing the results. $\endgroup$
    – Jim Clay
    Jan 9, 2014 at 1:39
  • $\begingroup$ Do you generate the input image inside your program? Do you add noise to it inside your program? $\endgroup$
    – Dima
    Jan 9, 2014 at 2:03
  • $\begingroup$ @Dima, No I did not generate image inside my program.. Yes, I have added the noise inside my program $\endgroup$
    – Premnath D
    Jan 9, 2014 at 6:48
  • 2
    $\begingroup$ If you added noise inside your program, and it is based on some kind of random generator, that very possibly depends on time. The answers for different random noise treated with the same procedure should be similar, but never the same. You could try averaging, or taking a median, of multiple different runs. $\endgroup$
    – penelope
    Jan 9, 2014 at 10:48
  • 1
    $\begingroup$ Or you can seed the random number generator with the same value every time. $\endgroup$
    – John
    Jan 9, 2014 at 15:36

1 Answer 1


imnoise for speckle noise adding is not deterministic. I would suggest you save the noise image after imnoise by calculate the difference between the noise added image and the raw clean image. When you test other filters and want to make a comparison, directly add the noise image to the raw image.

Or you can repeat the filter experiment many times (each time use imnoise) and get an average of PSNR, SNR, and Beta.

  • $\begingroup$ you are very welcome! $\endgroup$
    – lennon310
    Jan 9, 2014 at 17:37

Not the answer you're looking for? Browse other questions tagged or ask your own question.