drawing bounding box from corne rpoints
4 次查看(过去 30 天)
显示 更早的评论
I have found the corners of an image ,now i want to draw the bounding box around it,please help
corner points=
188 28
195 29
261 30
261 42
261 143
261 153
121 154
114 155
109 154
25 154
5 153
4 51
6 29
83 150
9 148
11 35
112 140
113 110
134 111
133 140
118 139
95 132
92 144
110 149
144 138
142 132
90 149
99 146
12 40
217 150
149 137
I have uploaded image after corner detection
0 个评论
回答(1 个)
Alex Taylor
2012-2-23
How about:
imshow('pout.tif');
points = 200*rand(50,2);
hold on
plot(points(:,1),points(:,2),'r*');
% Now use min/max to determine bounding rectangle
min_x = min(points(:,1));
max_x = max(points(:,1));
min_y = min(points(:,2));
max_y = max(points(:,2));
% Use rectangle to draw bounding rectangle
rectangle('Position',[min_x min_y (max_x-min_x) (max_y-min_y)]);
2 个评论
Aasim Khurshid
2021-3-1
In your image you should use [min_y, min_x, (max_y-min_y),(max_x-min_x)] to draw the rectangle.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!