To retrieve height and width of rectangle drawn

1 回表示 (過去 30 日間)
Karan Ratnaparkhi
Karan Ratnaparkhi 2011 年 4 月 2 日
Hi guys, I am drawing a rectangle around an object in image using following code
{figure, imshow(BW2);
CC = bwconncomp(BW2);
[L Ne]=bwlabel(BW2);
propied=regionprops(L,'BoundingBox');
hold on
for x=1:size(propied,1)
rectangle('Position',propied(x).BoundingBox,'EdgeColor','g','LineWidth',2)
end
hold off }
I want to know height width and strating point of the rectangle drawn. Please help me.

採用された回答

Walter Roberson
Walter Roberson 2011 年 4 月 2 日
The appropriate reference information is <http://www.mathworks.com/help/techdoc/ref/rectangle_props.html here>
rects = findobj(gca,'type','rectangle');
for K = 1:length(rects)
rpos = get(rects(K),'Position');
fprintf(1, 'Rectangle #%d: height %g, width %g at (%g,%g)\n', ...
rpos(3), rpos(4), rpos(1), rpos(2));
end

その他の回答 (0 件)

製品

Community Treasure Hunt

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

Start Hunting!

Translated by