Have you checked the Wikipedia article on PSNR ? For example, it gives a cleaner formula that will correct your code (for example, why do you check if MSE is> 0? If you defined the MSE correctly, it should be greater than 0. Also, it looks like Matlab code, so use the log10() function log10() to preserve some confusing basic transformations. Finally, make sure that the input for this function is actually a quantized image on a scale of 0-255, not a double image between 0 and 1).
Your question is unclear. If you want to use PSNR as an indicator of performance, then you must calculate the PSNR of each unnamed method compared to the original and report these numbers. This probably will not give a very good overview of which methods work better, but this is only the beginning. Another method may be to manually select smaller subregions of the original image, which, in your opinion, correspond to various qualitative phenomena, such as a window in the background, a window in the foreground, and a window covering these two elements. Then calculate the PSNR only for these windows, repeating again for each impaired result compared to the original. At the end, you want a table showing the PSNR of each other method compared to the original, possibly with this sub-window splitting.
You might want to take a look at more complex methods depending on which application it is for. A very useful chapter on noise reduction in Tony Chanβs book ( link ).
source share