Skip to content
This repository was archived by the owner on Jul 20, 2023. It is now read-only.

Commit f77224f

Browse files
committed
fix: change the way rotMat is computed in SolAROpenCV::projectCV
Behavior seemed different between platforms. Fixes SLAM on Android (at least).
1 parent e06f304 commit f77224f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/SolARProjectOpencv.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ FrameworkReturnCode projectCV(const std::vector<cv::Point3f> & inputPoints, std:
4949
Transform3Df poseInv = pose.inverse();
5050

5151
cv::Mat rotMat, rvec;
52-
rotMat = cv::Mat(3, 3, SolAROpenCVHelper::inferOpenCVType<float>(), (void *)poseInv.rotation().data());
52+
rotMat = (cv::Mat_<float>(3, 3) << poseInv(0, 0), poseInv(0, 1), poseInv(0, 2),
53+
poseInv(1, 0), poseInv(1, 1), poseInv(1, 2),
54+
poseInv(2, 0), poseInv(2, 1), poseInv(2, 2));
55+
5356
cv::Mat tvec(3, 1, SolAROpenCVHelper::inferOpenCVType<float>());
5457
tvec.at<float>(0, 0) = poseInv(0, 3);
5558
tvec.at<float>(1, 0) = poseInv(1, 3);

0 commit comments

Comments
 (0)