Clearing border components from an imfreehand ROI
이전 댓글 표시
I have a binary image with an ROI defined using imfreehand function; and I want to remove object touching the ROI border. imclearborder is a great function to remove border objects but it works for rectangular ROI. What is the less-costly method to do this? I tried using the freehand ROI border and "bwconncomp" function but it requires multiple loops which is costly for a big image.

채택된 답변
추가 답변 (1개)
Image Analyst
2015년 9월 30일
편집: Image Analyst
2015년 9월 30일
First of all imclearborder() works for any blobs of any shape, not just rectangular. Secondly, imclearborder removes blobs touching the border of the image, not blobs touching the border of some freehand curve you drew.
I'm not sure what you want to do. Do you want to remove any blobs that your freehand curve touches or passes through?
If you just want to blacken the freehand mask pixels from your other binary image of your blobs, then you can just set the binary image to false inside the mask
blobsBinaryImage(freehandMask) = false;
댓글 수: 4
Ramin Dastanpour
2015년 9월 30일
편집: Ramin Dastanpour
2015년 9월 30일
Image Analyst
2015년 9월 30일
What is that? If that your blob image masked by your freehand ROI that you created? Do you want your freehand curve to be closed, or just an open curve? If it's closed, do you want any blobs inside the closed curve to be deleted, or only those touching the curve itself?
Image Analyst
2015년 9월 30일
Ramin's "Answer" was really a comment so I moved it here:
Well, this is an image from graphite layers inside a carbon nanoparticle. The image is masked by freehand to separate ROI from the other parts of the image. The freehand is a closed curve and I want to remove all objects touching the interior of this curve. I have different images and for each image a different ROI should be used.
Image Analyst
2015년 9월 30일
편집: Image Analyst
2015년 9월 30일
Ramin: See my attached imfreehand masking demos and see if this is what you want. Again, "touching" the cirve itself, or the interior of it as you said (whatever that means) is different than removing all blobs inside the curve. It's like removing only the perimeter blobs versus ALL the blobs inside.
카테고리
도움말 센터 및 File Exchange에서 Region and Image Properties에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
