资源简介
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
评论
共有 条评论