From 8af2d0acb40867b0010d281bcdaeec617608f117 Mon Sep 17 00:00:00 2001 From: Vadim Pisarevsky Date: Tue, 30 Nov 2010 00:17:43 +0000 Subject: [PATCH] fixed recent failures in shape-convhull & shape-minarearect --- modules/imgproc/src/contours.cpp | 2 +- modules/imgproc/src/geometry.cpp | 14 +------------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/modules/imgproc/src/contours.cpp b/modules/imgproc/src/contours.cpp index 0f02f55..3aa37ff 100644 --- a/modules/imgproc/src/contours.cpp +++ b/modules/imgproc/src/contours.cpp @@ -1728,7 +1728,7 @@ void cv::convexHull( const Mat& points, void cv::convexHull( const Mat& points, vector& 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); diff --git a/modules/imgproc/src/geometry.cpp b/modules/imgproc/src/geometry.cpp index b2678d3..b12d098 100644 --- a/modules/imgproc/src/geometry.cpp +++ b/modules/imgproc/src/geometry.cpp @@ -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); } -- 2.7.4