how to extract binary images

I want to extract a white image (circled in red) and display it alone.
please help.

回答 (1 件)

Image Analyst
Image Analyst 2023 年 10 月 1 日

0 投票

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 件のコメント

Rahmat Anbi Ancing
Rahmat Anbi Ancing 2023 年 10 月 2 日
Thanks for the help. it's very helpful!!
Do you have any other examples for automatic capture?
Like this example below.
Thanks
Image Analyst
Image Analyst 2023 年 10 月 2 日
編集済み: Image Analyst 2023 年 10 月 2 日
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
Rahmat Anbi Ancing 2023 年 10 月 2 日
編集済み: Rahmat Anbi Ancing 2023 年 10 月 2 日
Thank you for your support,
Actually, I want to separate the black mark in the middle of the center (red circle) and separate it like the tumor example above, so as to know the part that is affected by the defect (black mark).
I attach the original image as well
Thank you
Image Analyst
Image Analyst 2023 年 10 月 2 日
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
Rahmat Anbi Ancing 2023 年 10 月 3 日
Thanks for the method input.
I have a perfect image, here I attach it
Do you have an example for the application of the method?
Thanks
Image Analyst
Image Analyst 2023 年 10 月 3 日
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
Rahmat Anbi Ancing 2023 年 10 月 3 日
I've tried it, I'm currently adjusting to the program I made before.
I'll ask again when I'm stuck
Thank you
Image Analyst
Image Analyst 2023 年 10 月 3 日
OK. If they're not perfectly aligned, you might want align them with imregister.
Rahmat Anbi Ancing
Rahmat Anbi Ancing 2023 年 10 月 7 日
編集済み: Rahmat Anbi Ancing 2023 年 10 月 7 日
Thanks for your input, How do I get remove of the black color inside the red circle?
Thank you.
Image Analyst
Image Analyst 2023 年 10 月 7 日
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
Rahmat Anbi Ancing 2023 年 10 月 8 日
I have tried, and it is correct to remove (the one inside the red line) manually, but how to remove it automatically? Should I define the x, y, width, and height values that I want to remove?
Image Analyst
Image Analyst 2023 年 10 月 8 日
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.

サインインしてコメントする。

製品

リリース

R2022a

質問済み:

2023 年 10 月 1 日

コメント済み:

2023 年 10 月 8 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by