This example illustrates a simple way of converting the boundary of binary object into a 1-dimentional representation, or signature. One of the purpose of this conversion is to reduce the complexity of the representation for classification purpose. Let's have a look on how to convert the object to signature and compare the signature for different object shapes.**1. Original image (value 0 represent background while 1 represents object).**

S = imread('pic19.jpg');

S = im2bw(S);

imshow(S);

**2. Get the boundary and plot them on top of the original image.**[B,L,N,A] = bwboundaries(S);

imshow(S);

for cnt = 1:N

hold on;

boundary = B{cnt};

plot(boundary(:,2), boundary(:,1),'r');

hold on;

text(mean(boundary(:,2)), mean(boundary(:,1)),num2str(cnt));

end

figure;

subplotrow = ceil(sqrt(N));

__3. Plot the signature of each object.__

for cnt = 1:N

boundary = B{cnt};

[th, r]=cart2pol(boundary(:,2)-mean(boundary(:,2)), ...

boundary(:,1)-mean(boundary(:,1)));

subplot(subplotrow,N/subplotrow,cnt);

plot(th,r,'.');

axis([-pi pi 0 50]);

xlabel('radian');ylabel('r');

title(['Object ', num2str(cnt)]);

end

More details explanation could be found from the

**which could be found at the site bar of this page**

*image processing reference book*