Ask Your Question

How do I detect the centerline of an object

asked 2014-04-17 09:16:12 -0500

Guyygarty gravatar image


I am writing a program for analyzing chromosome aberrations. I typically get chromosome images that look more or less like a bunch of scattered bananas:

chromosome image

I have figured out how to get the outline and the (rotated) bounding boxes. What I would really like is to be able to get the centerline. By centerline I mean a line going through the geometric center of the binarized object (as shown below), not necessarily through the brightest pixels, which may be on the sides rather than the center.

image description

Any tips on how to code this would be appreciated.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2014-04-17 11:38:50 -0500

Haris gravatar image

updated 2014-04-17 22:39:45 -0500

All you have to do is,

  1. Find contour.
  2. Draw each contour with thickness=CV_FILLED.

  3. Now for each contour apply thinning algorithm as explained here.

See the result I got for the above sample image.

image description

edit flag offensive delete link more


Thanks! I'll try that. guy

Guyygarty gravatar imageGuyygarty ( 2014-04-18 07:46:48 -0500 )edit

Question Tools


Asked: 2014-04-17 09:16:12 -0500

Seen: 5,224 times

Last updated: Apr 17 '14