Skip to content

Handle det == 0 in findCircle3pts.#16136

Merged
alalek merged 3 commits intoopencv:3.4from
mcellis33:mec-nan
Dec 18, 2019
Merged

Handle det == 0 in findCircle3pts.#16136
alalek merged 3 commits intoopencv:3.4from
mcellis33:mec-nan

Conversation

@mcellis33
Copy link
Copy Markdown
Contributor

@mcellis33 mcellis33 commented Dec 11, 2019

Resolves #16051.

Issue #16051 shows a case where findCircle3pts returns NaN for the
center coordinates and radius due to dividing by a determinant of 0. In
this case, the points are colinear, so the longest distance between any
2 points is the diameter of the minimum enclosing circle.

@mcellis33 mcellis33 marked this pull request as ready for review December 11, 2019 18:52
Issue #16051 shows a case where findCircle3pts returns NaN for the
center coordinates and radius due to dividing by a determinant of 0. In
this case, the points are colinear, so the longest distance between any
2 points is the diameter of the minimum enclosing circle.
@asmorkalov
Copy link
Copy Markdown
Contributor

@mcellis33 Thanks for the fix. Could you look at CI bot log, it reports warnings on Windows:

C:\build\precommit_windows64\3.4\opencv\modules\imgproc\test\test_convhull.cpp(1125): warning C4305: 'argument': truncation from 'double' to 'float' [C:\build\precommit_windows64\build\modules\imgproc\opencv_test_imgproc.vcxproj]
C:\build\precommit_windows64\3.4\opencv\modules\imgproc\test\test_convhull.cpp(1156): warning C4305: 'argument': truncation from 'double' to 'float' [C:\build\precommit_windows64\build\modules\imgproc\opencv_test_imgproc.vcxproj]
C:\build\precommit_windows64\3.4\opencv\modules\imgproc\test\test_convhull.cpp(1157): warning C4305: 'argument': truncation from 'double' to 'float' [C:\build\precommit_windows64\build\modules\imgproc\opencv_test_imgproc.vcxproj]

Copy link
Copy Markdown
Contributor

@saskatchewancatch saskatchewancatch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VS warnings are due to use of double type literals going into float.
Best to specify them as float literals: ex) 2.1024551f.
Then warnings should go away.

Copy link
Copy Markdown
Member

@alalek alalek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you 👍

@alalek alalek merged commit 5d15c65 into opencv:3.4 Dec 18, 2019
@alalek alalek mentioned this pull request Dec 19, 2019
@asmorkalov asmorkalov mentioned this pull request Oct 15, 2025
6 tasks
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.

4 participants