Clear Filters
Clear Filters

how to remove pixels =0 and apply it to segmentation

1 view (last 30 days)
Hi everyone,
I want to segment images into objects, then remove pixels with values of 0, making sure the pixels=0 is not involved in the segmentation. I tried to remove pixels=0 before the segmentation, but it turns out not working. Is there any way to remove pixels=0 after segmentation and not show them in objects? Thank you for your help.
  3 Comments
Image Analyst
Image Analyst on 25 Jan 2018
Attach your image and tell us what you want to find or measure in it. And explain better exactly what "remove" means, keeping in mind that images must remain rectangular. Explain exactly what segmentation algorithm you're using to segment the image. Is it just simple thresholding or something more complicated?
Tian Tian
Tian Tian on 27 Jan 2018
Edited: Walter Roberson on 28 Jan 2018
Thank you for reminding me. "remove" here means to make pixels with grayscale values 0 to NaN, to make sure they are not involved in the segmented objects.
The segmentation algorithm that I am using is marker-based watershed segmentation. What I am confused is the code is only applicable for 8-bit images, not 32-bit which has NaN values. Here is the code for first step segmentation, and the figure of imsubtract(imadd(Itop, afm), Ibot) somehow doesn't work.
se = strel('disk', 20);
Itop = imtophat(afm, se);
Ibot = imbothat(afm, se);
figure, imshow(Itop, []), title('top-hat image');
figure, imshow(Ibot, []), title('bottom-hat image');
Ienhance = imsubtract(imadd(Itop, afm), Ibot);
figure, imshow(Ienhance), title('original + top-hat - bottom-hat');
Highly appreciated for any helps.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!