フィルターのクリア

how can i delete special shape in image?

10 ビュー (過去 30 日間)
nadia
nadia 2016 年 10 月 18 日
コメント済み: nadia 2016 年 10 月 21 日
I have some mammography images and I want to delete rectangular shape in image, some of this images are attached here, can you help me or suggest any solution? thanks in advance.

採用された回答

Image Analyst
Image Analyst 2016 年 10 月 19 日
Nadia:, Try the attached demo.
  1 件のコメント
nadia
nadia 2016 年 10 月 21 日
Thank you very much. That's excellent.

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

その他の回答 (2 件)

Image Analyst
Image Analyst 2016 年 10 月 18 日
First threshold to find super white things. Then use bwareafilt() to extract things larger than a certain size that you know to be the minimum. Then use imfill() to fill the holes, Finally use the binary image to zero out those pixels. Something like
binaryImage = grayImage > 240;
binaryImage = bwareafilt(binaryImage, [10000, inf]);
binaryImage = imfill(binaryImage, 'holes');
newGrayImage = grayImage; % Initialize output image.
newGrayImage(binaryImage) = 0; % Zero out pixels
If you need to keep the big white triangle, then change inf to something smaller, or see if the blob touches the top and bottom border or something like that. If you end up with blobs inside the breast, then try changing the 240 threshold or the 10000 minimum size. If all that does not work, then you'll need to examine each blob for how many vertices it has, which could be tricky. I've attached a shape recognition demo for "perfect" shapes, but with noise and "real" shapes, it's not clear if a rectangular shape will really have 4 vertices, so you may have to do more sophisticated shape analysis, such as smoothing the shape outlines (demo attached) before examining for the number of vertices.
  4 件のコメント
nadia
nadia 2016 年 10 月 19 日
In some images this tag is near the breast and I can not crop it because I loss the breast region and this tag dose not have rectangular shape in all images so I'm confused and I do not know what to do.
Image Analyst
Image Analyst 2016 年 10 月 19 日
Then do what I said and simply erase it without erasing any of the breast or cropping it. Have you tried what I said yet??

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


Chaya N
Chaya N 2016 年 10 月 18 日
Before you write a (somewhat complicated) piece of code to remove these rectangular areas, the question I would ask is this: Do these areas appear in the same spot on all your images?
Radiological images are usually automatically numbered and generally they appear in the same location on most images (one of the corners). If so, the simplest way of removing them would be to look at the relevant pixels and simply change them to zeros by brute force. All this requires is a very small and very simple script! If not, the previous answer should help. Good luck!
  2 件のコメント
nadia
nadia 2016 年 10 月 18 日
in my database they are in different location, thanks for your explanation.
Chaya N
Chaya N 2016 年 10 月 18 日
If the tags/numbers are in the top right or top left corners, you could flip them so all the images either have tags in the top right or the top left corner. This also helps to have uniform images if you have to process them further later on.

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

カテゴリ

Help Center および File ExchangeImage Processing and Computer Vision についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by