From f77224f1e69bd9e2e99338529b1957a5ab773b39 Mon Sep 17 00:00:00 2001 From: Jean-Marie HENAFF Date: Thu, 11 Mar 2021 17:43:26 +0100 Subject: [PATCH] fix: change the way rotMat is computed in SolAROpenCV::projectCV Behavior seemed different between platforms. Fixes SLAM on Android (at least). --- src/SolARProjectOpencv.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/SolARProjectOpencv.cpp b/src/SolARProjectOpencv.cpp index d176945a..ce51406a 100644 --- a/src/SolARProjectOpencv.cpp +++ b/src/SolARProjectOpencv.cpp @@ -49,7 +49,10 @@ FrameworkReturnCode projectCV(const std::vector & inputPoints, std: Transform3Df poseInv = pose.inverse(); cv::Mat rotMat, rvec; - rotMat = cv::Mat(3, 3, SolAROpenCVHelper::inferOpenCVType(), (void *)poseInv.rotation().data()); + rotMat = (cv::Mat_(3, 3) << poseInv(0, 0), poseInv(0, 1), poseInv(0, 2), + poseInv(1, 0), poseInv(1, 1), poseInv(1, 2), + poseInv(2, 0), poseInv(2, 1), poseInv(2, 2)); + cv::Mat tvec(3, 1, SolAROpenCVHelper::inferOpenCVType()); tvec.at(0, 0) = poseInv(0, 3); tvec.at(1, 0) = poseInv(1, 3);