How to calculate chain code and how to get the boundary as an np-by-2 array (it's required for the chain code)?

2 views (last 30 days)
I am trying to determine chain code for an image. I have tried Freeman chain code ( http://www.mathworks.com/matlabcentral/fileexchange/29518-freeman-chain-code) and also a code from Gonzalez book. I have two problems.
1. For the chain code, how do i get the boundary as np-by-2 array from my image?
2. In the code grom Gonzalez book, i see this error, "the input curve is broken... ... ..."
Any help would be appreciated. Thanx

Answers (1)

Image Analyst
Image Analyst on 3 Apr 2013
Why not use bwboundaries() to get an ordered list of the boundary coordinates. If you really need the chain code, you could get it from the list of x,y boundary coordinates.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!