how to extract binary images
Ältere Kommentare anzeigen
I want to extract a white image (circled in red) and display it alone.
please help.

Antworten (1)
Image Analyst
am 1 Okt. 2023
0 Stimmen
You can use drawfreehand to hand trace around all the blobs you want to retain. See attached freehand_masking_demo.m. I've attached other demos for other shapes and ways of drawing.

12 Kommentare
Rahmat Anbi Ancing
am 2 Okt. 2023
Image Analyst
am 2 Okt. 2023
Bearbeitet: Image Analyst
am 2 Okt. 2023
It depends on how precisely you can describe what you are trying to find. Can intensity or shape or something else describe it completely?
By the way, I know that's my demo but kmeans is not a reliable or robust way to find things like tumors. For example, even if that image had no tumors at all, kmeans would force it to find one because you must have k clusters. Thus it would give a false positive in the case of "no tumor", which would be very distressing for the patient.
For published papers on how to robustly find medical abnormalities, see VisionBib:
Rahmat Anbi Ancing
am 2 Okt. 2023
Bearbeitet: Rahmat Anbi Ancing
am 2 Okt. 2023
Image Analyst
am 2 Okt. 2023
Do you have a "perfect/no defect" image that can be aligned with the test image so that you can use imabsdiff to see how much it differs from a good image? If you have that then you can just call that and threshold it, then call bwareaopen to get rid of small noise pixels.
Rahmat Anbi Ancing
am 3 Okt. 2023
Image Analyst
am 3 Okt. 2023
Did you try what I suggested? imabsdiff, bwareaopen, and then thresholding? If not, why not? Did you even look them up in the documentation?
Rahmat Anbi Ancing
am 3 Okt. 2023
Image Analyst
am 3 Okt. 2023
Rahmat Anbi Ancing
am 7 Okt. 2023
Bearbeitet: Rahmat Anbi Ancing
am 7 Okt. 2023
Image Analyst
am 7 Okt. 2023
Since only SOME of the black holes are to be filled and it's not clear what the criteria are, I think you'll have to use drawfreehand to get the coordinates of the red line, then use poly2mask to make a binary image mask of where you drew, and then do
handDrawnMask = poly2mask(x, y, rows, columns);
mask(handDrawnMask) = true;
See attached demos.
Rahmat Anbi Ancing
am 8 Okt. 2023
Image Analyst
am 8 Okt. 2023
The rows and columns are the same as for your image.
The x and y are the borders of the blobs you want to fill. You can use bwboundaries, but first you have to identify which blobs are to be filled and which are not, and like I said, I don't know how you're deciding that. If you can spell out some criteria, then it might be possible to do it automatically, but if you can't, then you'll have to do it manually. Since I mentioned earlier that I was not sure what the criteria for filling and not filling were, and you didn't answer that, I'm assuming that there is no repeatable definition, so in that case you have to do it manually.
Kategorien
Mehr zu Image Arithmetic finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


