Skip to content

calib3d: avoid clang weird behavior#11057

Merged
opencv-pushbot merged 1 commit intoopencv:masterfrom
tomoaki0705:fixClangComplexCalib3d
Mar 13, 2018
Merged

calib3d: avoid clang weird behavior#11057
opencv-pushbot merged 1 commit intoopencv:masterfrom
tomoaki0705:fixClangComplexCalib3d

Conversation

@tomoaki0705
Copy link
Copy Markdown
Contributor

@tomoaki0705 tomoaki0705 commented Mar 12, 2018

resolves #11056

double complex1 = 4 * p4 / 3 + t;
#if defined(__clang__)
complex<double> complex2 = 2 * q4;
complex2 = complex<double>(complex2.real() / sqrt_2m.real(), 0);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can sqrt_2m have non-zero imagination? (from sqrt call of negative number)
Perhaps we need full formula for complex numbers division (and optimize it for zero complex2.imag()).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thank you for nice comment.
All the test case from gtest doesn't fail to 0, but AFAIK, there's no guarantee on this point.
Let me think of that point.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

As far as I understood, this function solveQuartic is calculating real roots from quartic equation.
Mathematically, there is a possibility that imaginary part becomes non-zero, (probably caused by wrong correspondence)
Should I add assertion before the sqrt or shall I keep as it is ?

@tomoaki0705 tomoaki0705 force-pushed the fixClangComplexCalib3d branch 3 times, most recently from ba36982 to 7ee5a72 Compare March 13, 2018 12:15
@tomoaki0705
Copy link
Copy Markdown
Contributor Author

@alalek , if you don't mind, can I modify the commit by my self ?

  * add ifdef to apply on specific situation
@alalek
Copy link
Copy Markdown
Member

alalek commented Mar 13, 2018

Sure.

@tomoaki0705 tomoaki0705 force-pushed the fixClangComplexCalib3d branch from ff93008 to 7fd53f6 Compare March 13, 2018 12:51
@tomoaki0705
Copy link
Copy Markdown
Contributor Author

Thank you !

@opencv-pushbot opencv-pushbot merged commit 7fd53f6 into opencv:master Mar 13, 2018
@tomoaki0705 tomoaki0705 deleted the fixClangComplexCalib3d branch March 13, 2018 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

calib3d: some tests fails using clang on Raspberry Pi 3

3 participants