Skip to content

Fix and add tests for ellipse fitting#26694

Open
MaximSmolskiy wants to merge 10 commits intoopencv:4.xfrom
MaximSmolskiy:fix-and-add-tests-for-ellipse-fitting
Open

Fix and add tests for ellipse fitting#26694
MaximSmolskiy wants to merge 10 commits intoopencv:4.xfrom
MaximSmolskiy:fix-and-add-tests-for-ellipse-fitting

Conversation

@MaximSmolskiy
Copy link
Copy Markdown
Contributor

Pull Request Readiness Checklist

The main problem is that fitEllipseNoDirect function on first step finds optimal solution from space of all conic curves (besides ellipse there are at least hyperbola and parabola). It does not impose any special restrictions on solution, so that it must be only ellipse. So, found curve may easily be not ellipse. But all the following steps consider this to be ellipse, which is why we get very strange and incorrect results.

As a solution, we can add fallback to fitEllipseDirect function as soon as we realized that we got not ellipse - as has already been done in fitEllipseAMS function

// Check that an elliptical solution has been found. AMS sometimes produces Parabolic solutions.
bool is_ellipse = (coeffs(0) < 0 && \
coeffs(2) < (coeffs(1) *coeffs(1) )/(4.*coeffs(0) ) && \
coeffs(5) > (-(coeffs(2) *(coeffs(3) *coeffs(3) )) + coeffs(1) *coeffs(3) *coeffs(4) - coeffs(0) *(coeffs(4) *coeffs(4) )) / \
((coeffs(1) *coeffs(1) ) - 4*coeffs(0) *coeffs(2) )) || \
(coeffs(0) > 0 && \
coeffs(2) > (coeffs(1) *coeffs(1) )/(4.*coeffs(0) ) && \
coeffs(5) < (-(coeffs(2) *(coeffs(3) *coeffs(3) )) + coeffs(1) *coeffs(3) *coeffs(4) - coeffs(0) *(coeffs(4) *coeffs(4) )) / \
( (coeffs(1) *coeffs(1) ) - 4*coeffs(0) *coeffs(2) ));
if (is_ellipse) {
double u1 = pVec(2) *pVec(3) *pVec(3) - pVec(1) *pVec(3) *pVec(4) + pVec(0) *pVec(4) *pVec(4) + pVec(1) *pVec(1) *coeffs(5) ;
double u2 = pVec(0) *pVec(2) *coeffs(5) ;
double l1 = sqrt(pVec(1) *pVec(1) + (pVec(0) - pVec(2) )*(pVec(0) - pVec(2) ));
double l2 = pVec(0) + pVec(2) ;
double l3 = pVec(1) *pVec(1) - 4.0*pVec(0) *pVec(2) ;
double p1 = 2.0*pVec(2) *pVec(3) - pVec(1) *pVec(4) ;
double p2 = 2.0*pVec(0) *pVec(4) -(pVec(1) *pVec(3) );
x0 = p1/l3/scale + c.x;
y0 = p2/l3/scale + c.y;
a = std::sqrt(2.)*sqrt((u1 - 4.0*u2)/((l1 - l2)*l3))/scale;
b = std::sqrt(2.)*sqrt(-1.0*((u1 - 4.0*u2)/((l1 + l2)*l3)))/scale;
if (pVec(1) == 0) {
if (pVec(0) < pVec(2) ) {
theta = 0;
} else {
theta = CV_PI/2.;
}
} else {
theta = CV_PI/2. + 0.5*std::atan2(pVec(1) , (pVec(0) - pVec(2) ));
}
box.center.x = (float)x0;
box.center.y = (float)y0;
box.size.width = (float)(2.0*a);
box.size.height = (float)(2.0*b);
if( box.size.width > box.size.height )
{
float tmp;
CV_SWAP( box.size.width, box.size.height, tmp );
box.angle = (float)(90 + theta*180/CV_PI);
} else {
box.angle = (float)(fmod(theta*180/CV_PI,180.0));
};
} else {
box = cv::fitEllipseDirect( points );
}

Fix #26078

26078

Fix #26360

26360_1

26360_2

26360_3

26360_4

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
  • The PR is proposed to the proper branch
  • There is a reference to the original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake

@MaximSmolskiy MaximSmolskiy force-pushed the fix-and-add-tests-for-ellipse-fitting branch from e3c66ca to d3092de Compare January 2, 2025 19:30
@s-trinh
Copy link
Copy Markdown
Contributor

s-trinh commented Jan 3, 2025

👍 great if it can solves all these issues


I have proposed this pull request: Add getClosestEllipsePoints() function to get the closest point on an ellipse

Feel free to comment if there is something missing or if you think this function is useless, etc.

@asmorkalov
Copy link
Copy Markdown
Contributor

Thanks a lot for the contribution!
fitEllipseNoDirect is called from fitEllipseDirect. Inifinite recursion is possible. Also direct and noDirect functions are called in different branches here and there depending on input. M.b. we need to define "invalid" elipse output, e.g. RotatedRect(0,0,0,0,0) and handle the case on caller side. I'll analyze all cases and return back soon.

@MaximSmolskiy
Copy link
Copy Markdown
Contributor Author

Yes, test Features2d_Detector_Keypoints_MSER.validation catch infinite recursion - there are all points lie on same line

[237, 47;
 238, 47;
 236, 47;
 240, 47;
 241, 47;
 239, 47;
 234, 47;
 235, 47;
 233, 47;
 222, 47;
 223, 47;
 221, 47;
 224, 47;
 220, 47;
 228, 47;
 229, 47;
 230, 47;
 227, 47;
 226, 47;
 231, 47;
 225, 47;
 219, 47;
 232, 47;
 218, 47;
 213, 47;
 214, 47;
 215, 47;
 212, 47;
 216, 47;
 211, 47;
 217, 47;
 210, 47;
 207, 47;
 208, 47;
 209, 47;
 242, 47;
 206, 47;
 244, 47;
 245, 47;
 243, 47;
 246, 47;
 197, 47;
 198, 47;
 199, 47;
 200, 47;
 201, 47;
 196, 47;
 202, 47;
 203, 47;
 195, 47;
 204, 47;
 205, 47;
 191, 47;
 192, 47;
 193, 47;
 190, 47;
 194, 47;
 189, 47;
 247, 47;
 251, 47;
 252, 47;
 253, 47;
 254, 47;
 250, 47;
 255, 47;
 249, 47;
 256, 47;
 257, 47;
 258, 47;
 248, 47;
 261, 47;
 262, 47;
 260, 47;
 263, 47;
 269, 47;
 270, 47;
 268, 47;
 271, 47;
 267, 47;
 272, 47;
 266, 47;
 265, 47;
 264, 47;
 273, 47;
 259, 47;
 277, 47;
 278, 47;
 276, 47;
 275, 47;
 279, 47;
 274, 47;
 280, 47;
 281, 47;
 188, 47;
 288, 47;
 289, 47;
 290, 47;
 285, 47;
 286, 47;
 284, 47;
 287, 47;
 291, 47;
 292, 47;
 283, 47;
 293, 47;
 294, 47;
 282, 47;
 295, 47]

@MaximSmolskiy MaximSmolskiy mentioned this pull request Jan 5, 2025
6 tasks
@asmorkalov asmorkalov added this to the 4.12.0 milestone Jan 8, 2025
asmorkalov pushed a commit that referenced this pull request Jan 20, 2025
…llipse-fitting

Improve robustness for ellipse fitting #26773

### Pull Request Readiness Checklist

Related to #26694 

Current noise addition is not very good because for example it turns degenerate case of one horizontal line into degenerate case of two parallel horizontal lines

Improving noise addition leads to improved robustness of algorithms

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
@asmorkalov
Copy link
Copy Markdown
Contributor

@MaximSmolskiy May I close this pr?

vrabaud pushed a commit to vrabaud/opencv that referenced this pull request Jan 21, 2025
…-for-ellipse-fitting

Improve robustness for ellipse fitting opencv#26773

### Pull Request Readiness Checklist

Related to opencv#26694 

Current noise addition is not very good because for example it turns degenerate case of one horizontal line into degenerate case of two parallel horizontal lines

Improving noise addition leads to improved robustness of algorithms

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
asmorkalov pushed a commit that referenced this pull request Jan 22, 2025
…itEllipseAMS

Improve robustness for fitEllipseAMS #26810

### Pull Request Readiness Checklist

Related to #26694 

Added functionality to add noise to points in degenerate cases and try again for `fitEllipseAMS`. `fitEllipseNoDirect` and `fitEllipseDirect` already have this

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
@asmorkalov
Copy link
Copy Markdown
Contributor

@MaximSmolskiy ?

@MaximSmolskiy
Copy link
Copy Markdown
Contributor Author

MaximSmolskiy commented Jan 23, 2025

@MaximSmolskiy May I close this pr?

@asmorkalov I think no, because issues are still not fixed

It's pretty obvious to me what the matter is.
There are two main problems:

  1. fitEllipseNoDirect fundamentally does not guarantee a valid ellipse at the output even in non-degenerate cases. Because it finds optimal conic curve from all possible conic curves (at least there are ellipses, parabollas and hyperbolas). So, even in non-degenerate cases we can pass points for which optimal conic curve will be hyperbola or parabola, but then algorithm thinks that it is always ellipse and by formulas valid only for ellipse gets very bad ellipse.
  2. fitEllipse almost always сalls this unreliable fitEllipseNoDirect instead of more reliable fitEllipseDirect where algorithm finds optimal ellipse from only all possible ellipses (and only degenerate cases can cause problems)

So, to avoid problems with infinite recursion in this patch, I can offer to call fitEllipseDirect from fitEllipse - not fitEllipseNoDirect. If this offer suits you, I will prepare corresponding patch in this PR and retest that it fixes issues

@asmorkalov
Copy link
Copy Markdown
Contributor

So, to avoid problems with infinite recursion in this patch, I can offer to call fitEllipseDirect from fitEllipse - not fitEllipseNoDirect. If this offer suits you, I will prepare corresponding patch in this PR and retest that it fixes issues

Please go ahead!

@MaximSmolskiy
Copy link
Copy Markdown
Contributor Author

So, to avoid problems with infinite recursion in this patch, I can offer to call fitEllipseDirect from fitEllipse - not fitEllipseNoDirect. If this offer suits you, I will prepare corresponding patch in this PR and retest that it fixes issues

Please go ahead!

@asmorkalov Locally ellipse fitting tests are passed and images for issues from description haven't changed

@MaximSmolskiy
Copy link
Copy Markdown
Contributor Author

Some tests failed - I'll deal with them

NanQin555 pushed a commit to NanQin555/opencv that referenced this pull request Feb 24, 2025
…-for-ellipse-fitting

Improve robustness for ellipse fitting opencv#26773

### Pull Request Readiness Checklist

Related to opencv#26694 

Current noise addition is not very good because for example it turns degenerate case of one horizontal line into degenerate case of two parallel horizontal lines

Improving noise addition leads to improved robustness of algorithms

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
NanQin555 pushed a commit to NanQin555/opencv that referenced this pull request Feb 24, 2025
…-for-fitEllipseAMS

Improve robustness for fitEllipseAMS opencv#26810

### Pull Request Readiness Checklist

Related to opencv#26694 

Added functionality to add noise to points in degenerate cases and try again for `fitEllipseAMS`. `fitEllipseNoDirect` and `fitEllipseDirect` already have this

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
@asmorkalov asmorkalov requested a review from vpisarev May 12, 2025 13:53
@asmorkalov
Copy link
Copy Markdown
Contributor

I merged 4.x branch, but there is still test failure on mac M1:

[ RUN      ] Imgproc_FitEllipse_JavaCase.accuracy
/Users/opencv-cn/GHA-OCV-2/_work/opencv/opencv/opencv/modules/imgproc/test/test_fitellipse.cpp:105: Failure
The difference between e.size.width and sqrt(2.)*2 is 2.8278916729973163, which exceeds 0.4, where
e.size.width evaluates to 0.00053545174887403846,
sqrt(2.)*2 evaluates to 2.8284271247461903, and
0.4 evaluates to 0.40000000000000002.
/Users/opencv-cn/GHA-OCV-2/_work/opencv/opencv/opencv/modules/imgproc/test/test_fitellipse.cpp:106: Failure
The difference between e.size.height and sqrt(2.)*2 is 2.8278915229961741, which exceeds 0.4, where
e.size.height evaluates to 0.00053560175001621246,
sqrt(2.)*2 evaluates to 2.8284271247461903, and
0.4 evaluates to 0.40000000000000002.
[  FAILED  ] Imgproc_FitEllipse_JavaCase.accuracy (0 ms)

@asmorkalov
Copy link
Copy Markdown
Contributor

Reproduced the issue locally with debug build on nvidia jetson. Will try to debug it.

@asmorkalov asmorkalov modified the milestones: 4.12.0, 4.13.0 Jun 27, 2025
@asmorkalov
Copy link
Copy Markdown
Contributor

@MaximSmolskiy Could you rebase and fix conflicts after your previous patch?

@MaximSmolskiy
Copy link
Copy Markdown
Contributor Author

@MaximSmolskiy Could you rebase and fix conflicts after your previous patch?

@asmorkalov I will do it, but I think there is still a lot of work to do here

@asmorkalov
Copy link
Copy Markdown
Contributor

[ RUN ] fitEllipse_Modes.accuracy/0, where GetParam() = 13 Test fails on many platforms.

Details
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:709: Failure
  The difference between res.center.y and ref_center.y is 0.031352996826171875, which exceeds 0.01, where
  res.center.y evaluates to 55.695201873779297,
  ref_center.y evaluates to 55.726554870605469, and
  0.01 evaluates to 0.01.
  Google Test trace:
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:656: iteration 0
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:712: Failure
  The difference between max(res.size.width, res.size.height) and max(ref_size.width, ref_size.height) is 0.16428375244140625, which exceeds sizeDiff, where
  max(res.size.width, res.size.height) evaluates to 74.943496704101562,
  max(ref_size.width, ref_size.height) evaluates to 74.779212951660156, and
  sizeDiff evaluates to 0.10000000149011612.
  Google Test trace:
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:656: iteration 0
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:719: Failure
  Expected: (angleDiff(ref_angle1, res.angle)) <= (0.1), actual: 179.89 vs 0.1
  Google Test trace:
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:656: iteration 0
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:709: Failure
  The difference between res.center.x and ref_center.x is 0.14357805252075195, which exceeds 0.01, where
  res.center.x evaluates to 7.0617284774780273,
  ref_center.x evaluates to 7.2053065299987793, and
  0.01 evaluates to 0.01.
  Google Test trace:
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:656: iteration 1
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:709: Failure
  The difference between res.center.y and ref_center.y is 0.25177383422851562, which exceeds 0.01, where
  res.center.y evaluates to -42.611194610595703,
  ref_center.y evaluates to -42.359420776367188, and
  0.01 evaluates to 0.01.
  Google Test trace:
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:656: iteration 1
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:712: Failure
  The difference between max(res.size.width, res.size.height) and max(ref_size.width, ref_size.height) is 0.7310638427734375, which exceeds sizeDiff, where
  max(res.size.width, res.size.height) evaluates to 200.03376770019531,
  max(ref_size.width, ref_size.height) evaluates to 199.30270385742188, and
  sizeDiff evaluates to 0.10000000149011612.
  Google Test trace:
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:656: iteration 1
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:715: Failure
  Expected: (angleDiff(ref_angle2, res.angle)) <= (0.1), actual: 179.951 vs 0.1
  Google Test trace:
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:656: iteration 1
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:709: Failure
  The difference between res.center.x and ref_center.x is 0.02429962158203125, which exceeds 0.01, where
  res.center.x evaluates to -84.580696105957031,
  ref_center.x evaluates to -84.556396484375, and
  0.01 evaluates to 0.01.
  Google Test trace:
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:656: iteration 2
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:709: Failure
  The difference between res.center.y and ref_center.y is 0.067471504211425781, which exceeds 0.01, where
  res.center.y evaluates to 4.5729231834411621,
  ref_center.y evaluates to 4.6403946876525879, and
  0.01 evaluates to 0.01.
  Google Test trace:
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:656: iteration 2
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:712: Failure
  The difference between max(res.size.width, res.size.height) and max(ref_size.width, ref_size.height) is 0.17604827880859375, which exceeds sizeDiff, where
  max(res.size.width, res.size.height) evaluates to 92.930023193359375,
  max(ref_size.width, ref_size.height) evaluates to 93.106071472167969, and
  sizeDiff evaluates to 0.10000000149011612.
  Google Test trace:
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:656: iteration 2
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:719: Failure
  Expected: (angleDiff(ref_angle1, res.angle)) <= (0.1), actual: 179.962 vs 0.1
  Google Test trace:
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:656: iteration 2
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:709: Failure
  The difference between res.center.x and ref_center.x is 0.148834228515625, which exceeds 0.01, where
  res.center.x evaluates to 3.876861572265625,
  ref_center.x evaluates to 3.72802734375, and
  0.01 evaluates to 0.01.
  Google Test trace:
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:656: iteration 3
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:709: Failure
  The difference between res.center.y and ref_center.y is 0.035064697265625, which exceeds 0.01, where
  res.center.y evaluates to -94.567138671875,
  ref_center.y evaluates to -94.602203369140625, and
  0.01 evaluates to 0.01.
  Google Test trace:
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:656: iteration 3
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:712: Failure
  The difference between max(res.size.width, res.size.height) and max(ref_size.width, ref_size.height) is 0.46600341796875, which exceeds sizeDiff, where
  max(res.size.width, res.size.height) evaluates to 294.24429321289062,
  max(ref_size.width, ref_size.height) evaluates to 294.71029663085938, and
  sizeDiff evaluates to 0.10000000149011612.
  Google Test trace:
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:656: iteration 3
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:719: Failure
  Expected: (angleDiff(ref_angle1, res.angle)) <= (0.1), actual: 0.105774 vs 0.1
  Google Test trace:
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:656: iteration 3
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:709: Failure
  The difference between res.center.x and ref_center.x is 0.14314651489257812, which exceeds 0.01, where
  res.center.x evaluates to 51.765361785888672,
  ref_center.x evaluates to 51.622215270996094, and
  0.01 evaluates to 0.01.
  Google Test trace:
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:656: iteration 5
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:709: Failure
  The difference between res.center.y and ref_center.y is 0.20017647743225098, which exceeds 0.01, where
  res.center.y evaluates to -1.8791747093200684,
  ref_center.y evaluates to -2.0793511867523193, and
  0.01 evaluates to 0.01.
  Google Test trace:
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:656: iteration 5
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:711: Failure
  The difference between min(res.size.width, res.size.height) and min(ref_size.width, ref_size.height) is 0.553375244140625, which exceeds sizeDiff, where
  min(res.size.width, res.size.height) evaluates to 215.90545654296875,
  min(ref_size.width, ref_size.height) evaluates to 215.35208129882812, and
  sizeDiff evaluates to 0.10000000149011612.
  Google Test trace:
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:656: iteration 5
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:712: Failure
  The difference between max(res.size.width, res.size.height) and max(ref_size.width, ref_size.height) is 0.480255126953125, which exceeds sizeDiff, where
  max(res.size.width, res.size.height) evaluates to 433.421875,
  max(ref_size.width, ref_size.height) evaluates to 432.94161987304688, and
  sizeDiff evaluates to 0.10000000149011612.
  Google Test trace:
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:656: iteration 5
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:709: Failure
  The difference between res.center.x and ref_center.x is 0.12608122825622559, which exceeds 0.01, where
  res.center.x evaluates to 0.96769058704376221,
  ref_center.x evaluates to 1.0937718152999878, and
  0.01 evaluates to 0.01.
  Google Test trace:
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:656: iteration 6
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:711: Failure
  The difference between min(res.size.width, res.size.height) and min(ref_size.width, ref_size.height) is 0.1369476318359375, which exceeds sizeDiff, where
  min(res.size.width, res.size.height) evaluates to 102.49685668945312,
  min(ref_size.width, ref_size.height) evaluates to 102.35990905761719, and
  sizeDiff evaluates to 0.10000000149011612.
  Google Test trace:
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:656: iteration 6
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:712: Failure
  The difference between max(res.size.width, res.size.height) and max(ref_size.width, ref_size.height) is 0.1242523193359375, which exceeds sizeDiff, where
  max(res.size.width, res.size.height) evaluates to 238.30842590332031,
  max(ref_size.width, ref_size.height) evaluates to 238.18417358398438, and
  sizeDiff evaluates to 0.10000000149011612.
  Google Test trace:
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:656: iteration 6
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:709: Failure
  The difference between res.center.x and ref_center.x is 0.01079559326171875, which exceeds 0.01, where
  res.center.x evaluates to -35.456672668457031,
  ref_center.x evaluates to -35.445877075195312, and
  0.01 evaluates to 0.01.
  Google Test trace:
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:656: iteration 7
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:709: Failure
  The difference between res.center.y and ref_center.y is 0.032003402709960938, which exceeds 0.01, where
  res.center.y evaluates to -17.682683944702148,
  ref_center.y evaluates to -17.714687347412109, and
  0.01 evaluates to 0.01.
  Google Test trace:
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:656: iteration 7
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:711: Failure
  The difference between min(res.size.width, res.size.height) and min(ref_size.width, ref_size.height) is 0.7824859619140625, which exceeds sizeDiff, where
  min(res.size.width, res.size.height) evaluates to 168.25273132324219,
  min(ref_size.width, ref_size.height) evaluates to 169.03521728515625, and
  sizeDiff evaluates to 0.10000000149011612.
  Google Test trace:
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:656: iteration 7
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:712: Failure
  The difference between max(res.size.width, res.size.height) and max(ref_size.width, ref_size.height) is 0.340789794921875, which exceeds sizeDiff, where
  max(res.size.width, res.size.height) evaluates to 439.63427734375,
  max(ref_size.width, ref_size.height) evaluates to 439.29348754882812, and
  sizeDiff evaluates to 0.10000000149011612.
  Google Test trace:
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:656: iteration 7
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:709: Failure
  The difference between res.center.x and ref_center.x is 0.066010951995849609, which exceeds 0.01, where
  res.center.x evaluates to 3.6527106761932373,
  ref_center.x evaluates to 3.7187216281890869, and
  0.01 evaluates to 0.01.
  Google Test trace:
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:656: iteration 10
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:709: Failure
  The difference between res.center.y and ref_center.y is 0.01129913330078125, which exceeds 0.01, where
  res.center.y evaluates to 87.745697021484375,
  ref_center.y evaluates to 87.756996154785156, and
  0.01 evaluates to 0.01.
  Google Test trace:
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:656: iteration 10
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:712: Failure
  The difference between max(res.size.width, res.size.height) and max(ref_size.width, ref_size.height) is 0.10178375244140625, which exceeds sizeDiff, where
  max(res.size.width, res.size.height) evaluates to 88.948890686035156,
  max(ref_size.width, ref_size.height) evaluates to 89.050674438476562, and
  sizeDiff evaluates to 0.10000000149011612.
  Google Test trace:
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:656: iteration 10
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:715: Failure
  Expected: (angleDiff(ref_angle2, res.angle)) <= (0.1), actual: 179.884 vs 0.1
  Google Test trace:
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:656: iteration 10
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:709: Failure
  The difference between res.center.y and ref_center.y is 0.071498870849609375, which exceeds 0.01, where
  res.center.y evaluates to -43.936538696289062,
  ref_center.y evaluates to -44.008037567138672, and
  0.01 evaluates to 0.01.
  Google Test trace:
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:656: iteration 13
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:711: Failure
  The difference between min(res.size.width, res.size.height) and min(ref_size.width, ref_size.height) is 0.10516738891601562, which exceeds sizeDiff, where
  min(res.size.width, res.size.height) evaluates to 46.379077911376953,
  min(ref_size.width, ref_size.height) evaluates to 46.484245300292969, and
  sizeDiff evaluates to 0.10000000149011612.
  Google Test trace:
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:656: iteration 13
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:719: Failure
  Expected: (angleDiff(ref_angle1, res.angle)) <= (0.1), actual: 179.946 vs 0.1
  Google Test trace:
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:656: iteration 13
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:709: Failure
  The difference between res.center.x and ref_center.x is 0.05939483642578125, which exceeds 0.01, where
  res.center.x evaluates to 87.68695068359375,
  ref_center.x evaluates to 87.746345520019531, and
  0.01 evaluates to 0.01.
  Google Test trace:
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:656: iteration 14
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:709: Failure
  The difference between res.center.y and ref_center.y is 0.03304290771484375, which exceeds 0.01, where
  res.center.y evaluates to 65.046295166015625,
  ref_center.y evaluates to 65.079338073730469, and
  0.01 evaluates to 0.01.
  Google Test trace:
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:656: iteration 14
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:712: Failure
  The difference between max(res.size.width, res.size.height) and max(ref_size.width, ref_size.height) is 0.2847900390625, which exceeds sizeDiff, where
  max(res.size.width, res.size.height) evaluates to 147.41598510742188,
  max(ref_size.width, ref_size.height) evaluates to 147.70077514648438, and
  sizeDiff evaluates to 0.10000000149011612.
  Google Test trace:
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:656: iteration 14
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:715: Failure
  Expected: (angleDiff(ref_angle2, res.angle)) <= (0.1), actual: 179.914 vs 0.1
  Google Test trace:
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:656: iteration 14
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:709: Failure
  The difference between res.center.x and ref_center.x is 0.24158477783203125, which exceeds 0.01, where
  res.center.x evaluates to -82.680130004882812,
  ref_center.x evaluates to -82.438545227050781, and
  0.01 evaluates to 0.01.
  Google Test trace:
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:656: iteration 15
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:709: Failure
  The difference between res.center.y and ref_center.y is 0.14835548400878906, which exceeds 0.01, where
  res.center.y evaluates to -19.137044906616211,
  ref_center.y evaluates to -18.988689422607422, and
  0.01 evaluates to 0.01.
  Google Test trace:
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:656: iteration 15
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:711: Failure
  The difference between min(res.size.width, res.size.height) and min(ref_size.width, ref_size.height) is 0.2572021484375, which exceeds sizeDiff, where
  min(res.size.width, res.size.height) evaluates to 204.713134765625,
  min(ref_size.width, ref_size.height) evaluates to 204.4559326171875, and
  sizeDiff evaluates to 0.10000000149011612.
  Google Test trace:
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:656: iteration 15
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:712: Failure
  The difference between max(res.size.width, res.size.height) and max(ref_size.width, ref_size.height) is 0.54803466796875, which exceeds sizeDiff, where
  max(res.size.width, res.size.height) evaluates to 381.34765625,
  max(ref_size.width, ref_size.height) evaluates to 381.89569091796875, and
  sizeDiff evaluates to 0.10000000149011612.
  Google Test trace:
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:656: iteration 15
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:719: Failure
  Expected: (angleDiff(ref_angle1, res.angle)) <= (0.1), actual: 179.938 vs 0.1
  Google Test trace:
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:656: iteration 15
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:709: Failure
  The difference between res.center.x and ref_center.x is 0.083209991455078125, which exceeds 0.01, where
  res.center.x evaluates to 20.930164337158203,
  ref_center.x evaluates to 21.013374328613281, and
  0.01 evaluates to 0.01.
  Google Test trace:
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:656: iteration 19
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:709: Failure
  The difference between res.center.y and ref_center.y is 0.45600008964538574, which exceeds 0.01, where
  res.center.y evaluates to -1.4683732986450195,
  ref_center.y evaluates to -1.9243733882904053, and
  0.01 evaluates to 0.01.
  Google Test trace:
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:656: iteration 19
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:711: Failure
  The difference between min(res.size.width, res.size.height) and min(ref_size.width, ref_size.height) is 0.592803955078125, which exceeds sizeDiff, where
  min(res.size.width, res.size.height) evaluates to 167.90231323242188,
  min(ref_size.width, ref_size.height) evaluates to 168.4951171875, and
  sizeDiff evaluates to 0.10000000149011612.
  Google Test trace:
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:656: iteration 19
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:712: Failure
  The difference between max(res.size.width, res.size.height) and max(ref_size.width, ref_size.height) is 0.79290771484375, which exceeds sizeDiff, where
  max(res.size.width, res.size.height) evaluates to 431.66806030273438,
  max(ref_size.width, ref_size.height) evaluates to 430.87515258789062, and
  sizeDiff evaluates to 0.10000000149011612.
  Google Test trace:
  /home/ci/opencv/modules/imgproc/test/test_convhull.cpp:656: iteration 19

@asmorkalov
Copy link
Copy Markdown
Contributor

@MaximSmolskiy Could you take a look on the failed tests?

@asmorkalov asmorkalov modified the milestones: 4.13.0, 4.14.0 Dec 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fitEllipse fails with a certain set of points fitEllipse returns a very far ellipse

3 participants