drawing bounding box from corne rpoints

조회 수: 10 (최근 30일)
kash
kash 2012년 2월 23일
댓글: Aasim Khurshid 2021년 3월 1일
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

답변 (1개)

Alex Taylor
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
kash
kash 2012년 2월 24일
Alex as per ur code,plz look at the link,am not getting exact result
http://imgur.com/TH5V4
Aasim Khurshid
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!

Translated by