user7115640
user7115640

Reputation:

Calib3d_StereoCalibrate fails on ARM64bit using OpenCV

The tests Calib3d_StereoCalibrate_C and Calib3d_StereoCalibrate_CPP fails on 64bit ARM.

[----------] 1 test from Calib3d_StereoCalibrate_C
[ RUN      ] Calib3d_StereoCalibrate_C.regression
/home/ubuntu/opencv-fork/modules/ts/src/ts.cpp:518: Failure
Failed

    failure reason: Invalid function output
    test case #-1
    seed: ffffffffffffffff
-----------------------------------
    LOG:
Points reprojected with a matrix Q and points reconstructed by triangulation are different, testcase 1
Testcase 1. Max distance (calibrated) =2.2571
Max distance (uncalibrated) =3.5603

-----------------------------------

[  FAILED  ] Calib3d_StereoCalibrate_C.regression (6188 ms)
[----------] 1 test from Calib3d_StereoCalibrate_C (6188 ms total)

[----------] 1 test from Calib3d_StereoCalibrate_CPP
[ RUN      ] Calib3d_StereoCalibrate_CPP.regression
/home/ubuntu/opencv-fork/modules/ts/src/ts.cpp:518: Failure
Failed

    failure reason: Invalid function output
    test case #-1
    seed: ffffffffffffffff
-----------------------------------
    LOG:
Points reprojected with a matrix Q and points reconstructed by triangulation are different, testcase 1
Testcase 1. Max distance (calibrated) =2.2571
Max distance (uncalibrated) =3.5603

-----------------------------------

[  FAILED  ] Calib3d_StereoCalibrate_CPP.regression (6189 ms)
[----------] 1 test from Calib3d_StereoCalibrate_CPP (6190 ms total)

I traced this issue and realized that this issue doesn't reproduce under debug mode.

[----------] 1 test from Calib3d_StereoCalibrate_C
[ RUN      ] Calib3d_StereoCalibrate_C.regression
[       OK ] Calib3d_StereoCalibrate_C.regression (29540 ms)
[----------] 1 test from Calib3d_StereoCalibrate_C (29540 ms total)

[----------] 1 test from Calib3d_StereoCalibrate_CPP
[ RUN      ] Calib3d_StereoCalibrate_CPP.regression
[       OK ] Calib3d_StereoCalibrate_CPP.regression (29350 ms)
[----------] 1 test from Calib3d_StereoCalibrate_CPP (29350 ms total)

I forced not to use fmadd here, and confirmed that it let the test pass. Is there a way to handle this or a workaround?

Upvotes: 0

Views: 28

Answers (1)

user7115722
user7115722

Reputation:

It is a known bug related to opencv for arm64.

I faced this situation some times in the past. The cause is because of the difference between fmadd and separate multiply + add. GCC on 64bit tends to use fmadd as much as possible, compared to 32bit version.

Upvotes: 1

Related Questions