How to guide bwconncomp to specific region of image?
Mostra commenti meno recenti
Hello,
I am new to image processing and have been trying to use bwconncomp() to identify components in images.
In my image there is a background which is set to zero or NaN. The area of interest is a circle where there are different values signifying specific regions of that circle that have more or less of some quantity. The image is similar to a topoplot https://www.google.com/search?client=firefox-b-d&q=topoplot
How can I guide bwconncomp() to only look for components inside the area of interest? My issue is that bwconncomp identifies more or less, the entire circle as one large component relative to the background.
1 Commento
Rik
il 18 Lug 2021
Have you tried setting all pixels outside of the circle (and the circle itself) to false?
Risposta accettata
Più risposte (3)
If you have a binary circleMask of the circular region, you can use bwlmaskpropfiltn (Download) to eliminate all objects in a label map L that arenot completely contained in the circle
Lmasked= bwlmaskpropfiltn(L,circleMask,'AreaRelSelf',[1,inf]) ;
Image Analyst
il 18 Lug 2021
Modificato: Image Analyst
il 18 Lug 2021
Make a mask of the circle and use it to erase everything outside of the circle, then call bwconncomp() To maks a circle mask, see the FAQ:
Or you can threshold your original image.
then use it to mask your binary image
binaryImage(~circleMask) = false; % Erase outside circle.
cc = bwconncomp(binaryImage);
Attach your image if you need more help.
See my image segmentation tutorial
2 Commenti
Knut Skaug
il 19 Lug 2021
Image Analyst
il 19 Lug 2021
Sure, I'll help if you let me. Attach your image if you need more help.
You can try a closing with imclose() to merge nearby blobs together into a single blob.
Knut Skaug
il 19 Lug 2021
0 voti
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!