how to remove pixels =0 and apply it to segmentation

1 次查看(过去 30 天)
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 个评论
Image Analyst
Image Analyst 2018-1-25
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 2018-1-27
编辑:Walter Roberson 2018-1-28
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.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Computer Vision with Simulink 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by