Commit 103336c7 authored by Deanna Hood's avatar Deanna Hood

Fix Bug #3989: correctly identify ellipse with its axes parallel to x-y axes…

Fix Bug #3989: correctly identify ellipse with its axes parallel to x-y axes during semi-major axis calculation
parent 81c5d580
...@@ -447,9 +447,9 @@ cv::RotatedRect cv::fitEllipse( InputArray _points ) ...@@ -447,9 +447,9 @@ cv::RotatedRect cv::fitEllipse( InputArray _points )
// store angle and radii // store angle and radii
rp[4] = -0.5 * atan2(gfp[2], gfp[1] - gfp[0]); // convert from APP angle usage rp[4] = -0.5 * atan2(gfp[2], gfp[1] - gfp[0]); // convert from APP angle usage
t = sin(-2.0 * rp[4]); t = sin(-2.0 * rp[4]);
if( fabs(t) > fabs(gfp[2])*min_eps ) if( fabs(t) > min_eps )
t = gfp[2]/t; t = gfp[2]/t;
else else // ellipse is rotated by an integer multiple of pi/2
t = gfp[1] - gfp[0]; t = gfp[1] - gfp[0];
rp[2] = fabs(gfp[0] + gfp[1] - t); rp[2] = fabs(gfp[0] + gfp[1] - t);
if( rp[2] > min_eps ) if( rp[2] > min_eps )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment