Labfans是一个针对大学生、工程师和科研工作者的技术社区。 | 论坛首页 | 联系我们(Contact Us) |
![]() |
![]() |
#1 |
初级会员
注册日期: 2008-04-23
年龄: 38
帖子: 6
声望力: 0 ![]() |
![]()
function img=myimgpreprocess(I)
Igray=rgb2gray(I); Ibw=im2bw(Igray,graythresh(Igray)); Iedge=edge(uint8(Ibw)); se=strel('square',3); Iedge2=imdilate(Iedge,se); Ifill=imfill(Iedge2,'holes'); [Ilabel num]=bwlabel(Ifill); Iprops=regionprops(Ilabel); Ibox=[Iprops.BoundingBox]; Ibox=reshape(Ibox,[4 50]); Ic=[Iprops.Centroid]; Ic=reshape(Ic,[2 50]); Ic=Ic'; Ic(:,3)=(mean(Ic.^2,2)).^(1/2); Ic(:,4)=1:50; Ic2=sortrows(Ic,2); for cnt=1:5 Ic2((cnt-1)*10+1:cnt*10,:)=sortrows(Ic2((cnt-1)*10+1:cnt*10,:),4); end Ic3=Ic2(:,1:2); ind=Ic2(:,4); for cnt=1:50 img{cnt}=imcrop(Ibw,Ibox(:,ind(cnt))); end 这是对图像进行灰度转换。二值化。腐蚀。和重采样等预处理的程序。 其中: Iprops=regionprops(Ilabel); Ibox=[Iprops.BoundingBox]; Ibox=reshape(Ibox,[4 50]); Ic=[Iprops.Centroid]; Ic=reshape(Ic,[2 50]); Ic=Ic'; Ic(:,3)=(mean(Ic.^2,2)).^(1/2); Ic(:,4)=1:50; Ic2=sortrows(Ic,2); for cnt=1:5 Ic2((cnt-1)*10+1:cnt*10,:)=sortrows(Ic2((cnt-1)*10+1:cnt*10,:),4); end Ic3=Ic2(:,1:2); ind=Ic2(:,4); for cnt=1:50 img{cnt}=imcrop(Ibw,Ibox(:,ind(cnt))); end 谁能告诉我一下是什么意思,谢谢了!!!紧急求助,小弟先谢谢大家了:ft: :ft: |
![]() |
![]() |
|
|
![]() |
||||
主题 | 主题作者 | 版面 | 回复 | 最后发表 |
[讨论]如何将多个文件合并? | afen | MATLAB论坛 | 11 | 2009-02-06 23:22 |
[求助]solve命令 | davidqu | MATLAB论坛 | 5 | 2008-03-17 18:15 |
Measuring Test Completeness Using the Code Coverage Tool | TechnicalArticles | MATLAB技术文章 | 0 | 2008-01-06 16:32 |
【求助】关于SIMULINK模块里面的输入问题: | keview | MATLAB论坛 | 1 | 2007-08-16 15:13 |
【求助】求一个二阶四元微分方程龙格库塔法的MATLAB程序 | angela214 | MATLAB论坛 | 0 | 2007-07-08 10:30 |