draw oriented rectangle around a blob
이전 댓글 표시
function y=cadre(x)
info = regionprops(x,'Boundingbox') ;
imshow(x)
hold on
for k = 1 : length(info)
BB = info(k).BoundingBox;
rectangle('Position', [BB(1),BB(2),BB(3),BB(4)],'EdgeColor','g','LineWidth',1) ;
end
I am using this code with a segmented image in input, and I have this result :
input output 
I would like the rectangles to be the smallest and with the same orientation as the objects, to get the angles for exemple.
How can I modify my code ?
채택된 답변
추가 답변 (2개)
Image Analyst
2022년 3월 26일
1 개 추천
See John D'Errico's suite of bounding shapes:
Walter Roberson
2022년 3월 26일
편집: Walter Roberson
2022년 3월 26일
0 개 추천
Note that if you are looking for the angles then regionprops() 'Orientation' will give you the angle of the major axes.
카테고리
도움말 센터 및 File Exchange에서 Image Arithmetic에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
