Mask image in Matlab
조회 수: 5 (최근 30일)
이전 댓글 표시
I am using Matlab for image analysis. However, after I binarized the image, I conducted a complement of a binary image, resulting in inverted black and white. I am wondering how you could mask the internal pixels in black while the background still remains unchanged (for Fig 4b and Fig 4c).
I am looking forward to hearing from you soon.
댓글 수: 0
답변 (2개)
millercommamatt
2022년 10월 4일
I think imclose will do what you want.
https://www.mathworks.com/help/images/ref/imclose.html
댓글 수: 0
Image Analyst
2022년 10월 4일
You can call imfill on your binary image to fill your closed blobs. So an "O" will get filled, but a blob with a broken perimeter like a "C" will not get filled. You have to have your segmented things white first, not black;
mask = ~mask; % Turn black into white, and white into black.
mask = imfill(mask, 'holes');
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!