Ask Your Question

Alan Kazbekov's profile - activity

2018-11-30 20:27:08 -0600 received badge  Popular Question (source)
2016-04-19 20:27:47 -0600 received badge  Good Question (source)
2015-11-16 11:39:09 -0600 received badge  Nice Question (source)
2014-08-12 04:05:34 -0600 received badge  Student (source)
2014-08-11 08:45:49 -0600 received badge  Editor (source)
2014-08-11 08:43:51 -0600 asked a question fitEllipse - angle of resulting rotated rect

It seems that fitEllipse realization miss the result RotatedRect angle computing in some cases.

...
box.center.x = (float)rp[0] + c.x;
box.center.y = (float)rp[1] + c.y;
box.size.width = (float)(rp[2]*2);
box.size.height = (float)(rp[3]*2);
if( box.size.width > box.size.height )
{
    float tmp;
    CV_SWAP( box.size.width, box.size.height, tmp );
    box.angle = (float)(90 + rp[4]*180/CV_PI);
}
if( box.angle < -180 )
    box.angle += 360;
if( box.angle > 360 )
    box.angle -= 360;

return box;

If box.size.width <= box.size.height the angle of rotated rect would be indefinite. Please correct me, if I am wrong.