(原创)极化SAR精致Lee滤波matlab…

    关于精致Lee滤波的原创matlab代码,只限仿真使用。是自己在初学的时候自己写的代码,后来才知道有官方的代码,只需运行PolSARpro软件即可。不过做为初学,还是有一定纪念意义,贴上来分享交流一下。
   
    仿真论文是:
         L. Jong-Sen, M. R. Grunes, and G. De Grandi, "Polarimetric SAR speckle filtering and its  implication for classification," Geoscience and Remote Sensing, IEEE Transactions on, vol. 37, pp. 2363-2373, 1999.

    
    关于数据 SanFrancisco_C.matSanFrancisco_T.mat的获取,可以先访问欧空局的网站 http://earth.eo.esa.int/polsarpro/datasets.html,下载到原始数据,然后解压成下面图片所示形式。之后用图片下面蓝色代码读出即可。

(原创)极化SAR精致Lee滤波matlab代码

0.下面蓝色代码读出T矩阵和C矩阵

clc;
clear all;
addpath .\T3

file_idt11 = fopen('T3\T11.bin','rb');
file_idt22 = fopen('T3\T22.bin','rb');
file_idt33 = fopen('T3\T33.bin','rb');
file_idt12r = fopen('T3\T12_real.bin','rb');
file_idt12i = fopen('T3\T12_imag.bin','rb');
file_idt13r = fopen('T3\T13_real.bin','rb');
file_idt13i = fopen('T3\T13_imag.bin','rb');
file_idt23r = fopen('T3\T23_real.bin','rb');
file_idt23i = fopen('T3\T23_imag.bin','rb');
h=900;
w=1024;
col=w*h;
t11=zeros(h,w);
for i=1:h
    t11(i,:)=fread(file_idt11,w,'float32');%tmp=fread(file_idt11,12,'int8');
    t22(i,:)=fread(file_idt22,w,'float32');%tmp=fread(file_idt22,12,'int8');
    t33(i,:)=fread(file_idt33,w,'float32');%tmp=fread(file_idt33,12,'int8');
    t12i(i,:)=fread(file_idt12i,w,'float32');%tmp=fread(file_idt12i,12,'int8');
    t12r(i,:)=fread(file_idt12r,w,'float32');%tmp=fread(file_idt12r,12,'int8');
    t13i(i,:)=fread(file_idt13i,w,'float32');%tmp=fread(file_idt13i,12,'int8');
    t13r(i,:)=fread(file_idt13r,w,'float32');%tmp=fread(file_idt13r,12,'int8');
    t23i(i,:)=fread(file_idt23i,w,'float32');%tmp=fread(file_idt23i,12,'int8');
    t23r(i,:)=fread(file_idt23r,w,'float32');%tmp=fread(file_idt23r,12,'int8');
end
t12=complex(t12r,t12i);
t13=complex(t13r,t13i);
t23=complex(t23r,t23i);

save
SanFrancisco_T t11 t22 t33 t12 t23 t13





1.主函数:
clear all,close all

load SanFrancisco_C.mat
load
SanFrancisco_T.mat

span = c11 + c22 + c33;

m_orig = 900;
n_orig = 1024;

span = span(1:m_orig,1:n_orig);
t11 = t11(1:m_orig,1:n_orig);
t12 = t12(1:m_orig,1:n_orig);
t13 = t13(1:m_orig,1:n_orig);
t22 = t22(1:m_orig,1:n_orig);
t23 = t23(1:m_orig,1:n_orig);
t33 = t33(1:m_orig,1:n_orig);

span = double(span);
[msize,nsize]  = size(span);
A = flipdim(span,1);
A1 = [A;span;A];
A2 = flipdim(A1,2);
B = [A2,A1,A2];
expan_span = B;

deltau = 0.5;
blockSize = 7;
sub_blockNum = 9;
sub_blockWide = sub_blockNum/3;

 t11_filtered = zeros(msize,nsize);
 t12_filtered = zeros(msize,nsize);
 t13_filtered = zeros(msize,nsize);
 t22_filtered = zeros(msize,nsize);
 t23_filtered = zeros(msize,nsize);
 t33_filtered = zeros(msize,nsize);

%将T矩阵每个分量也相应扩展
[expan_t11,expan_t12,expan_t13,expan_t22,expan_t23,expan_t33] = expan_T(t11,t12,t13,t22,t23,t33);


for i = 1:msize
    for j = 1:nsize
        disp([ '  i=' num2str(i) '   j=' num2str(j)])
        original_T = [t11(i,j),       t12(i,j),       t13(i,j);
                      conj(t12(i,j)), t22(i,j),       t23(i,j);
                      conj(t13(i,j)), conj(t23(i,j)), t33(i,j)];
        %取出相应的小块
        [block,block_t11_resh,block_t12_resh,block_t13_resh,block_t22_resh,...
                block_t23_resh,block_t33_resh] ...
                = choose_block(expan_span,expan_t11,...
                expan_t12,expan_t13,expan_t22,expan_t23,expan_t33,i,j,msize,nsize,blockSize) ;        
                
       
        mean_sub_block = zeros(3,3);
       
        for p = 1:2:5%求均值矩阵
            for q = 1:2:5
                sub_block = block(p:p+sub_blockWide-1,q:q+sub_blockWide-1);
             

你可能感兴趣的:((原创)极化SAR精致Lee滤波matlab…)