how to remove objects close to image border

8 ビュー (過去 30 日間)
Abdul Hamzah
Abdul Hamzah 2017 年 1 月 28 日
コメント済み: Image Analyst 2017 年 1 月 30 日
hello everyone, i have a problem related with image processing. btw, i have an image like this :
but i want to remove the object closest to the image border ( in this case, the closest one is on the right of the border)
do you know how to do that? thx before.

採用された回答

Image Analyst
Image Analyst 2017 年 1 月 28 日
Sorry - I was sleeping, hence the delay on my part.
Simply crop the image with imcrop(), then call imclearborder(), then pad with padarray():
margin = 50; % Whatever
croppedImage = imcrop(binaryImage, [margin, margin, columns - 2 * margin, rows - 2 * margin]);
binaryImage = imclearborder(croppedImage);
binaryImage = logical(padarray(binaryImage, margin));
  2 件のコメント
Abdul Hamzah
Abdul Hamzah 2017 年 1 月 30 日
thank you very much for your response..but with that method, would it work if the size of the object varies?? the picture i posted above was just an example of the pictures whose object near the border i want to remove...
Image Analyst
Image Analyst 2017 年 1 月 30 日
No. It will remove any object, no matter what size, if it enters the margin. If you want size based filtering, see bwareafilt() or bwareaopen().
And be sure to be aware of stereology

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

その他の回答 (1 件)

Abdul Hamzah
Abdul Hamzah 2017 年 1 月 28 日
hello, anyone?
  1 件のコメント
Jan
Jan 2017 年 1 月 30 日
Please do not bump a question after some hours.

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

カテゴリ

Help Center および File ExchangeImage Segmentation and Analysis についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by