資源簡介
zhang-suen的快速并行算法,程序的輸入必須是2值矩陣(0為背景點,1為前景點)
代碼片段和文件信息
%?1.?IMin?:?a?binary?image?(you?need?to?input?a?binary?image)
%?????????Firstyou?can?use??matlab?function?:?rgb2gray()to?convert?a?rbg?image
%?????????to?gray?image.?And?then?use?another?matlab?function:?imbinarize()?
%?????????to?convert?a?gray?image?to?binary?image.
%?????????(Please?ensure?that?the?input?of?this?programme?is?a?Binary
%??????????Image!!!)
%?2.?IMout?:?the?result?of?the?thinning?algorithm
%?3.?count?:?numbers?of?iteration
function?[IMoutcount]=Thinning(IMin)
[ab]?=?size(IMin);
count?=?0;
array?=?[00;-10;-11;01;11;10;1-1;0-1;-1-1];?
column?=?zeros(1b);
row?=?zeros(a+21);
IT?=?[row[column;IMin;column]row];%original?matrix
M?=?zeros(a+2b+2);?%?mid?matrix?
M2?=?zeros(a+2b+2);
C?=?1;?%??control?point
BP1?=?0;%?condition?1:2<=BP1<=6?BP1?=?P2
評論
共有 條評論