91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 3KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發布日期: 2021-05-29
  • 語言: Matlab
  • 標簽: MATLAB??

資源簡介

圖像分割時,經常需要實現對邊界的跟蹤,從而實現對區域的提取。邊界跟蹤算法輸入時一幅二值圖像(即邊界圖像),實現對邊界的定位,從而在得到邊界的基礎上提取相應區域。輸出是邊界坐標。

資源截圖

代碼片段和文件信息

function?C?=?contour_following(BW)
%?CONTOUR_FOLLOWING?takes?a?binary?array?and?returns?the?sorted?row?and
%?column?coordinates?of?contour?pixels.
%
%?C?=?CONTOUR_FOLLOWING(BW)?takes?BW?as?an?input.?BW?is?a?binary?array
%?containing?the?image?of?an?object?(‘1‘:?foreground?‘0‘:?background).?It
%?returns?a?circular?list?(N?x?2?C(1:)=C(end:))?of?the?
%?(rowcolumn)-coordinates?of?the?object‘s?contour?in?the?order?of?
%?appearence?(This?function?was?inspired?from?the?freeman?contour?coding?
%?algorithm).
%
%?Note:?
%?-?if?the?object?is?less?than?3?pixels?CONTOUR_FOLLOWING?sends?back?[0?0].
%?-?the?algorithm?is?quite?robust:?the?object?can?have?holes?and?can?also
%?be?only?one?pixel?thick?in?some?parts?(in?this?case?some?coordinates
%?pair?will?appear?two?times:?they?are?counted?“way?and?back“).


[mn]=size(BW);????????????????????????????????????????????????????????????%?getting?the?image?height?and?width

Itemp=zeros(m+2n+2);??????????????????????????????????????????????????????%?we?create?a?‘0‘?frame?around?the?image?to?avoid?border?problems
Itemp(2:(m+1)2:(n+1))=BW;
BW=Itemp;

BW?=?BW?-?imerode(BW[0?1?0?;?1?1?1?;?0?1?0]);?????????????????????????????%?gets?the?contour?by?substracting?the?erosion?to?the?image
BW?=?bwmorph(BW‘thin‘Inf);???????????????????????????????????????????????%?to?be?sure?to?have?strictly?8-connected?contour

if?(sum(sum(BW))<3)???????????????????????????????????????????????????????%?we?consider?that?less?than?3?pixels?cannot?make?a?contour
????C=[0?0];?
????return;?
end;

[rowcol]=find(BW1);??????????????????????????????????????????????????????%?takes?the?first?encountered?‘1‘?pixel?as?the?starting?point?of?the?contour

MAJ=[6?6?0?0?2?2?4?4];?????????????????????????????????????????????????????%?variable?initialization
C=[0?0?;?0?0];
k=0;
ended=0;
direction=4;

while(ended==0)
????k=k+1;
????found_next=0;??
????
????while(found_next==0)
????????switch?mod(direction8)
????????????case?0
????????????????if?(BW(row?col+1)==1)
????????????????????row=row;
????????????????????col=col+1;
????????????????????C(k:)=[row?col];
????????????????????found_next=1;
????????????????end;
????????????case?1;
????????????????if?(BW(row+1?col+1)==1)
????????????????????row=row+1;
????????????????????col=col+1;
????????????????????C(k:)=[row?col];
????????????????????found_next=1;
????????????????end;
????????????case?2;
????????????????if?(BW(row+1?col)==1)
????????????????????row=row+1;
????????????????????col=col;
????????????????????C(k:)=[row?col];
????????????????????found_next=1;
????????????????end;
????????????case?3;
????????????????if?(BW(row+1?col-1)==1)
????????????????????row=row+1;
????????????????????col=col-1;
????????????????????C(k:)=[row?col];
????????????????????found_next=1;
????????????????end;
????????????case?4;
????????????????if?(BW(row?col-1)==1)
????????????????????row=row;
????????????????????col=col-1;
????????????????????C(k:)=[row?col];
????????????????????found_next=1;
??????

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件???????4208??2010-05-27?19:16??55593365contour_following\contour_following.m

?????文件??????36054??2007-05-10?13:36??55593365contour_following\test1.bmp

?????文件??????36054??2007-05-10?13:37??55593365contour_following\test2.bmp

?????文件??????36054??2007-05-10?13:37??55593365contour_following\test3.bmp

?????文件??????36054??2007-05-10?13:37??55593365contour_following\test4.bmp

?????文件??????36054??2007-05-10?13:38??55593365contour_following\test5.bmp

?????文件???????1103??2007-05-10?13:39??55593365contour_following\Testscript.m

?????文件?????????61??2010-05-27?19:20??55593365contour_following\程序說明.txt

?????目錄??????????0??2010-05-27?18:50??55593365contour_following

-----------?---------??----------?-----??----

???????????????185642????????????????????9


評論

共有 條評論

相關資源