Hi Ann, look to my previous comments (ex. 19/3/2011) the b parameter is an array containing coords of boundary points that should be 8-connected. 8-connected means that if Bn is the n-th element of b and Bn+1 the next their x y coords should satisfy this relations: | Xn - Xn+1 |<=1 AND | Yn - Yn+1 |<=1. Start checking that with a simple example. Regards Alessandro
Hi Frb, please note than b contains coords of boundary points order so that they are 8-connected. The find function you use return coords of boundary points but in a different order. From Matlab Help seems it scans matrix column by column. Best regards Alessandro
Since a few people have asked how to get a chain code from an image I have written a simple script to do this.
You can download the script here: https://raw2.github.com/maximilianallan/mk_chain/master/mk_chain.m
The script is really simple and makes some assumptions about a single contour in the image but should be easy to modify if needed.
>> chain = mk_chain('path/to/image.png');
>> [cc] = chaincode(chain);