PSNR CALCULATING MEDIAN FILTER GAUSSIAN FİLTER
    7 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
    Ali Zulfikaroglu
 am 23 Jan. 2021
  
    
    
    
    
    Kommentiert: Ali Zulfikaroglu
 am 23 Jan. 2021
            I am adding salt and pepper noise to original image.
and then I am filtering this noise with median filter and gaussian filter. 
I want to get psnr values of median filter and gaussian filter effect on this salt and pepper noise and then compare this two filter which one have high ratio.
But I don't know which code is true for calculating.
My code is below. 
img=imread('image.jpg');
if(size(img,3)>1)
img=rgb2gray(img);
end
SP=imnoise(img,'salt & pepper',0.1);
MDO = medfilt2(img);
MDSP = medfilt2(SP);
GO = imgaussfilt(img);
GSP = imgaussfilt(SP);
% 1) psnrMDSP = psnr(SP,MDO);
% 1) psnrGSP = psnr(SP,GO);
% 2) psnrMDSP = psnr(SP,MDSP); 
% 2) psnrGSP = psnr(SP,GSP);
% Which number calculating is true 1 or 2 ? 
% my aim is to get which filter is successful psnr values on this salt and pepper noise. 
0 Kommentare
Akzeptierte Antwort
  KALYAN ACHARJYA
      
      
 am 23 Jan. 2021
        
      Bearbeitet: KALYAN ACHARJYA
      
      
 am 23 Jan. 2021
  
      "% my aim is to get which filter is successful psnr values on this salt and pepper noise."
2nd One
If you check the format of the PSNR calculation you may get the answer
psnr_val=psnr(resultant_image,Noisy_image)
Or
psnr_val=psnr(resultant_image,reference_image)
Or
psnr_val=psnr(filtered_image,noisy_image)
Then this one to see the performance of medfilt2 and imgaussfilt filter on the particular noisy image. Here SP is the noisy imag, MDSP and GSP are the filtered images(on Noisy Image) using medfilt2 and imgaussfilt respectively. 
% 2) psnrMDSP = psnr(SP,MDSP); 
% 2) psnrGSP = psnr(SP,GSP);
More, then what does "1" means in the code 
% 1) psnrMDSP = psnr(SP,MDO);
% 1) psnrGSP = psnr(SP,GO);
Here, if you carefully notice, here SP is the noisy image, on the other hand MDO and GO are the filtered images on the Original Image. Here in '1' applied the filters on original image, not the noisy image.
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

