fixed recent failures in shape-convhull & shape-minarearect
This commit is contained in:
parent
b1722352b8
commit
8af2d0acb4
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user