connecting 2 object that separately but their location is close ?

8 ビュー (過去 30 日間)
Zaidan Adenin Said
Zaidan Adenin Said 2020 年 1 月 19 日
コメント済み: Zaidan Adenin Said 2020 年 1 月 25 日
##sorry if my english is bad
i have a binary image like this
and i want to connect the little object with the large object and fill the hole on the center of object like this :
what toolbox should i use and can you give me the example code for the problem like this ?

採用された回答

Image Analyst
Image Analyst 2020 年 1 月 19 日
To connect regions, you can use imclose()
mask = imclose(mask, true(9)); % Vary the 9 to connect more or less close regions.
To fill regions, you can use imfill():
mask = imfill(mask, 'holes');
To erase things touching the border, you can use imclearborder:
mask = imclearborder(mask);
To extract a specified number of largest blobs, you can use bwareafilt():
mask = bwareafilt(mask, 3); % Extract 3 largest blobs.
To extract blobs of a specified size or larger you can use either bwareafilt(mask, [smallArea, largeArea]) or bwareaopen():
mask = bwareafilt(mask, [2000, 5000]); % Extract blobs between 2000 and 5000 in pixel area.
mask = bwareaopen(mask, 4000); % Extract blobs only 4000 pixels or larger.
  1 件のコメント
Zaidan Adenin Said
Zaidan Adenin Said 2020 年 1 月 25 日
thank you so much for your answer and sorry for late respond, i will try to use it

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

その他の回答 (1 件)

Thiago Henrique Gomes Lobato
Thiago Henrique Gomes Lobato 2020 年 1 月 19 日
You can use the imfill function from the image processing toolbox for such type of problems.

Community Treasure Hunt

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

Start Hunting!

Translated by