Clearing border components from an imfreehand ROI
Mostra commenti meno recenti
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.

Risposta accettata
Più risposte (1)
Image Analyst
il 30 Set 2015
Modificato: Image Analyst
il 30 Set 2015
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 Commenti
Ramin Dastanpour
il 30 Set 2015
Modificato: Ramin Dastanpour
il 30 Set 2015
Image Analyst
il 30 Set 2015
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
il 30 Set 2015
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
il 30 Set 2015
Modificato: Image Analyst
il 30 Set 2015
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.
Categorie
Scopri di più su Region and Image Properties in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
