⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uplusg_independencytest.m

📁 加权核函数的静态杂波抑制效果以及残留噪声的高斯性和独立性检验实验结果演示程序。 另外
💻 M
字号:
clear;
clc; 

%确定局部区域大小: (2*offset+1)*(2*offset+1)
offset=3;
[x,map]=imread('img_in.bmp');

x=double(x);
[ny,nx]=size(x);
y=zeros(ny,nx);

if (offset==1)
    %UniformplusGabor kernel 3*3
    wcoef=((ones(3)/9) +[0.2820,0.1904,0.0586;0.1904,0.1286,0.0396;0.0586,0.0396,0.0122])/2;
else
     %UniformplusGabor 7*7    
       w=[0.0491,    0.0470,    0.0412,    0.0331,    0.0244,    0.0165,    0.0102;
          0.0470,    0.0450,    0.0394,    0.0317,    0.0234,    0.0158,    0.0098;
          0.0412,    0.0394,    0.0346,    0.0278,    0.0205,    0.0138,    0.0086;
          0.0331,    0.0317,    0.0278,    0.0224,    0.0165,    0.0111,    0.0069;
          0.0244,    0.0234,    0.0205,    0.0165,    0.0121,    0.0082,    0.0055;
          0.0165,    0.0158,    0.0138,    0.0111,    0.0082,    0.0055,    0.0034;
          0.0102,    0.0098,    0.0086,    0.0069,    0.0051,    0.0034,    0.0021];
       wcoef=(ones(7)/49)+w;
       wcoef=wcoef/2;
end

%用UniformplusGabor Kernel 进行背景抑制
for i=1:(ny-2*offset)
 for j=1:(nx-2*offset)		                                
	 arr=x(i:(2*offset+1)+i-1,j:(2*offset+1)+j-1);
     %在局部块中进行列(或行)均值去除
     for p=1:(2*offset+1)
         arr(:,p)=arr(:,p)-mean(arr(:,p));
     end
     weightedsum=sum(sum(arr.*wcoef));
     yn(i,j)= arr(1,1)-weightedsum;
     yb(i,j)= weightedsum;
     if (j==nx-2*offset)
         for k=1:2*offset
            yn(i,j+k)= arr(1,k)-weightedsum; 
            yb(i,j+k)= weightedsum; 
         end
     end
      if (i==ny-2*offset)
         for k=1:2*offset      
             yn(i+k,j)= arr(k,1)-weightedsum; 
             yb(i+k,j)= weightedsum; 
         end
       end
     if (j==nx-2*offset)&(i==ny-2*offset)  
          for k=1:2*offset
              for l=1:2*offset
                  yn(i+k,j+l)= arr(k,l)-weightedsum; 
                  yb(i+k,j+l)= weightedsum;
              end
         end
     end
 end
end
%从残留图像中选取大小为100*100的像素块
 yn=yn(ny/2:(ny/2+99),nx/2:(nx/2+99));

%计算Friedman统计量及概率alpha
[p,table,stats]=friedman(yn(1:100,1:100),1,'off');
s(1)=table(2,5);
a(1)=table(2,6);
[p,table,stats]=friedman(yn(1:50,1:100),1,'off');
s(2)=table(2,5);
a(2)=table(2,6);
[p,table,stats]=friedman(yn(51:100,1:100),1,'off');
s(3)=table(2,5);
a(3)=table(2,6);
[p,table,stats]=friedman(yn(26:75,1:100),1,'off');
s(4)=table(2,5);
a(4)=table(2,6);
[p,table,stats]=friedman(yn(1:30,1:100),1,'off');
s(5)=table(2,5);
a(5)=table(2,6);
[p,table,stats]=friedman(yn(31:60,1:100),1,'off');
s(6)=table(2,5);
a(6)=table(2,6);
[p,table,stats]=friedman(yn(61:90,1:100),1,'off');
s(7)=table(2,5);
a(7)=table(2,6);
[p,table,stats]=friedman(yn(1:20,1:100),1,'off');
s(8)=table(2,5);
a(8)=table(2,6);
[p,table,stats]=friedman(yn(21:60,1:100),1,'off');
s(9)=table(2,5);
a(9)=table(2,6);
[p,table,stats]=friedman(yn(71:90,1:100),1,'off');
s(10)=table(2,5);
a(10)=table(2,6);

%对高斯白噪声计算Friedman统计量及概率alpha,与上述结果进行比较

yn=randn(100,100);
[p,table,stats]=friedman(yn(1:100,1:100),1,'off');
sn(1)=table(2,5);
an(1)=table(2,6);
[p,table,stats]=friedman(yn(1:50,1:100),1,'off');
sn(2)=table(2,5);
an(2)=table(2,6);
[p,table,stats]=friedman(yn(51:100,1:100),1,'off');
sn(3)=table(2,5);
an(3)=table(2,6);
[p,table,stats]=friedman(yn(26:75,1:100),1,'off');
sn(4)=table(2,5);
an(4)=table(2,6);
[p,table,stats]=friedman(yn(1:30,1:100),1,'off');
sn(5)=table(2,5);
an(5)=table(2,6);
[p,table,stats]=friedman(yn(31:60,1:100),1,'off');
sn(6)=table(2,5);
an(6)=table(2,6);
[p,table,stats]=friedman(yn(61:90,1:100),1,'off');
sn(7)=table(2,5);
an(7)=table(2,6);
[p,table,stats]=friedman(yn(1:20,1:100),1,'off');
sn(8)=table(2,5);
an(8)=table(2,6);
[p,table,stats]=friedman(yn(21:60,1:100),1,'off');
sn(9)=table(2,5);
an(9)=table(2,6);
[p,table,stats]=friedman(yn(71:90,1:100),1,'off');
sn(10)=table(2,5);
an(10)=table(2,6);

s
a
sn
an

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -