How to remove non-connected objects?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Duncan
am 25 Jul. 2014
Beantwortet: Image Analyst
am 25 Jul. 2014
The brown pattern is my main object I am working with.
How should I remove the non-connected objects (i.e. black and cream colored objects)?
Thanks, Duncan
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 25 Jul. 2014
First you have to convert the color image into a binary image and do connected components labeling (like with bwlabel() or bwconncomp()), and identify the ID number of the one blob that you want to keep. Then use ismember() to extract the one object you want to keep into a new binary image. If you want to keep the largest one, there is a function I wrote that you can use (attached) that will take a binary image and keep the "N" largest or smallest blobs. If you want to make all areas that are not part of the desired blob to be blue, you need to extrac tthe RGB components and use the inverse of the desired mask to set the R, G, and B planes in the mask to be their respective color. Give it a shot first, and then post your code so I can fix it.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Convert Image Type finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!