필터 지우기
필터 지우기

Filling the region within objects with white

조회 수: 3 (최근 30일)
jeffin
jeffin 2017년 7월 7일
댓글: jeffin 2017년 7월 10일
I am trying to do background subtraction and the result of one image is displayed here. There are lot of unfilled region in the region of interest.I have used Imfill command in my code. Can someone suggest me how to fill the black region in the region of Interests.
Kindly suggest me some solutions. Thanks in advance.

채택된 답변

Image Analyst
Image Analyst 2017년 7월 8일
편집: Image Analyst 2017년 7월 8일
I don't know exactly what "fill the black region in the region of Interests" means. If you want to fill the black regions with black, thus making the white "islands" or "holes" black also (essentially making them disappear), then use bwareafilt() and specify the smallest white blob that you're willing to accept. For example, if you want to remove all blobs smaller than 1000 pixels, do this:
binaryImage = bwareafilt(binaryImage, [1000, inf]);
You could also use bwareaopen().
binaryImage = bwareaopen(binaryImage, 1000);
On the other hand, if you want to remove black holes in white regions, simply use imfill:
binaryImage = imfill(binaryImage, 'holes');
I also don't know what the "region of interest" is in that image. Can you indicate it, perhaps by outlining it in red? If the ROI is only part of the whole image, then you'll need to make a mask somehow, perhaps with poly2mask() or some other method depending on how ROI is defined, then use the mask to erase the non-ROI parts of the image.
binaryImage(~ROIMask) = false; % Erase outside of ROI region(s)
  댓글 수: 1
jeffin
jeffin 2017년 7월 10일
The Small white regions present at the top should be eliminated, while the large region present at the bottom should be filled.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Image 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