fixed recent failures in shape-convhull & shape-minarearect
authorVadim Pisarevsky <no@email>
Tue, 30 Nov 2010 00:17:43 +0000 (00:17 +0000)
committerVadim Pisarevsky <no@email>
Tue, 30 Nov 2010 00:17:43 +0000 (00:17 +0000)
modules/imgproc/src/contours.cpp
modules/imgproc/src/geometry.cpp

index 0f02f55..3aa37ff 100644 (file)
@@ -1728,7 +1728,7 @@ void cv::convexHull( const Mat& points,
 void cv::convexHull( const Mat& points,
                      vector<Point2f>& hull, bool clockwise )
 {
-    int nelems = points.checkVector(2, CV_32S);
+    int nelems = points.checkVector(2, CV_32F);
     CV_Assert(nelems >= 0);
     hull.resize(nelems);
     CvMat _points = Mat(points), _hull=Mat(hull);
index b2678d3..b12d098 100644 (file)
@@ -86,21 +86,9 @@ cvMaxRect( const CvRect* rect1, const CvRect* rect2 )
 CV_IMPL void
 cvBoxPoints( CvBox2D box, CvPoint2D32f pt[4] )
 {
-    double angle = box.angle*CV_PI/180.;
-    float a = (float)cos(angle)*0.5f;
-    float b = (float)sin(angle)*0.5f;
-
     if( !pt )
         CV_Error( CV_StsNullPtr, "NULL vertex array pointer" );
-
-    pt[0].x = box.center.x - a*box.size.height - b*box.size.width;
-    pt[0].y = box.center.y + b*box.size.height - a*box.size.width;
-    pt[1].x = box.center.x + a*box.size.height - b*box.size.width;
-    pt[1].y = box.center.y - b*box.size.height - a*box.size.width;
-    pt[2].x = 2*box.center.x - pt[0].x;
-    pt[2].y = 2*box.center.y - pt[0].y;
-    pt[3].x = 2*box.center.x - pt[1].x;
-    pt[3].y = 2*box.center.y - pt[1].y;
+    cv::RotatedRect(box).points((cv::Point2f*)pt);
 }