unified the coordinate interpretation in RotatedRect (ticket #425)

This commit is contained in:
Vadim Pisarevsky
2010-11-29 18:14:08 +00:00
parent 4a973d4633
commit a937d9d43c
8 changed files with 51 additions and 39 deletions

View File

@@ -71,12 +71,16 @@ void processImage(int h, void*)
Mat(contours[i]).convertTo(pointsf, CV_32F);
RotatedRect box = fitEllipse(pointsf);
box.angle = -box.angle;
if( MAX(box.size.width, box.size.height) > MIN(box.size.width, box.size.height)*30 )
continue;
drawContours(cimage, contours, (int)i, Scalar::all(255), 1, 8);
ellipse(cimage, box, Scalar(0,0,255), 1, CV_AA);
ellipse(cimage, box.center, box.size*0.5f, box.angle, 0, 360, Scalar(0,255,255), 1, CV_AA);
Point2f vtx[4];
box.points(vtx);
for( int j = 0; j < 4; j++ )
line(cimage, vtx[j], vtx[(j+1)%4], Scalar(0,255,0), 1, CV_AA);
}
imshow("result", cimage);