RotatedRect::boundingRect() -- possibly a bug revision. (Feature #400)


Added by Pei JIA over 14 years ago. Updated over 14 years ago.


Status:Done Start date:
Priority:High Due date:
Assignee:Vadim Pisarevsky % Done:

0%

Category:core
Target version:-
Difficulty: Pull request:

Description

I only afforded the solution here, but it may require your confirmation.

opencv-svn-R3240/opencv/modules/core/include/opencv2/core
file operations.hpp around line 969.

inline void RotatedRect::points(Point2f pt[]) const {
double _angle = angle*CV_PI/180.;
float a = (float)cos(_angle)*0.5f;
float b = (float)sin(_angle)*0.5f;

//Revised by JIA Pei.
ptr0.x = center.x - a*size.width - b*size.height;
ptr0.y = center.y + b*size.width - a*size.height;
ptr1.x = center.x + a*size.width - b*size.height;
ptr1.y = center.y - b*size.width - a*size.height;

// ptr0.x = center.x - a*size.height - b*size.width;
// ptr0.y = center.y + b*size.height - a*size.width;
// ptr1.x = center.x + a*size.height - b*size.width;
// ptr1.y = center.y - b*size.height - a*size.width;
ptr2.x = 2*center.x - ptr0.x;
ptr2.y = 2*center.y - ptr0.y;
ptr3.x = 2*center.x - ptr1.x;
ptr3.y = 2*center.y - ptr1.y;
}


Associated revisions

Revision 992d47e9
Added by Andrey Kamaev about 12 years ago

Merge pull request #400 from ilysenkov:bugfix_2560

History

Updated by Vadim Pisarevsky over 14 years ago

thanks for the patch! RotatedRect::angle interpretation has been made consistent in SVN r4122.

  • Status changed from Open to Done
  • (deleted custom field) set to fixed

Also available in: Atom PDF