Calculating length of objects in binary image - algorithm

Posted by Jacek on Stack Overflow See other posts from Stack Overflow or by Jacek
Published on 2010-06-07T16:53:11Z Indexed on 2010/06/07 17:22 UTC
Read the original article Hit count: 421

I need to calculate length of the object in a binary image (maximum distance between the pixels inside the object). As it is a binary image, so we might consider it a 2D array with values 0 (white) and 1 (black). The thing I need is a clever (and preferably simple) algorithm to perform this operation. Keep in mind there are many objects in the image.

The image to clarify:

alt text

Sample input image:

alt text

© Stack Overflow or respective owner

Related posts about algorithm

Related posts about arrays