Ask Your Question
0

Segmenting bulk of spherical objects

asked 2018-01-07 14:18:53 -0600

eudoxos gravatar image

I am trying to segment an image with spherical-shaped objects, something like this being the source:

image description

I tried several approaches:

  • blur, adaptive thresholding, skeletonization, then connected components analysis, but it is very sensitive to lighting conditions;
  • hough circles (with various pre-filters) which gives too much bogus results, reacts to single points and so on;
  • distance map (after adaptive threshold) and watershed, with which I did not get very far (perhaps lack of experience).

The adaptive thresholding gives visually nicely separated objects (below shown with superimposed distance map) but I am having hard time to see which way to proceed all way to segmentation.

image description

I am aware I am not using some features of the scene which are known are not exploited by the algorithm, such as

  1. all objects are plus minus circular (modulo occlusion);
  2. the objects cover the entire scene, i.e. they are packed quite tightly;
  3. size range is known (this is used after segmentation to prune the result only for what is meaningful, but this knowledge comes only after segmentation as clean-up, not as improvement of the segmentation itself)

I would be grateful for some ideas on how to move on.

edit retag flag offensive close merge delete

Comments

change a ruler (to a different color)

jsxyhelu gravatar imagejsxyhelu ( 2018-01-07 16:53:19 -0600 )edit

Your case (where the objects have all very similar colour) is an ideal case where you could use depth edges and get very good results. The paper discussing this can be found here.

StevenPuttemans gravatar imageStevenPuttemans ( 2018-01-08 03:34:40 -0600 )edit

I was thinking along depth edges already, using 3 flashes (RGB), but that is not possible at the moment. For the record, matlab code for the paper you reference is here: https://github.com/erilyth/Depth-base... .

eudoxos gravatar imageeudoxos ( 2018-01-08 05:04:11 -0600 )edit

I know, I tried translating it to OpenCV once, not completely ready but the proof of concept can be found here: https://gist.github.com/StevenPuttema...

StevenPuttemans gravatar imageStevenPuttemans ( 2018-01-09 03:13:20 -0600 )edit

1 answer

Sort by » oldest newest most voted
0

answered 2018-01-07 19:18:23 -0600

Tetragramm gravatar image

So, assuming some +/- is acceptable, you can do quite well with connectedComponentsWithStats. Given the thresholded image, it will find all areas that are touching, along with width/height, location, ect.

You can use your condition 1 to throw out the very small, noisy things, and keep the very large separate for additional processing.

For post-processing, I guess erode each individual shape until it separates into two appropriately sized shapes, or goes bad. For example, the ruler should probably be thrown out right from the start. After that it's a lot of judgement calls.

edit flag offensive delete link more

Comments

This is what I already did (connected components after skeletonization) and the result is sometimes good but mostly terrible, it depends on local (pixel-scale) features whether 2 objects get treated as one or not, thus robustness is very low.

eudoxos gravatar imageeudoxos ( 2018-01-08 04:59:24 -0600 )edit

You have bounds for the expected size though, right? Throw away objects that are too small, then you can simply keep the objects that are too large separate, and try differently sized morphology operations until it becomes one or more objects of the appropriate size.

Tetragramm gravatar imageTetragramm ( 2018-01-09 22:38:32 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2018-01-07 14:18:53 -0600

Seen: 268 times

Last updated: Jan 07 '18