Skip to content

Commit 7e95787

Browse files
committed
Merge pull request opencv#11057 from tomoaki0705:fixClangComplexCalib3d
2 parents 2f0060e + 7fd53f6 commit 7e95787

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

modules/calib3d/src/ap3p.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,13 @@ void solveQuartic(const double *factors, double *realRoots) {
4545
complex<double> sqrt_2m = sqrt(static_cast<complex<double> >(-2 * p4 / 3 + t));
4646
double B_4A = -a3 / (4 * a4);
4747
double complex1 = 4 * p4 / 3 + t;
48+
#if defined(__clang__) && defined(__arm__) && __clang_major__ == 3 && __clang_minor__ <= 7 && !defined(__ANDROID__)
49+
// details: https://github.com/opencv/opencv/issues/11056
50+
complex<double> complex2 = 2 * q4;
51+
complex2 = complex<double>(complex2.real() / sqrt_2m.real(), 0);
52+
#else
4853
complex<double> complex2 = 2 * q4 / sqrt_2m;
54+
#endif
4955
double sqrt_2m_rh = sqrt_2m.real() / 2;
5056
double sqrt1 = sqrt(-(complex1 + complex2)).real() / 2;
5157
realRoots[0] = B_4A + sqrt_2m_rh + sqrt1;

0 commit comments

Comments
 (0)