資源簡(jiǎn)介
Matlab實(shí)現(xiàn)的孔洞填充算法,可實(shí)現(xiàn)類似Matlab imfill函數(shù)的功能,填充圖像小孔洞
代碼片段和文件信息
%?clc;
%?clear;
%?AC=[0?0?0?0?0?0?0
%?????0?0?1?1?0?0?0
%?????0?1?0?0?1?0?0
%?????0?1?0?0?1?0?0
%?????0?0?1?0?1?0?0
%?????0?0?1?0?1?0?0
%?????0?1?0?0?0?1?0
%?????0?1?0?0?0?1?0
%?????0?1?1?1?1?0?0
%?????0?0?0?0?0?0?0];
AC=[0?0?0?0?0?0?0?0
????0?0?0?1?0?1?0?0
????0?0?0?0?1?0?1?0
????0?0?0?0?1?1?1?0
????0?1?1?1?0?1?1?0
????0?1?0?0?1?1?0?0
????0?1?1?1?0?1?0?0
????0?0?0?0?0?0?0?0];
figuresubplot(441)imshow(AC)title(‘1‘);
[widthheight]=size(AC);
A=1-AC;
subplot(442)imshow(A)title(‘2‘);
B=[0?1?0;1?1?1;0?1?0];
sorigin=[2?2];
subplot(443)imshow(B)title(‘3‘);
resulttu=?zeros(widthheight);
resulttu(33)?=1;
subplot(444)imshow(resulttu)title(‘4‘);
imtemp=zeros(widthheight);
h=1;
k=2;
while?h
????[swsh]=size(B);
????if?isempty(find(B==1))
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件?????931254??2004-10-01?23:12??區(qū)域填充Matlab\Fill?holes001.bmp
?????文件???????2027??2016-01-21?16:34??區(qū)域填充Matlab\quyutianchong.m
?????目錄??????????0??2016-03-17?14:48??區(qū)域填充Matlab
-----------?---------??----------?-----??----
???????????????933281????????????????????3
評(píng)論
共有 條評(píng)論