how i can put a rectangular around forground ?

in regionprob, bounding box put a rectangular a round each object but i need just one rectangular around my forground which is in the center of my image .i mean i need a perim around my object that have rectangular form.

2 件のコメント

Walter Roberson
Walter Roberson 2015 年 12 月 24 日
How can you determine which is foreground and which is background?
mari ahmad
mari ahmad 2015 年 12 月 25 日
編集済み: Image Analyst 2015 年 12 月 26 日
It's clear. I have an image that consists of 2 objects. If I use regionnprops boundingbox the result is a lot of rectangles around each of the two objects. In fact i need to extract the area of jut 2 object and put a rectangle around it.

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

 採用された回答

Image Analyst
Image Analyst 2015 年 12 月 26 日

0 投票

Call bwconvhull() before you call bwlabel() or bwconncomp(). That will join the two blobs and create just one giant blob, which, of course, will have just one bounding box.
binaryImage = bwconvhull(binaryImage);
labeledImage = bwlabel(binaryImage);
measurements = regionprops(labeledImage, 'BoundingBox');
boundingBox = measurements.BoundingBox;

1 件のコメント

mari ahmad
mari ahmad 2015 年 12 月 30 日
Dear Image Analyst thank you very very much. it work very well

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeImages についてさらに検索

質問済み:

2015 年 12 月 24 日

コメント済み:

2015 年 12 月 30 日

Community Treasure Hunt

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

Start Hunting!

Translated by