From dbe9cb3bfad408bdf8a8580b940f77407d2c1ae0 Mon Sep 17 00:00:00 2001 From: Neil Mendoza Date: Tue, 24 May 2022 12:25:18 -0600 Subject: [PATCH 1/2] fix calibration undistort for points --- libs/ofxCv/src/Calibration.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libs/ofxCv/src/Calibration.cpp b/libs/ofxCv/src/Calibration.cpp index 19b1353..23125a6 100644 --- a/libs/ofxCv/src/Calibration.cpp +++ b/libs/ofxCv/src/Calibration.cpp @@ -417,6 +417,8 @@ namespace ofxCv { cv::Mat matSrc = cv::Mat(1, 1, CV_32FC2, &src.x); cv::Mat matDst = cv::Mat(1, 1, CV_32FC2, &dst.x);; undistortPoints(matSrc, matDst, distortedIntrinsics.getCameraMatrix(), distCoeffs); + dst.x = dst.x * undistortedIntrinsics.getCameraMatrix().at(0, 0) + undistortedIntrinsics.getCameraMatrix().at(0, 2); + dst.y = dst.y * undistortedIntrinsics.getCameraMatrix().at(1, 1) + undistortedIntrinsics.getCameraMatrix().at(1, 2); return dst; } @@ -426,6 +428,10 @@ namespace ofxCv { cv::Mat matSrc = cv::Mat(n, 1, CV_32FC2, &src[0].x); cv::Mat matDst = cv::Mat(n, 1, CV_32FC2, &dst[0].x); undistortPoints(matSrc, matDst, distortedIntrinsics.getCameraMatrix(), distCoeffs); + for (auto& v : dst) { + v.x = v.x * undistortedIntrinsics.getCameraMatrix().at(0, 0) + undistortedIntrinsics.getCameraMatrix().at(0, 2); + v.y = v.y * undistortedIntrinsics.getCameraMatrix().at(1, 1) + undistortedIntrinsics.getCameraMatrix().at(1, 2); + } } bool Calibration::getTransformation(Calibration& dst, cv::Mat& rotation, cv::Mat& translation) { From b66d0d6df832a04d10d287efa59a4557fb08ae1d Mon Sep 17 00:00:00 2001 From: Neil Mendoza Date: Thu, 24 Oct 2024 14:57:13 -0600 Subject: [PATCH 2/2] fixed linux compile issue --- libs/ofxCv/include/ofxCv/Tracker.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/ofxCv/include/ofxCv/Tracker.h b/libs/ofxCv/include/ofxCv/Tracker.h index c3fa4d3..7e544ff 100644 --- a/libs/ofxCv/include/ofxCv/Tracker.h +++ b/libs/ofxCv/include/ofxCv/Tracker.h @@ -125,7 +125,7 @@ namespace ofxCv { } public: - Tracker() + Tracker() :persistence(15) ,curLabel(0) ,maximumDistance(64) {