Ask Your Question

Tricky image segmentation in Python

asked 2012-07-18 12:34:34 -0500

drichman gravatar image

updated 2012-07-18 15:32:13 -0500

I'm trying to segment a live video feed in real time. The frames look much like this: In particular, I need to extract pieces like the smaller box in the center-right of the frame.

The problem is that the background isn't completely black. I've been trying to use FindContours, but it has a hard time because it treats the image as binary. Is there some sort of blob detection that handles multiple layers?

edit retag flag offensive close merge delete


Try applying adaptiveThreshold to binarize the image before passing to FindCountours.

blue gravatar imageblue ( 2012-07-18 16:06:46 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2012-09-26 03:21:33 -0500

elmiguelao gravatar image

If you know the amount of segments to extract, mean-shift segmentation via openCV k-means can do the trick, although the inclusion might be a problem to be dealt with separately. I made a post on k-means here

More info can be found in this slides: (slide 41 onwards).

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2012-07-18 12:34:34 -0500

Seen: 1,806 times

Last updated: Sep 26 '12