资源简介

用单阈值三种方法实现肺野分割的Matlab程序

资源截图

代码片段和文件信息

function I_gray = Kapur(I_gray)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
I_gray=double(I_gray);       %转化为双精度
[widthheight]=size(I_gray);
graylevel=256;               %灰度级
hist=zeros(1graylevel);     %直方图赋初值
 
%计算直方图
for i=1:width
    for j=1:height
        m=I_gray(ij)+1;
        hist(m)=hist(m)+1;
    end
end

p=zeros(1graylevel);

for i=1:1:graylevel
    p(i)=hist(i)/(width*height); %直方图归一化
end

E1=zeros(1graylevel);
E2=zeros(1graylevel);
P=zeros(1graylevel);
E=zeros(1graylevel);


for t=1:1:graylevel
    for i=1:1:t
        P(t)=P(t)+p(i);
    end
        if(P(t)>0&&P(t)<1)
%               Q=0;
          %计算灰度范围为[1t]的熵
           for i=1:1:t
               E1(t)=E1(t)-(p(i)/P(t))*log(p(i)/P(t)+eps);
           end
%            A(s)=2*log(P(s

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

     文件     238704  2010-01-07 12:09  lungSegmentation\images\2.PNG

     文件     207951  2010-01-05 19:48  lungSegmentation\images\3.png

    ..A.SH.     46592  2010-01-07 13:51  lungSegmentation\images\Thumbs.db

     文件       1579  2010-01-06 21:30  lungSegmentation\Kapur.m

     文件       1410  2010-01-07 11:00  lungSegmentation\kittler.m

     文件        554  2010-01-13 10:33  lungSegmentation\LungSegmentation_demo.m

     文件       1456  2010-01-06 21:20  lungSegmentation\ostu.m

     目录          0  2010-01-13 10:33  lungSegmentation\images

     目录          0  2010-01-13 10:30  lungSegmentation

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

               498246                    9


评论

共有 条评论