• 大小: 2KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-10
  • 语言: 其他
  • 标签: icm  条件迭代  

资源简介

----icm---条件迭代算法,条件迭代算法基于MRF----ICM----

资源截图

代码片段和文件信息

function y=icm1(fk)
%GMM

ite=0;
[mn]=size(f);
y=zeros(mn);
ff=wextend(‘2‘‘symw‘f1);
beta=1;
%label=ceil(k.*rand(mn));
tihuan=kmeans(f(:)k);
label=zeros(mn);
label(:)=tihuan(:);
theta=zeros(4k);
vark=zeros(k1);
f1=ff(1:m2:n+1);
f2=ff(2:m+11:n);
f3=ff(3:m+22:n+1);
f4=ff(2:m+13:n+2);
f11=f1.*f1;
f12=f1.*f2;
f13=f1.*f3;
f14=f1.*f4;
f22=f2.*f2;
f23=f3.*f2;
f24=f2.*f4;
f33=f3.*f3;
f34=f3.*f4;
f44=f4.*f4;
ff1=f.*f1;
ff2=f.*f2;
ff3=f.*f3;
ff4=f.*f4;
while ite<1000 && sum(sum(abs(y-label)))>0
    ite=ite+1;
    y=label;
    labelext=wextend(‘2‘‘symw‘label1);
    for i=1:k
        li=find(label==i);
        fi11=sum(f11(li));
        fi12=sum(f12(li));
        fi13=sum(f13(li));
        fi14=sum(f14(li));
        fi22=sum(f22(li));
        fi23=sum(f23(li));
        fi24=sum(f24(li));
        fi33=sum(f33(li));
        fi34=sum(f34(li));
        fi44=sum(f44(li));
        fif1=sum(ff1(li));
        fif2=sum(ff2(li));
        fif3=sum(ff3(li));
        fif4=sum(ff4(li));
        theta(:i)=inv([fi11fi12fi13fi14;fi12fi22fi23fi24;fi13fi23fi33fi34;fi14fi24fi34fi44])*[fif1;fif2;fif3;fif4];
        vt=f(li)-theta(1i).*f1(li)-theta(2i).*f2(li)-theta(3i).*f3(li)-theta(4i).*f4(li);
        vark(i)=std(vt);
    end
    for i=1:m
        for j=1:n
            energy=ones(k1)*100000000000000;
            for h=1:k
                fl=find(labelext(i:i+2j:j+2)==h);
                num=numel(fl);
                vst=10-2*num;
                energy(h)=beta*vst+log(vark(h))+(f(ij)-theta(1h).*f1(ij)-theta(2h).*f2(ij)-theta(3h).*f3(ij)-theta(4h).*f4(ij)).^2/(2*vark(h).^2);
            end
            label(ij)=find(energy==min(energy));
        end
    end
    %beta=beta*1.07;
end
y=label;
imshow(mat2gray(y));

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       1840  2011-09-19 20:46  91374997icm1\icm1.asv

     文件       1829  2011-09-23 15:34  91374997icm1\icm1.m

     目录          0  2011-10-24 09:38  91374997icm1

----------- ---------  ---------- -----  ----

                 3669                    3


评论

共有 条评论