当前位置:网站首页>Image batch processing Gaussian filter noise reduction + peak signal-to-noise ratio calculation

Image batch processing Gaussian filter noise reduction + peak signal-to-noise ratio calculation

2022-07-26 01:37:00 Bright moon drunk windowsill

Batch images are filtered for Gaussian noise of different sizes

1. brief introduction

Denoising method : For known image and noise intensity ( The standard deviations are respectively 10,20,30,40,50,75,100), According to different intensity of Gaussian noise, adaptive Gaussian filter is used to denoise the original image , For the noise with small standard deviation, choose low-intensity Gaussian filter , When the standard deviation is large, the filter core with higher intensity is used for noise reduction , The designed filter uses Gaussian filter kernel to convolute with the original image to achieve the purpose of noise reduction .

2. Realization

use Matlab Language for algorithm implementation , And save the filtering results to the original folder , The SNR parameter is incorporated into the image name for reference , The algorithm is implemented as follows :

name={
    'Lena','Monarch','House'};
D={
    '10','20','30','40','50','75','100'};
 
for i=1:length(name)
    for j=1:length(D)
        [name{
    i},D{
    j}]
        path=['testimages\\',[name{
    i},D{
    j}],'.png'];
        img=imread(path);
        sigma=str2num(D{
    j});
        W = fspecial('gaussian',[sigma,sigma],1); 
        result = imfilter(img, W,'conv');
        psnr=getPSNR(img,result);
        imwrite(result,['testimages\\',[name{
    i},D{
    j}],'-psnr-',num2str(psnr),'.png']);
    end
end
 
function [psnr]=getPSNR(src,dst)
    diff=src-dst;
    MSE= sum(diff(:).*diff(:))/prod(size(src));
    psnr = 10*log10(255^2/MSE);
end

3. effect :

 Insert picture description here
 Insert picture description here
solve PSNR The formula , The noise reduction effect evaluation of the designed filter is shown in the table below :
 Insert picture description here

原网站

版权声明
本文为[Bright moon drunk windowsill]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/207/202207260135441658.html