【问题标题】:least mean square filter to reduce noise in image?最小均方滤波器以减少图像中的噪声?
【发布时间】:2014-04-04 07:54:54
【问题描述】:

我有一个参考图像和输出图像有很多噪音。我为两个图像中的一部分创建了一个蒙版。我想设计一个过滤器,当应用于这个区域时,可以应用于整个区域。我是使用最小均方法来减少噪音。但每次均方均不断增加。知道如何解决这个问题。我正在使用 MAT LAB 来做到这一点。这是我的代码。

    output=double(imread('obtained_output.jpg'));
    reference=double(imread('reference_output.jpg')); 
    [M,N]=size(output);
    upper_mask_obtained = output(1:100, 1:100);
    lower_mask_obtained=output(201:300,1:100);
    total_mask_obtained=[upper_mask_obtained;lower_mask_obtained];
    upper_mask_reference = reference(1:100, 1:100);
    lower_mask_reference=reference(201:300,1:100);
    total_mask_reference=[upper_mask_reference;lower_mask_reference];
           Ns=5;
          [a,b]=size(total_mask_reference);
           u=.000000001;
           W=ones(Ns,Ns);
          Y=zeros(Ns,Ns); 
          DD=zeros(Ns,Ns);
          error=zeros(M,N);
          e=zeros(Ns,Ns);
          error_mask=abs(total_mask_obtained-total_mask_reference);
          s= sum(sum(error_mask.^2));
          mean_square_error=(s/(a*b));

            while(mean_square_error>7)

            for m=1+Ns:200
             for n=1+Ns:100 

               for l=1:Ns
                 for k=1:Ns

                    Y(l,k)=total_mask_obtained(m-Ns+l-1,n-Ns+k-1);
                    DD(l,k)=total_mask_reference(m-Ns+l-1,n-Ns+k-1);     
                 end
                end 

            Z=conv2(Y,W,'same')/sum(sum(W));
            e=DD(3,3)-Z(3,3); 
            W=(W+u*e*Y);
            total_mask_obtained(m-Ns+2,n-Ns+2)=Z(3,3);
           end 
          end 

          error=total_mask_reference-total_mask_obtained;
          mean_square_error=sum(sum(error.^2))/(a*b); 

         end

         figure(2);
         final_output=(conv2(output,W,'same')/(sum(sum(W))));
         imshow(uint8(final_output));

【问题讨论】:

  • 请正确缩进?您知道在 MATLAB 编辑器中可以使用智能缩进。
  • 我不认为噪音可以是任何类型的。它通常是一种或几种类型。请您发布参考图像和输出图像吗?
  • 谁能告诉我如何在这里发布图片?
  • 您点击图片按钮(在 {} 旁边)并上传。
  • 你能展示一下你所做的背后的数学吗?

标签: matlab image-processing


【解决方案1】:

我认为使用高斯滤波器可以很好地完成您的任务。它已经内置在 Matlab 中。 http://www.mathworks.com/help/images/ref/fspecial.html 检查此内容以供参考。抱歉,我是 StackOverflow 的新手。所以我还不能添加cmets。抱歉,如果它没有回答您的问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-11-25
    • 1970-01-01
    • 2016-09-27
    • 1970-01-01
    • 2016-09-20
    • 2015-09-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多