How can I accurately segment an image based on pixel intensity and density ?

1 次查看(过去 30 天)
The image attached is what im working on. I need to turn this image into a binary one, to highlight the central dark region( batman logo shaped kind of). Im not getting how to segment this .

回答(1 个)

Image Analyst
Image Analyst 2017-6-30
Get two masks and AND them. One from thresholding and one from a texture filter. Basically try starting with something like this:
mask1 = stdfilt(grayImage, 9) > threshold1;
mask2 = grayImage < threshold2;
% Then you'll undoubtedly have to do some clean up, like with bwareafilt() or imclose().
% Now create final mask.
mask = mask1 & mask2;
  2 个评论
igishaan
igishaan 2017-6-30
编辑:Image Analyst 2017-6-30
stdfilt needs the second argument to be a neighbourhood of 0s and 1s right ? so what does the 9 mean ?.
Also I think I know what you are getting at , so i tried thresholding the image to make it binary. Then I used imfill to fill the holes and got the image attached. Kind of resembles what I need , but how do I clean up the background now ? segmentation ? Sorry for adding more questions :P.
Image Analyst
Image Analyst 2017-6-30
Yes, use ones(9) or some other number instead of 9.
Like I said, try imclose() to join small nearby particles that you think should be part of the same blob, and use bwareafilt() to extract out blobs only within a certain size range.

请先登录,再进行评论。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by