Search code examples
algorithmimage-processingcomputer-visionrobotics

How do I efficiently segment 2D images into regions/blobs of similar values?


How do I segment a 2D image into blobs of similar values efficiently? The given input is a n array of integer, which includes hue for non-gray pixels and brightness of gray pixels.

I am writing a virtual mobile robot using Java, and I am using segmentation to analyze the map and also the image from the camera. This is a well-known problem in Computer Vision, but when it's on a robot performance does matter so I wanted some inputs. Algorithm is what matters, so you can post code in any language.


Solution

  • I would downsample,in colourspace and in number of pixels, use a vision method(probably meanshift) and upscale the result.

    This is good because downsampling also increases the robustness to noise, and makes it more likely that you get meaningful segments.

    You could use floodfill to smooth edges afterwards if you need smoothness.

    Some more thoughts (in response to your comment).

    1) Did you blend as you downsampled? y[i]=(x[2i]+x[2i+1])/2 This should eliminate noise.

    2)How fast do you want it to be?

    3)Have you tried dynamic meanshift?(also google for dynamic x for all algorithms x)