From 4a8aa4397aa578e19ce7e6a0b1fdd702bd4187d5 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 29 Apr 2019 18:44:35 +0200 Subject: video: break camera API --- tracker-easy/tracker-easy.cpp | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'tracker-easy') diff --git a/tracker-easy/tracker-easy.cpp b/tracker-easy/tracker-easy.cpp index 84d14db0..0217b07f 100644 --- a/tracker-easy/tracker-easy.cpp +++ b/tracker-easy/tracker-easy.cpp @@ -125,23 +125,25 @@ namespace EasyTracker // Create our camera matrix iCameraMatrix.create(3, 3, CV_64FC1); iCameraMatrix.setTo(cv::Scalar(0)); - iCameraMatrix.at(0, 0) = iCameraInfo.focalLengthX; - iCameraMatrix.at(1, 1) = iCameraInfo.focalLengthY; - iCameraMatrix.at(0, 2) = iCameraInfo.principalPointX; - iCameraMatrix.at(1, 2) = iCameraInfo.principalPointY; + iCameraMatrix.at(0, 0) = iCameraInfo.fx; + iCameraMatrix.at(1, 1) = iCameraInfo.fy; + iCameraMatrix.at(0, 2) = iCameraInfo.P_x; + iCameraMatrix.at(1, 2) = iCameraInfo.P_y; iCameraMatrix.at(2, 2) = 1; // Create distortion cooefficients iDistCoeffsMatrix = cv::Mat::zeros(8, 1, CV_64FC1); // As per OpenCV docs they should be thus: k1, k2, p1, p2, k3, k4, k5, k6 - iDistCoeffsMatrix.at(0, 0) = 0; // Radial first order - iDistCoeffsMatrix.at(1, 0) = iCameraInfo.radialDistortionSecondOrder; // Radial second order - iDistCoeffsMatrix.at(2, 0) = 0; // Tangential first order - iDistCoeffsMatrix.at(3, 0) = 0; // Tangential second order - iDistCoeffsMatrix.at(4, 0) = 0; // Radial third order - iDistCoeffsMatrix.at(5, 0) = iCameraInfo.radialDistortionFourthOrder; // Radial fourth order - iDistCoeffsMatrix.at(6, 0) = 0; // Radial fith order - iDistCoeffsMatrix.at(7, 0) = iCameraInfo.radialDistortionSixthOrder; // Radial sixth order + // 0 - Radial first order + // 1 - Radial second order + // 2 - Tangential first order + // 3 - Tangential second order + // 4 - Radial third order + // 5 - Radial fourth order + // 6 - Radial fifth order + // 7 - Radial sixth order + for (unsigned k = 0; k < 8; k++) + iDistCoeffsMatrix.at(k, 0) = (double)iCameraInfo.dist_c[k]; } @@ -334,7 +336,7 @@ namespace EasyTracker // Create OpenCV matrix from our frame // TODO: Assert channel size is one or two - iMatFrame = cv::Mat(iFrame.height, iFrame.width, CV_MAKETYPE((iFrame.channelSize == 2 ? CV_16U : CV_8U), iFrame.channels), iFrame.data, iFrame.stride); + iMatFrame = cv::Mat(iFrame.height, iFrame.width, CV_MAKETYPE((iFrame.channel_size == 2 ? CV_16U : CV_8U), iFrame.channels), iFrame.data, iFrame.stride); iFrameCount++; bool doPreview = check_is_visible(); -- cgit v1.2.3