From 4039631386ae84abbf476263b28c92d91ac23b81 Mon Sep 17 00:00:00 2001 From: Stéphane Lenclud Date: Wed, 24 Apr 2019 23:34:36 +0200 Subject: Adding support for four points model. Can't get it to work correctly though. --- tracker-easy/lang/nl_NL.ts | 40 +++--- tracker-easy/lang/ru_RU.ts | 41 +++--- tracker-easy/lang/stub.ts | 40 +++--- tracker-easy/lang/zh_CN.ts | 40 +++--- tracker-easy/point-extractor.cpp | 4 +- tracker-easy/point-extractor.h | 5 +- tracker-easy/preview.cpp | 10 +- tracker-easy/preview.h | 2 +- tracker-easy/settings.h | 6 +- tracker-easy/tracker-easy-dialog.cpp | 20 ++- tracker-easy/tracker-easy-settings.ui | 261 +++++++++++++++++++++++++++------- tracker-easy/tracker-easy.cpp | 116 ++++++++++++--- tracker-easy/tracker-easy.h | 8 ++ 13 files changed, 437 insertions(+), 156 deletions(-) diff --git a/tracker-easy/lang/nl_NL.ts b/tracker-easy/lang/nl_NL.ts index 22a99106..f084f93f 100644 --- a/tracker-easy/lang/nl_NL.ts +++ b/tracker-easy/lang/nl_NL.ts @@ -141,10 +141,6 @@ Cap - - Custom - - z: @@ -153,22 +149,10 @@ x: - - <html><head/><body><p>Location of the two remaining model points<br/>with respect to the reference point in default pose</p><p>Use any units you want, not necessarily centimeters.</p></body></html> - - y: - - <html><head/><body><p><span style=" font-size:16pt;">P</span><span style=" font-size:16pt; vertical-align:sub;">3</span></p></body></html> - - - - <html><head/><body><p><span style=" font-size:16pt;">P</span><span style=" font-size:16pt; vertical-align:sub;">2</span></p></body></html> - - Model position @@ -254,5 +238,29 @@ Don't roll or change position. Settings + + Four + + + + Model vertices + + + + <html><head/><body><p><span style=" font-size:16pt;">Top</span></p></body></html> + + + + <html><head/><body><p><span style=" font-size:16pt;">Left</span></p></body></html> + + + + <html><head/><body><p><span style=" font-size:16pt;">Right</span></p></body></html> + + + + <html><head/><body><p><span style=" font-size:16pt;">Center</span></p></body></html> + + diff --git a/tracker-easy/lang/ru_RU.ts b/tracker-easy/lang/ru_RU.ts index d45c89d1..e05e58f3 100644 --- a/tracker-easy/lang/ru_RU.ts +++ b/tracker-easy/lang/ru_RU.ts @@ -141,10 +141,6 @@ Cap Кепка - - Custom - Свой - z: @@ -153,23 +149,10 @@ x: - - <html><head/><body><p>Location of the two remaining model points<br/>with respect to the reference point in default pose</p><p>Use any units you want, not necessarily centimeters.</p></body></html> - Расположение двух оставшихся точек модели относительно опорной точки в стандартной позе. Возможно исп-ть любые единицы измерения, не обязательно сантиметры. - <html><head/><body><p> Расположение двух оставшихся точек модели<br/>относительно опорной точки в стандартной позе. </p><p>Возможно использовать любые единицы измерения.</p></body></html - y: - - <html><head/><body><p><span style=" font-size:16pt;">P</span><span style=" font-size:16pt; vertical-align:sub;">3</span></p></body></html> - - - - <html><head/><body><p><span style=" font-size:16pt;">P</span><span style=" font-size:16pt; vertical-align:sub;">2</span></p></body></html> - - Model position Положение модели @@ -259,5 +242,29 @@ ROLL или X/Y-смещения. Settings + + Four + + + + Model vertices + + + + <html><head/><body><p><span style=" font-size:16pt;">Top</span></p></body></html> + + + + <html><head/><body><p><span style=" font-size:16pt;">Left</span></p></body></html> + + + + <html><head/><body><p><span style=" font-size:16pt;">Right</span></p></body></html> + + + + <html><head/><body><p><span style=" font-size:16pt;">Center</span></p></body></html> + + diff --git a/tracker-easy/lang/stub.ts b/tracker-easy/lang/stub.ts index 1b58a8f4..89c6d087 100644 --- a/tracker-easy/lang/stub.ts +++ b/tracker-easy/lang/stub.ts @@ -141,10 +141,6 @@ Cap - - Custom - - z: @@ -153,22 +149,10 @@ x: - - <html><head/><body><p>Location of the two remaining model points<br/>with respect to the reference point in default pose</p><p>Use any units you want, not necessarily centimeters.</p></body></html> - - y: - - <html><head/><body><p><span style=" font-size:16pt;">P</span><span style=" font-size:16pt; vertical-align:sub;">3</span></p></body></html> - - - - <html><head/><body><p><span style=" font-size:16pt;">P</span><span style=" font-size:16pt; vertical-align:sub;">2</span></p></body></html> - - Model position @@ -254,5 +238,29 @@ Don't roll or change position. Settings + + Four + + + + Model vertices + + + + <html><head/><body><p><span style=" font-size:16pt;">Top</span></p></body></html> + + + + <html><head/><body><p><span style=" font-size:16pt;">Left</span></p></body></html> + + + + <html><head/><body><p><span style=" font-size:16pt;">Right</span></p></body></html> + + + + <html><head/><body><p><span style=" font-size:16pt;">Center</span></p></body></html> + + diff --git a/tracker-easy/lang/zh_CN.ts b/tracker-easy/lang/zh_CN.ts index d524aaed..417de26a 100644 --- a/tracker-easy/lang/zh_CN.ts +++ b/tracker-easy/lang/zh_CN.ts @@ -141,10 +141,6 @@ Cap 帽子式 - - Custom - 自定义模式 - z: Z: @@ -153,22 +149,10 @@ x: X: - - <html><head/><body><p>Location of the two remaining model points<br/>with respect to the reference point in default pose</p><p>Use any units you want, not necessarily centimeters.</p></body></html> - <html><head/><body><p>三点中的两点位置是相对第一个点的</p><p>单位不一定要用厘米</p></body></html> - y: Y: - - <html><head/><body><p><span style=" font-size:16pt;">P</span><span style=" font-size:16pt; vertical-align:sub;">3</span></p></body></html> - <html><head/><body><p><span style=" font-size:16pt;">P</span><span style=" font-size:16pt; vertical-align:sub;">3</span></p></body></html> - - - <html><head/><body><p><span style=" font-size:16pt;">P</span><span style=" font-size:16pt; vertical-align:sub;">2</span></p></body></html> - <html><head/><body><p><span style=" font-size:16pt;">P</span><span style=" font-size:16pt; vertical-align:sub;">2</span></p></body></html> - Model position 姿态空间位置 @@ -254,5 +238,29 @@ Don't roll or change position. Settings + + Four + + + + Model vertices + + + + <html><head/><body><p><span style=" font-size:16pt;">Top</span></p></body></html> + + + + <html><head/><body><p><span style=" font-size:16pt;">Left</span></p></body></html> + + + + <html><head/><body><p><span style=" font-size:16pt;">Right</span></p></body></html> + + + + <html><head/><body><p><span style=" font-size:16pt;">Center</span></p></body></html> + + diff --git a/tracker-easy/point-extractor.cpp b/tracker-easy/point-extractor.cpp index 61175a57..0a5ca81d 100644 --- a/tracker-easy/point-extractor.cpp +++ b/tracker-easy/point-extractor.cpp @@ -35,7 +35,7 @@ namespace EasyTracker } - void PointExtractor::ExtractPoints(const cv::Mat& aFrame, cv::Mat* aPreview, std::vector& aPoints) + void PointExtractor::ExtractPoints(const cv::Mat& aFrame, cv::Mat* aPreview, int aNeededPointCount, std::vector& aPoints) { //TODO: Assert if channel size is neither one nor two // Make sure our frame channel is 8 bit @@ -133,7 +133,7 @@ namespace EasyTracker // Typically noise comming from zippers and metal parts on your clothing. // With a cap tracker it also successfully discards noise from glasses. // However it may not work as good with a clip user wearing glasses. - while (aPoints.size() > KPointCount) // Until we have no more than three points + while (aPoints.size() > aNeededPointCount) // Until we have no more than three points { int maxY = 0; size_t index = -1; diff --git a/tracker-easy/point-extractor.h b/tracker-easy/point-extractor.h index 3c65b193..b037eed6 100644 --- a/tracker-easy/point-extractor.h +++ b/tracker-easy/point-extractor.h @@ -17,16 +17,13 @@ namespace EasyTracker { - - const int KPointCount = 3; - class PointExtractor { public: PointExtractor(); // extracts points from frame and draws some processing info into frame, if draw_output is set // dt: time since last call in seconds - void ExtractPoints(const cv::Mat& aFrame, cv::Mat* aPreview, std::vector& aPoints); + void ExtractPoints(const cv::Mat& aFrame, cv::Mat* aPreview, int aNeededPointCount, std::vector& aPoints); // Settings Settings s; diff --git a/tracker-easy/preview.cpp b/tracker-easy/preview.cpp index 4d6b7c61..218fca43 100644 --- a/tracker-easy/preview.cpp +++ b/tracker-easy/preview.cpp @@ -105,19 +105,17 @@ namespace EasyTracker cv::putText(iFrameRgb, aString, cv::Point(4,iFrameRgb.size().height-4), cv::FONT_HERSHEY_PLAIN, 2, cv::Scalar(0, 255, 0),2); } - void Preview::DrawCross(cv::Point aPoint) + void Preview::DrawCross(const cv::Point& aPoint, const cv::Scalar& aColor) { - constexpr int len = 9; - - static const cv::Scalar color(0, 255, 255); + constexpr int len = 9; cv::line(iFrameRgb, cv::Point(aPoint.x - len, aPoint.y), cv::Point(aPoint.x + len, aPoint.y), - color, 2); + aColor, 2); cv::line(iFrameRgb, cv::Point(aPoint.x, aPoint.y - len), cv::Point(aPoint.x, aPoint.y + len), - color, 2); + aColor, 2); } void Preview::ensure_size(cv::Mat& frame, int w, int h, int type) diff --git a/tracker-easy/preview.h b/tracker-easy/preview.h index 74ef89aa..d5cc8c30 100644 --- a/tracker-easy/preview.h +++ b/tracker-easy/preview.h @@ -21,7 +21,7 @@ namespace EasyTracker Preview& operator=(const cv::Mat& frame); QImage get_bitmap(); - void DrawCross(cv::Point aPoint); + void DrawCross(const cv::Point& aPoint, const cv::Scalar& aColor); void DrawInfo(const std::string& aString); operator cv::Mat&() { return iFrameResized; } diff --git a/tracker-easy/settings.h b/tracker-easy/settings.h index b4c14967..8c6a2b3e 100644 --- a/tracker-easy/settings.h +++ b/tracker-easy/settings.h @@ -27,8 +27,10 @@ namespace EasyTracker { max_point_size{ b, "max-point-size", 50 }; value DeadzoneRectHalfEdgeSize { b, "deadzone-rect-half-edge-size", 1 }; - value m01_x{ b, "m_01-x", 0 }, m01_y{ b, "m_01-y", 0 }, m01_z{ b, "m_01-z", 0 }; - value m02_x{ b, "m_02-x", 0 }, m02_y{ b, "m_02-y", 0 }, m02_z{ b, "m_02-z", 0 }; + value iFourPointsTopX{ b, "iFourPointsTopX", 0 }, iFourPointsTopY{ b, "iFourPointsTopY", 0 }, iFourPointsTopZ{ b, "iFourPointsTopZ", 0 }; + value iFourPointsLeftX{ b, "iFourPointsLeftX", 0 }, iFourPointsLeftY{ b, "iFourPointsLeftY", 0 }, iFourPointsLeftZ{ b, "iFourPointsLeftZ", 0 }; + value iFourPointsRightX{ b, "iFourPointsRightX", 0 }, iFourPointsRightY{ b, "iFourPointsRightY", 0 }, iFourPointsRightZ{ b, "iFourPointsRightZ", 0 }; + value iFourPointsCenterX{ b, "iFourPointsCenterX", 0 }, iFourPointsCenterY{ b, "iFourPointsCenterY", 0 }, iFourPointsCenterZ{ b, "iFourPointsCenterZ", 0 }; value t_MH_x{ b, "model-centroid-x", 0 }, t_MH_y{ b, "model-centroid-y", 0 }, diff --git a/tracker-easy/tracker-easy-dialog.cpp b/tracker-easy/tracker-easy-dialog.cpp index fe0091c5..ce100b48 100644 --- a/tracker-easy/tracker-easy-dialog.cpp +++ b/tracker-easy/tracker-easy-dialog.cpp @@ -55,13 +55,21 @@ namespace EasyTracker tie_setting(s.cap_y, ui.cap_height_spin); tie_setting(s.cap_z, ui.cap_length_spin); - tie_setting(s.m01_x, ui.m1x_spin); - tie_setting(s.m01_y, ui.m1y_spin); - tie_setting(s.m01_z, ui.m1z_spin); + tie_setting(s.iFourPointsTopX, ui.iSpinFourTopX); + tie_setting(s.iFourPointsTopY, ui.iSpinFourTopY); + tie_setting(s.iFourPointsTopZ, ui.iSpinFourTopZ); - tie_setting(s.m02_x, ui.m2x_spin); - tie_setting(s.m02_y, ui.m2y_spin); - tie_setting(s.m02_z, ui.m2z_spin); + tie_setting(s.iFourPointsLeftX, ui.iSpinFourLeftX); + tie_setting(s.iFourPointsLeftY, ui.iSpinFourLeftY); + tie_setting(s.iFourPointsLeftZ, ui.iSpinFourLeftZ); + + tie_setting(s.iFourPointsRightX, ui.iSpinFourRightX); + tie_setting(s.iFourPointsRightY, ui.iSpinFourRightY); + tie_setting(s.iFourPointsRightZ, ui.iSpinFourRightZ); + + tie_setting(s.iFourPointsCenterX, ui.iSpinFourCenterX); + tie_setting(s.iFourPointsCenterY, ui.iSpinFourCenterY); + tie_setting(s.iFourPointsCenterZ, ui.iSpinFourCenterZ); tie_setting(s.t_MH_x, ui.tx_spin); tie_setting(s.t_MH_y, ui.ty_spin); diff --git a/tracker-easy/tracker-easy-settings.ui b/tracker-easy/tracker-easy-settings.ui index 2ec56a04..9b9c67a8 100644 --- a/tracker-easy/tracker-easy-settings.ui +++ b/tracker-easy/tracker-easy-settings.ui @@ -9,7 +9,7 @@ 0 0 - 418 + 422 724 @@ -115,7 +115,7 @@ - 0 + 1 @@ -871,22 +871,35 @@ - + - false + true - Custom + Four - Model Dimensions + Model vertices - - + + + + mm + + + -65535 + + + 65535 + + + + + 0 @@ -894,12 +907,25 @@ - z: + x: - - + + + + + 0 + 0 + + + + y: + + + + + mm @@ -911,8 +937,8 @@ - - + + 0 @@ -920,12 +946,25 @@ - x: + z: - - + + + + + 0 + 0 + + + + <html><head/><body><p><span style=" font-size:16pt;">Top</span></p></body></html> + + + + + mm @@ -937,8 +976,8 @@ - - + + mm @@ -950,8 +989,8 @@ - - + + mm @@ -963,8 +1002,8 @@ - - + + mm @@ -976,21 +1015,73 @@ - - + + - + + 0 + 0 + + + + <html><head/><body><p><span style=" font-size:16pt;">Left</span></p></body></html> + + + + + + + + 0 + 0 + + + + y: + + + + + + + 0 0 - <html><head/><body><p>Location of the two remaining model points<br/>with respect to the reference point in default pose</p><p>Use any units you want, not necessarily centimeters.</p></body></html> + z: + + + + + + + + 0 + 0 + + + + x: + + + + + + + + 0 + 0 + + + + <html><head/><body><p><span style=" font-size:16pt;">Right</span></p></body></html> - + mm @@ -1002,8 +1093,21 @@ - - + + + + + 0 + 0 + + + + x: + + + + + 0 @@ -1015,8 +1119,21 @@ - - + + + + mm + + + -65535 + + + 65535 + + + + + 0 @@ -1024,11 +1141,24 @@ - x: + z: - + + + + mm + + + -65535 + + + 65535 + + + + @@ -1037,12 +1167,12 @@ - <html><head/><body><p><span style=" font-size:16pt;">P</span><span style=" font-size:16pt; vertical-align:sub;">3</span></p></body></html> + <html><head/><body><p><span style=" font-size:16pt;">Center</span></p></body></html> - - + + 0 @@ -1050,12 +1180,25 @@ - <html><head/><body><p><span style=" font-size:16pt;">P</span><span style=" font-size:16pt; vertical-align:sub;">2</span></p></body></html> + x: - - + + + + mm + + + -65535 + + + 65535 + + + + + 0 @@ -1063,12 +1206,25 @@ - z: + y: - - + + + + mm + + + -65535 + + + 65535 + + + + + 0 @@ -1076,7 +1232,20 @@ - y: + z: + + + + + + + mm + + + -65535 + + + 65535 @@ -1318,12 +1487,6 @@ Don't roll or change position. cap_length_spin cap_height_spin cap_width_spin - m1x_spin - m1y_spin - m1z_spin - m2x_spin - m2y_spin - m2z_spin tx_spin ty_spin tz_spin diff --git a/tracker-easy/tracker-easy.cpp b/tracker-easy/tracker-easy.cpp index ebc6e128..971127d4 100644 --- a/tracker-easy/tracker-easy.cpp +++ b/tracker-easy/tracker-easy.cpp @@ -77,7 +77,6 @@ namespace EasyTracker // Compute Euler angles from rotation matrix void getEulerAngles(cv::Mat &rotCamerMatrix, cv::Vec3d &eulerAngles) { - cv::Mat cameraMatrix, rotMatrix, transVect, rotMatrixX, rotMatrixY, rotMatrixZ; double* _r = rotCamerMatrix.ptr(); double projMatrix[12] = { _r[0],_r[1],_r[2],0, @@ -100,11 +99,20 @@ namespace EasyTracker // Construct the points defining the object we want to detect based on settings. // We are converting them from millimeters to centimeters. // TODO: Need to support clip too. That's cap only for now. - // s.active_model_panel != PointModel::Clip iModel.clear(); - iModel.push_back(cv::Point3f(iSettings.cap_x / 10.0, iSettings.cap_z / 10.0, -iSettings.cap_y / 10.0)); // Right - iModel.push_back(cv::Point3f(-iSettings.cap_x / 10.0, iSettings.cap_z / 10.0, -iSettings.cap_y / 10.0)); // Left - iModel.push_back(cv::Point3f(0, 0, 0)); // Top + if (iSettings.active_model_panel == FourPoints) + { + iModel.push_back(cv::Point3f(iSettings.iFourPointsTopX / 10.0, iSettings.iFourPointsTopY / 10.0, iSettings.iFourPointsTopZ / 10.0)); // Top + iModel.push_back(cv::Point3f(iSettings.iFourPointsRightX / 10.0, iSettings.iFourPointsRightY / 10.0, iSettings.iFourPointsRightZ / 10.0)); // Right + iModel.push_back(cv::Point3f(iSettings.iFourPointsLeftX / 10.0, iSettings.iFourPointsLeftY / 10.0, iSettings.iFourPointsLeftZ / 10.0)); // Left + iModel.push_back(cv::Point3f(iSettings.iFourPointsCenterX / 10.0, iSettings.iFourPointsCenterY / 10.0, iSettings.iFourPointsCenterZ / 10.0)); // Center + } + else if (iSettings.active_model_panel == Cap) + { + iModel.push_back(cv::Point3f(0, 0, 0)); // Top + iModel.push_back(cv::Point3f(iSettings.cap_x / 10.0, iSettings.cap_z / 10.0, -iSettings.cap_y / 10.0)); // Right + iModel.push_back(cv::Point3f(-iSettings.cap_x / 10.0, iSettings.cap_z / 10.0, -iSettings.cap_y / 10.0)); // Left + } } /// @@ -149,11 +157,14 @@ namespace EasyTracker } iPoints.clear(); - iPointExtractor.ExtractPoints(iMatFrame, (doPreview ? &iPreview.iFrameRgb : nullptr), iPoints); + iPointExtractor.ExtractPoints(iMatFrame, (doPreview ? &iPreview.iFrameRgb : nullptr), iModel.size(), iPoints); - const bool success = iPoints.size() >= KPointCount; + const bool success = iPoints.size() >= iModel.size(); int topPointIndex = -1; + int rightPointIndex = -1; + int leftPointIndex = -1; + int centerPointIndex = -1; { QMutexLocker l(¢er_lock); @@ -167,7 +178,7 @@ namespace EasyTracker // Tracked points must match the order of the object model points. // Find top most point, that's the one with min Y as we assume our guy's head is not up side down int minY = std::numeric_limits::max(); - for (int i = 0; i < 3; i++) + for (int i = 0; i < iPoints.size(); i++) { if (iPoints[i].y < minY) { @@ -176,11 +187,11 @@ namespace EasyTracker } } - int rightPointIndex = -1; + int maxX = 0; // Find right most point - for (int i = 0; i < 3; i++) + for (int i = 0; i < iPoints.size(); i++) { // Excluding top most point if (i != topPointIndex && iPoints[i].x > maxX) @@ -191,21 +202,38 @@ namespace EasyTracker } // Find left most point - int leftPointIndex = -1; - for (int i = 0; i < 3; i++) + + int minX = std::numeric_limits::max();; + for (int i = 0; i < iPoints.size(); i++) { - // Excluding top most point - if (i != topPointIndex && i != rightPointIndex) + // Excluding top most point and right most point + if (i != topPointIndex && i != rightPointIndex && iPoints[i].x < minX) { leftPointIndex = i; - break; + minX = iPoints[i].x; } } - // + // Find center point, the last one + for (int i = 0; i < iPoints.size(); i++) + { + // Excluding the three points we already have + if (i != topPointIndex && i != rightPointIndex && i != leftPointIndex) + { + centerPointIndex = i; + } + } + + // Order matters + iTrackedPoints.push_back(iPoints[topPointIndex]); iTrackedPoints.push_back(iPoints[rightPointIndex]); iTrackedPoints.push_back(iPoints[leftPointIndex]); - iTrackedPoints.push_back(iPoints[topPointIndex]); + if (iModel.size() > iTrackedPoints.size()) + { + // We are tracking more than 3 points + iTrackedPoints.push_back(iPoints[centerPointIndex]); + } + bool movedEnough = true; // Check if we moved enough since last time we were here @@ -243,7 +271,32 @@ namespace EasyTracker iAngles.clear(); iBestSolutionIndex = -1; // Solve P3P problem with OpenCV - int solutionCount = cv::solveP3P(iModel, iTrackedPoints, iCameraMatrix, iDistCoeffsMatrix, iRotations, iTranslations, iSolver); + int solutionCount = 0; + if (iModel.size() == 3) + { + solutionCount = cv::solveP3P(iModel, iTrackedPoints, iCameraMatrix, iDistCoeffsMatrix, iRotations, iTranslations, iSolver); + } + else + { + //Guess extrinsic boolean is only for ITERATIVE method, it will be set to false for all other method + cv::Mat rotation, translation; + // Init only needed for iterative, it's also useless as it is + rotation = cv::Mat::zeros(3, 1, CV_64FC1); + translation = cv::Mat::zeros(3, 1, CV_64FC1); + rotation.setTo(cv::Scalar(0)); + translation.setTo(cv::Scalar(0)); + ///// + iRotations.clear(); + iTranslations.clear(); + bool solved = cv::solvePnP(iModel, iTrackedPoints, iCameraMatrix, iDistCoeffsMatrix, rotation, translation, true, iSolver ); + if (solved) + { + solutionCount = 1; + iRotations.push_back(rotation); + iTranslations.push_back(translation); + } + } + if (solutionCount > 0) { @@ -306,13 +359,34 @@ namespace EasyTracker ss << "FPS: " << iFps << "/" << iSkippedFps; iPreview.DrawInfo(ss.str()); - // + //Color is BGR if (topPointIndex != -1) { // Render a cross to indicate which point is the head - iPreview.DrawCross(iPoints[topPointIndex]); + static const cv::Scalar color(0, 255, 255); // Yellow + iPreview.DrawCross(iPoints[topPointIndex],color); + } + + if (rightPointIndex != -1) + { + static const cv::Scalar color(255, 0, 255); // Pink + iPreview.DrawCross(iPoints[rightPointIndex], color); } + if (leftPointIndex != -1) + { + static const cv::Scalar color(255, 0, 0); // Blue + iPreview.DrawCross(iPoints[leftPointIndex], color); + } + + if (centerPointIndex != -1) + { + static const cv::Scalar color(0, 255, 0); // Green + iPreview.DrawCross(iPoints[centerPointIndex], color); + } + + + // Render our deadzone rects for (const cv::Rect& rect : iTrackedRects) { @@ -462,7 +536,7 @@ namespace EasyTracker module_status Tracker::start_tracker(QFrame* video_frame) { // Check that we support that solver - if (iSolver!=cv::SOLVEPNP_P3P && iSolver != cv::SOLVEPNP_AP3P) + if (iSolver!=cv::SOLVEPNP_P3P && iSolver != cv::SOLVEPNP_AP3P && iModel.size()==3) { return module_status("Error: Solver not supported use either P3P or AP3P."); } diff --git a/tracker-easy/tracker-easy.h b/tracker-easy/tracker-easy.h index 41226d23..37337087 100644 --- a/tracker-easy/tracker-easy.h +++ b/tracker-easy/tracker-easy.h @@ -33,6 +33,14 @@ namespace EasyTracker { + // Order matters, it must match the order of the UI tabs + enum ModelType + { + Clip, + Cap, + FourPoints + }; + static const QString KModuleName = "tracker-easy"; class Dialog; -- cgit v1.2.3