Jump to content
  • Advertisement
Sign in to follow this  

Need help identifying/marking white areas in 2D image

This topic is 2150 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'd like to take a grayscale image that contains white blotchy areas and identify the center of these areas. For example, if there's an area that contains pixel values above 240, I want to be able to get the x,y position of the middle of that area. These images explain pretty much what I'm trying to accomplish:


Image containing white areas to be identified:



And what I'd like to be able to do:



As you can see, I'd like to figure out the center of these areas so I can mark them. Keep in mind that the areas may be irregularly shaped. Also, there would need to be some way of separating the white blobs so they can be considered separate objects. Maybe they are considered separate only if there's a certain amount of black pixels between them or something.

Share this post

Link to post
Share on other sites
A distance transform is noisy, it could give arbitrarily many local extrema depending on blob shape.

I'd use a Hough transform:

1) Apply some combination of median filtering, blurring, nonlinear mapping, thresholding to reduce noise, remove useless details, and obtain very white blobs on a very black background.

2) Apply morphological opening with a disk the size of the smallest blobs you want to detect, to make small white blobs disappear. You might want to use a smaller disk and allow some small blobs if blob shape changes too much.

3) After preprocessing, apply a Hough transform. Since you don't care about blob size and shape, you can collapse the 5 dimensions of ellipse detection to 2: bins can correspond to blob centers (one per pixel) and white pixels in the source image can be counted in all bins within a fixed distance (i.e. maximum expected blob radius).
If blobs are larger than expected, you might still get multiple "centers" for one blob.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!