里面有代码和数据集
I = imread('coins.png'); % 可将第3行中的不同文件带入,注意必须采用单引号
if size(I,3) > 1
I = rgb2gray(I);
end
I = imbinarize(I);
% Example I : how to execute Freeman_chain_code
[bound_img,X0,Code,bound_coord,invert_img] = Freeman_chain_code(I,true);
% Example II : how to rebuild the boundary image from the boundary coordinates vector
bound_img2 = zeros(size(I));
for k = 1:numel(bound_coord)