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

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 Exchange에서 Images에 대해 자세히 알아보기

질문:

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