フィルターのクリア

How to detect and fill a special region?

3 ビュー (過去 30 日間)
Steven
Steven 2013 年 12 月 14 日
編集済み: Steven 2013 年 12 月 16 日
Hi.
Regarding the following image:
what I want is detecting and then removing (I mean making them black as elsewhere) the white regions. Please note that the image is binary one and it is only a part of an image. The whole image contains other white and black regions (so it might not be easy to use imfill).
what can I do?
1. Is there any function in MATLAB that can automatically detect them and make them black?
2. If not, the user shall select them from screen, right? if yes, how to make the inside black? (I know I can select them by roipoly or similar functions, but I do not know how to make inside the regions black while keeping outside the same)?
By the way! If needed, I can also work on grayscale image instead of binary, whichever is easier or more efficient.
I hope I described my problem clearly.
Thanks so much for your time.
Steven

採用された回答

Image Analyst
Image Analyst 2013 年 12 月 14 日
Two ways, you can either have the user lassoo the object and erase inside of where they drew, as shown in my demos attached below. Or, you can call ginput and have the user click on a blob and then, after you've called regionprops, figure out which blob they clicked on by looking at PixelIdxList and then using ismember() to erase the containing, or closest, blob.
  10 件のコメント
Image Analyst
Image Analyst 2013 年 12 月 16 日
Put it in a while loop. At the bottom of the loop, before the end statement, have this:
message = sprintf('Do you want to continue');
button = questdlg(message, 'Continue?', 'Yes', 'No', 'Yes');
drawnow; % Refresh screen to get rid of dialog box remnants.
if strcmpi(button, 'No')
break;
end
Steven
Steven 2013 年 12 月 16 日
編集済み: Steven 2013 年 12 月 16 日
Thanks!
But it still shows the original image for choosing the new regions.
I mean I want every time, the image that has already been edited be shown to the user for selection, so that he know what regions are left for choosing.
Thanks.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImages についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by