資源簡介
自動種子區域生長代碼,用MATLAB運行,不必選擇種子點 可以自動選擇閾值 實現圖像分割!
代碼片段和文件信息
%parameters
reg_maxdist?=?64;?
num_neighbor?=?8;%8?or?4
I=imread(‘d.png‘);
[heiwidchcol]?=?size(I);?
if(chcol==3)??I=rgb2gray(I);?end
I?=?double(I);
figure?imshow(I[]);?
[xy]=ginput(1);
x=round(x(1));?
y=round(y(1));?
J?=?zeros(size(I));?%?Output?
J(yx)?=?1;
reg_sum?=?I(yx);?%?The?mean?of?the?segmented?region
reg_size?=?1;?%?Number?of?pixels?in?region
neg_list?=?[xy];?
%?Neighbor?locations?(footprint)
neigb=[-10;0-1;10;01;?-1-1;1-1;11;-11];
index=1;
%scan?queue?list
while(?index<=reg_size?)
????for?j=1:num_neighbor
????????%?Calculate?the?neighbour?coordinate
????????xn?=?x?+?neigb(j1);
????????yn?=?y?+?neigb(j2);
????????%?Check?if?neighbour?is?inside?the?image
????????if(?xn<1?|?yn<1?|?xn>wid??|?yn>?hei?)?continue;?end
????????if
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????1503??2011-12-30?14:51??regiongrowing2.m
?????文件??????53631??2008-03-06?15:18??medtest.png
-----------?---------??----------?-----??----
????????????????55134????????????????????2
- 上一篇:curvelet
- 下一篇:MatlabTest 交通視頻車輛檢測
評論
共有 條評論