How can I separate two connected objects in a binary image using a free hand drawing tool?
9 ビュー (過去 30 日間)
古いコメントを表示
Hello. I did some watershedding segmentation for an image with several objects. I used regionprops to make a list of objects. that worked quite well, but there are some touching objects that got counted as a single object. I would like to separate them manually. Is there an easy way to draw on top of a binary image to separate the objects? Or I could use something where I can click to change the value of a pixel from 1 to 0.
I tried using imfreehand, but I don't want to segment each object individually
0 件のコメント
回答 (1 件)
Rahul
2024 年 11 月 25 日 5:34
In order to separate connected objects from a binary image using free hand tool, consider using 'impoly' or 'drawpolygon' or 'drawfreehand' functions which can be used to define the area of the image to segment by the user along 'wait' to register the region. 'createmask' function can be used to create a binary mask of the defined region. Please refer to the below example for the same:
% Assuming 'image' to be the variable containing the image after being read
h = impoly;
position = wait(h);
mask = createMask(h);
image(mask) = 0; % Can be adjusted according to requirement
The following MATLAB Answers also present approaches to segment and separate objects from images:
https://www.mathworks.com/matlabcentral/answers/861390-how-to-separate-objects-in-image-using-matlab
For more information, you can refer to the MathWorks documentation links below:
'drawpolygon': https://www.mathworks.com/help/images/ref/drawpolygon.html
'drawfreehand': https://www.mathworks.com/help/images/ref/drawfreehand.html
Thanks.
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!