From 4f4c21ab7894550b22ee7e42078883452530e8a8 Mon Sep 17 00:00:00 2001 From: Stéphane Lenclud Date: Wed, 2 Sep 2020 16:19:37 +0200 Subject: tracker/easy: Adding support for Clip models where three vertices are arranged from top to bottom. Close #1145 --- tracker-easy/lang/nl_NL.ts | 68 ++++++---- tracker-easy/lang/ru_RU.ts | 68 ++++++---- tracker-easy/lang/stub.ts | 68 ++++++---- tracker-easy/lang/zh_CN.ts | 68 ++++++---- tracker-easy/module.cpp | 2 +- tracker-easy/settings.h | 6 +- tracker-easy/tracker-easy-dialog.cpp | 46 ++++++- tracker-easy/tracker-easy-settings.ui | 228 ++++++++++++++++++++++++++++------ tracker-easy/tracker-easy.cpp | 85 +++++++++++-- tracker-easy/tracker-easy.h | 1 + 10 files changed, 495 insertions(+), 145 deletions(-) diff --git a/tracker-easy/lang/nl_NL.ts b/tracker-easy/lang/nl_NL.ts index 9c4e1843..775ec4d9 100644 --- a/tracker-easy/lang/nl_NL.ts +++ b/tracker-easy/lang/nl_NL.ts @@ -4,16 +4,12 @@ EasyTracker::Metadata - Easy Tracker 1.0 + Easy Tracker 1.1 UICPTClientControls - - PointTracker Settings - - Camera @@ -151,79 +147,103 @@ - Top Right + <html><head/><body><p><span style=" font-size:12pt;">X</span></p></body></html> - Top + <html><head/><body><p><span style=" font-size:12pt;">Y</span></p></body></html> - Top Left + <html><head/><body><p><span style=" font-size:12pt;">Z</span></p></body></html> - Left + Auto center - Vertex count + <html><head/><body><p>Use P3P or AP3P for three and four points setup. Use EPNP or ITERATIVE for five points setup. Inconsistent configuration will result in undefined behavior.</p></body></html> - Three vertices + Auto center timeout - Four vertices + If no valid pose can be determined after that much time the center pose will be used. - Five vertices + ms - Center + Easy Tracker Settings - Right + Model type: - <html><head/><body><p><span style=" font-size:12pt;">X</span></p></body></html> + Hat three vertices - <html><head/><body><p><span style=" font-size:12pt;">Y</span></p></body></html> + Hat four vertices - <html><head/><body><p><span style=" font-size:12pt;">Z</span></p></body></html> + Hat five vertices - <html><head/><body><p><span style=" font-weight:600;">Easy Tracker<br/>Version 1.0</span></p><p><span style=" font-weight:600;">by Stéphane Lenclud</span></p><p>See <a href="https://github.com/opentrack/opentrack/wiki/Easy-Tracker"><span style=" font-weight:600; text-decoration: underline; color:#9999aa;">documentation on GitHub</span></a></p></body></html> + Clip three vertices - Auto center + Vertices: - <html><head/><body><p>Use P3P or AP3P for three and four points setup. Use EPNP or ITERATIVE for five points setup. Inconsistent configuration will result in undefined behavior.</p></body></html> + Top: - Auto center timeout + Right: - If no valid pose can be determined after that much time the center pose will be used. + Left: - ms + Center: + + + + Top right: + + + + Top left: + + + + Clip top: + + + + Clip middle: + + + + Clip bottom: + + + + <html><head/><body><p><span style=" font-weight:600;">Easy Tracker<br/>Version 1.1</span></p><p><span style=" font-weight:600;">by Stéphane Lenclud</span></p><p>See <a href="https://github.com/opentrack/opentrack/wiki/Easy-Tracker"><span style=" font-weight:600; text-decoration: underline; color:#9999aa;">documentation on GitHub</span></a></p></body></html> diff --git a/tracker-easy/lang/ru_RU.ts b/tracker-easy/lang/ru_RU.ts index 6499415f..2ae262a5 100644 --- a/tracker-easy/lang/ru_RU.ts +++ b/tracker-easy/lang/ru_RU.ts @@ -4,16 +4,12 @@ EasyTracker::Metadata - Easy Tracker 1.0 + Easy Tracker 1.1 UICPTClientControls - - PointTracker Settings - Настройки PointTracker - Camera Камера @@ -151,79 +147,103 @@ - Top Right + <html><head/><body><p><span style=" font-size:12pt;">X</span></p></body></html> - Top + <html><head/><body><p><span style=" font-size:12pt;">Y</span></p></body></html> - Top Left + <html><head/><body><p><span style=" font-size:12pt;">Z</span></p></body></html> - Left + Auto center - Vertex count + <html><head/><body><p>Use P3P or AP3P for three and four points setup. Use EPNP or ITERATIVE for five points setup. Inconsistent configuration will result in undefined behavior.</p></body></html> - Three vertices + Auto center timeout - Four vertices + If no valid pose can be determined after that much time the center pose will be used. - Five vertices + ms - Center + Easy Tracker Settings - Right + Model type: - <html><head/><body><p><span style=" font-size:12pt;">X</span></p></body></html> + Hat three vertices - <html><head/><body><p><span style=" font-size:12pt;">Y</span></p></body></html> + Hat four vertices - <html><head/><body><p><span style=" font-size:12pt;">Z</span></p></body></html> + Hat five vertices - <html><head/><body><p><span style=" font-weight:600;">Easy Tracker<br/>Version 1.0</span></p><p><span style=" font-weight:600;">by Stéphane Lenclud</span></p><p>See <a href="https://github.com/opentrack/opentrack/wiki/Easy-Tracker"><span style=" font-weight:600; text-decoration: underline; color:#9999aa;">documentation on GitHub</span></a></p></body></html> + Clip three vertices - Auto center + Vertices: - <html><head/><body><p>Use P3P or AP3P for three and four points setup. Use EPNP or ITERATIVE for five points setup. Inconsistent configuration will result in undefined behavior.</p></body></html> + Top: - Auto center timeout + Right: - If no valid pose can be determined after that much time the center pose will be used. + Left: - ms + Center: + + + + Top right: + + + + Top left: + + + + Clip top: + + + + Clip middle: + + + + Clip bottom: + + + + <html><head/><body><p><span style=" font-weight:600;">Easy Tracker<br/>Version 1.1</span></p><p><span style=" font-weight:600;">by Stéphane Lenclud</span></p><p>See <a href="https://github.com/opentrack/opentrack/wiki/Easy-Tracker"><span style=" font-weight:600; text-decoration: underline; color:#9999aa;">documentation on GitHub</span></a></p></body></html> diff --git a/tracker-easy/lang/stub.ts b/tracker-easy/lang/stub.ts index 7b6facec..b10f5885 100644 --- a/tracker-easy/lang/stub.ts +++ b/tracker-easy/lang/stub.ts @@ -4,16 +4,12 @@ EasyTracker::Metadata - Easy Tracker 1.0 + Easy Tracker 1.1 UICPTClientControls - - PointTracker Settings - - Camera @@ -151,79 +147,103 @@ - Top Right + <html><head/><body><p><span style=" font-size:12pt;">X</span></p></body></html> - Top + <html><head/><body><p><span style=" font-size:12pt;">Y</span></p></body></html> - Top Left + <html><head/><body><p><span style=" font-size:12pt;">Z</span></p></body></html> - Left + Auto center - Vertex count + <html><head/><body><p>Use P3P or AP3P for three and four points setup. Use EPNP or ITERATIVE for five points setup. Inconsistent configuration will result in undefined behavior.</p></body></html> - Three vertices + Auto center timeout - Four vertices + If no valid pose can be determined after that much time the center pose will be used. - Five vertices + ms - Center + Easy Tracker Settings - Right + Model type: - <html><head/><body><p><span style=" font-size:12pt;">X</span></p></body></html> + Hat three vertices - <html><head/><body><p><span style=" font-size:12pt;">Y</span></p></body></html> + Hat four vertices - <html><head/><body><p><span style=" font-size:12pt;">Z</span></p></body></html> + Hat five vertices - <html><head/><body><p><span style=" font-weight:600;">Easy Tracker<br/>Version 1.0</span></p><p><span style=" font-weight:600;">by Stéphane Lenclud</span></p><p>See <a href="https://github.com/opentrack/opentrack/wiki/Easy-Tracker"><span style=" font-weight:600; text-decoration: underline; color:#9999aa;">documentation on GitHub</span></a></p></body></html> + Clip three vertices - Auto center + Vertices: - <html><head/><body><p>Use P3P or AP3P for three and four points setup. Use EPNP or ITERATIVE for five points setup. Inconsistent configuration will result in undefined behavior.</p></body></html> + Top: - Auto center timeout + Right: - If no valid pose can be determined after that much time the center pose will be used. + Left: - ms + Center: + + + + Top right: + + + + Top left: + + + + Clip top: + + + + Clip middle: + + + + Clip bottom: + + + + <html><head/><body><p><span style=" font-weight:600;">Easy Tracker<br/>Version 1.1</span></p><p><span style=" font-weight:600;">by Stéphane Lenclud</span></p><p>See <a href="https://github.com/opentrack/opentrack/wiki/Easy-Tracker"><span style=" font-weight:600; text-decoration: underline; color:#9999aa;">documentation on GitHub</span></a></p></body></html> diff --git a/tracker-easy/lang/zh_CN.ts b/tracker-easy/lang/zh_CN.ts index bbd8aff1..71fc6368 100644 --- a/tracker-easy/lang/zh_CN.ts +++ b/tracker-easy/lang/zh_CN.ts @@ -4,16 +4,12 @@ EasyTracker::Metadata - Easy Tracker 1.0 + Easy Tracker 1.1 UICPTClientControls - - PointTracker Settings - PointTracker设置 - Camera 摄像头 @@ -151,79 +147,103 @@ - Top Right + <html><head/><body><p><span style=" font-size:12pt;">X</span></p></body></html> - Top + <html><head/><body><p><span style=" font-size:12pt;">Y</span></p></body></html> - Top Left + <html><head/><body><p><span style=" font-size:12pt;">Z</span></p></body></html> - Left + Auto center - Vertex count + <html><head/><body><p>Use P3P or AP3P for three and four points setup. Use EPNP or ITERATIVE for five points setup. Inconsistent configuration will result in undefined behavior.</p></body></html> - Three vertices + Auto center timeout - Four vertices + If no valid pose can be determined after that much time the center pose will be used. - Five vertices + ms - Center + Easy Tracker Settings - Right + Model type: - <html><head/><body><p><span style=" font-size:12pt;">X</span></p></body></html> + Hat three vertices - <html><head/><body><p><span style=" font-size:12pt;">Y</span></p></body></html> + Hat four vertices - <html><head/><body><p><span style=" font-size:12pt;">Z</span></p></body></html> + Hat five vertices - <html><head/><body><p><span style=" font-weight:600;">Easy Tracker<br/>Version 1.0</span></p><p><span style=" font-weight:600;">by Stéphane Lenclud</span></p><p>See <a href="https://github.com/opentrack/opentrack/wiki/Easy-Tracker"><span style=" font-weight:600; text-decoration: underline; color:#9999aa;">documentation on GitHub</span></a></p></body></html> + Clip three vertices - Auto center + Vertices: - <html><head/><body><p>Use P3P or AP3P for three and four points setup. Use EPNP or ITERATIVE for five points setup. Inconsistent configuration will result in undefined behavior.</p></body></html> + Top: - Auto center timeout + Right: - If no valid pose can be determined after that much time the center pose will be used. + Left: - ms + Center: + + + + Top right: + + + + Top left: + + + + Clip top: + + + + Clip middle: + + + + Clip bottom: + + + + <html><head/><body><p><span style=" font-weight:600;">Easy Tracker<br/>Version 1.1</span></p><p><span style=" font-weight:600;">by Stéphane Lenclud</span></p><p>See <a href="https://github.com/opentrack/opentrack/wiki/Easy-Tracker"><span style=" font-weight:600; text-decoration: underline; color:#9999aa;">documentation on GitHub</span></a></p></body></html> diff --git a/tracker-easy/module.cpp b/tracker-easy/module.cpp index 3a9df22b..8fcfeae1 100644 --- a/tracker-easy/module.cpp +++ b/tracker-easy/module.cpp @@ -6,7 +6,7 @@ namespace EasyTracker { - QString Metadata::name() { return tr("Easy Tracker 1.0"); } + QString Metadata::name() { return tr("Easy Tracker 1.1"); } QIcon Metadata::icon() { return QIcon(":/Resources/easy-tracker-logo.png"); } } diff --git a/tracker-easy/settings.h b/tracker-easy/settings.h index b0f14417..4141ebe0 100644 --- a/tracker-easy/settings.h +++ b/tracker-easy/settings.h @@ -30,6 +30,7 @@ namespace EasyTracker { value iCustomModelThree{ b, "iCustomModelThree", true }; value iCustomModelFour{ b, "iCustomModelFour", false }; value iCustomModelFive{ b, "iCustomModelFive", false }; + value iClipModelThree{ b, "iClipModelThree", false }; // Custom model vertices value iVertexTopX{ b, "iVertexTopX", 0 }, iVertexTopY{ b, "iVertexTopY", 0 }, iVertexTopZ{ b, "iVertexTopZ", 0 }; @@ -38,7 +39,10 @@ namespace EasyTracker { value iVertexCenterX{ b, "iVertexCenterX", 0 }, iVertexCenterY{ b, "iVertexCenterY", 0 }, iVertexCenterZ{ b, "iVertexCenterZ", 0 }; value iVertexTopRightX{ b, "iVertexTopRightX", 0 }, iVertexTopRightY{ b, "iVertexTopRightY", 0 }, iVertexTopRightZ{ b, "iVertexTopRightZ", 0 }; value iVertexTopLeftX{ b, "iVertexTopLeftX", 0 }, iVertexTopLeftY{ b, "iVertexTopLeftY", 0 }, iVertexTopLeftZ{ b, "iVertexTopLeftZ", 0 }; - + // Clip model vertices + value iVertexClipTopX{ b, "iVertexClipTopX", 0 }, iVertexClipTopY{ b, "iVertexClipTopY", 0 }, iVertexClipTopZ{ b, "iVertexClipTopZ", 0 }; + value iVertexClipMiddleX{ b, "iVertexClipMiddleX", 0 }, iVertexClipMiddleY{ b, "iVertexClipMiddleY", 0 }, iVertexClipMiddleZ{ b, "iVertexClipMiddleZ", 0 }; + value iVertexClipBottomX{ b, "iVertexClipBottomX", 0 }, iVertexClipBottomY{ b, "iVertexClipBottomY", 0 }, iVertexClipBottomZ{ b, "iVertexClipBottomZ", 0 }; value fov{ b, "camera-fov", 56 }; diff --git a/tracker-easy/tracker-easy-dialog.cpp b/tracker-easy/tracker-easy-dialog.cpp index 4a49e194..b0870b50 100644 --- a/tracker-easy/tracker-easy-dialog.cpp +++ b/tracker-easy/tracker-easy-dialog.cpp @@ -68,6 +68,19 @@ namespace EasyTracker tie_setting(s.iVertexTopLeftY, ui.iSpinVertexTopLeftY); tie_setting(s.iVertexTopLeftZ, ui.iSpinVertexTopLeftZ); + // Clip model + tie_setting(s.iVertexClipTopX, ui.iSpinVertexClipTopX); + tie_setting(s.iVertexClipTopY, ui.iSpinVertexClipTopY); + tie_setting(s.iVertexClipTopZ, ui.iSpinVertexClipTopZ); + + tie_setting(s.iVertexClipMiddleX, ui.iSpinVertexClipMiddleX); + tie_setting(s.iVertexClipMiddleY, ui.iSpinVertexClipMiddleY); + tie_setting(s.iVertexClipMiddleZ, ui.iSpinVertexClipMiddleZ); + + tie_setting(s.iVertexClipBottomX, ui.iSpinVertexClipBottomX); + tie_setting(s.iVertexClipBottomY, ui.iSpinVertexClipBottomY); + tie_setting(s.iVertexClipBottomZ, ui.iSpinVertexClipBottomZ); + tie_setting(s.fov, ui.fov); tie_setting(s.debug, ui.debug); @@ -87,10 +100,12 @@ namespace EasyTracker connect(ui.iRadioButtonCustomModelThree, &QRadioButton::clicked, this, &Dialog::UpdateCustomModelControls); connect(ui.iRadioButtonCustomModelFour, &QRadioButton::clicked, this, &Dialog::UpdateCustomModelControls); connect(ui.iRadioButtonCustomModelFive, &QRadioButton::clicked, this, &Dialog::UpdateCustomModelControls); + connect(ui.iRadioButtonClipModelThree, &QRadioButton::clicked, this, &Dialog::UpdateCustomModelControls); tie_setting(s.iCustomModelThree, ui.iRadioButtonCustomModelThree); tie_setting(s.iCustomModelFour, ui.iRadioButtonCustomModelFour); tie_setting(s.iCustomModelFive, ui.iRadioButtonCustomModelFive); + tie_setting(s.iClipModelThree, ui.iRadioButtonClipModelThree); for (unsigned k = 0; k < cv::SOLVEPNP_MAX_COUNT; k++) @@ -111,20 +126,49 @@ namespace EasyTracker ui.iGroupBoxCenter->hide(); ui.iGroupBoxTopRight->hide(); ui.iGroupBoxTopLeft->hide(); + ui.iGroupBoxTop->show(); + ui.iGroupBoxRight->show(); + ui.iGroupBoxLeft->show(); + ui.iGroupBoxClipTop->hide(); + ui.iGroupBoxClipMiddle->hide(); + ui.iGroupBoxClipBottom->hide(); } else if (ui.iRadioButtonCustomModelFour->isChecked()) { ui.iGroupBoxCenter->show(); ui.iGroupBoxTopRight->hide(); ui.iGroupBoxTopLeft->hide(); + ui.iGroupBoxTop->show(); + ui.iGroupBoxRight->show(); + ui.iGroupBoxLeft->show(); + ui.iGroupBoxClipTop->hide(); + ui.iGroupBoxClipMiddle->hide(); + ui.iGroupBoxClipBottom->hide(); } else if (ui.iRadioButtonCustomModelFive->isChecked()) { ui.iGroupBoxCenter->hide(); ui.iGroupBoxTopRight->show(); ui.iGroupBoxTopLeft->show(); + ui.iGroupBoxTop->show(); + ui.iGroupBoxRight->show(); + ui.iGroupBoxLeft->show(); + ui.iGroupBoxClipTop->hide(); + ui.iGroupBoxClipMiddle->hide(); + ui.iGroupBoxClipBottom->hide(); + } + else if (ui.iRadioButtonClipModelThree->isChecked()) + { + ui.iGroupBoxTop->hide(); + ui.iGroupBoxRight->hide(); + ui.iGroupBoxLeft->hide(); + ui.iGroupBoxCenter->hide(); + ui.iGroupBoxTopRight->hide(); + ui.iGroupBoxTopLeft->hide(); + ui.iGroupBoxClipTop->show(); + ui.iGroupBoxClipMiddle->show(); + ui.iGroupBoxClipBottom->show(); } - } diff --git a/tracker-easy/tracker-easy-settings.ui b/tracker-easy/tracker-easy-settings.ui index 451b3e54..d6cc86b6 100644 --- a/tracker-easy/tracker-easy-settings.ui +++ b/tracker-easy/tracker-easy-settings.ui @@ -9,8 +9,8 @@ 0 0 - 465 - 764 + 328 + 923 @@ -20,7 +20,7 @@ - PointTracker Settings + Easy Tracker Settings @@ -32,24 +32,8 @@ false - - - QLayout::SetFixedSize - - - - - - 0 - 0 - - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - + + @@ -61,7 +45,7 @@ - 0 + 2 @@ -548,13 +532,13 @@ - Vertex count + Model type: - + - Three vertices + Hat three vertices true @@ -564,14 +548,21 @@ - Four vertices + Hat four vertices - Five vertices + Hat five vertices + + + + + + + Clip three vertices @@ -581,7 +572,7 @@ - + Vertices: false @@ -614,7 +605,7 @@ - Top + Top: @@ -665,7 +656,7 @@ - Right + Right: @@ -713,7 +704,7 @@ - Left + Left: @@ -761,7 +752,7 @@ - Center + Center: @@ -809,7 +800,7 @@ - Top Right + Top right: @@ -857,7 +848,7 @@ - Top Left + Top left: @@ -902,6 +893,159 @@ + + + + Clip top: + + + + 9 + + + + + mm + + + -65535 + + + 65535 + + + + + + + mm + + + -65535 + + + 65535 + + + + + + + mm + + + -65535 + + + 65535 + + + + + + + + + + Clip middle: + + + + 9 + + + + + mm + + + -65535 + + + 65535 + + + + + + + mm + + + -65535 + + + 65535 + + + + + + + mm + + + -65535 + + + 65535 + + + + + + + + + + Clip bottom: + + + + 9 + + + + + mm + + + -65535 + + + 65535 + + + + + + + mm + + + -65535 + + + 65535 + + + + + + + mm + + + -65535 + + + 65535 + + + + + + @@ -912,7 +1056,7 @@ - <html><head/><body><p><span style=" font-weight:600;">Easy Tracker<br/>Version 1.0</span></p><p><span style=" font-weight:600;">by Stéphane Lenclud</span></p><p>See <a href="https://github.com/opentrack/opentrack/wiki/Easy-Tracker"><span style=" font-weight:600; text-decoration: underline; color:#9999aa;">documentation on GitHub</span></a></p></body></html> + <html><head/><body><p><span style=" font-weight:600;">Easy Tracker<br/>Version 1.1</span></p><p><span style=" font-weight:600;">by Stéphane Lenclud</span></p><p>See <a href="https://github.com/opentrack/opentrack/wiki/Easy-Tracker"><span style=" font-weight:600; text-decoration: underline; color:#9999aa;">documentation on GitHub</span></a></p></body></html> Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop @@ -939,10 +1083,22 @@ + + + + + 0 + 0 + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + - tabWidget camdevice_combo res_x_spin res_y_spin diff --git a/tracker-easy/tracker-easy.cpp b/tracker-easy/tracker-easy.cpp index 85b04026..0487d031 100644 --- a/tracker-easy/tracker-easy.cpp +++ b/tracker-easy/tracker-easy.cpp @@ -170,10 +170,15 @@ namespace EasyTracker { MatchFiveVertices(aTopIndex, aRightIndex, aLeftIndex, aTopRight, aTopLeft); } - else + else if (!iSettings.iClipModelThree) { MatchThreeOrFourVertices(aTopIndex, aRightIndex, aLeftIndex, aCenterIndex); } + else + { + // Clip model + MatchClipVertices(aTopIndex, aRightIndex, aLeftIndex); + } } @@ -342,7 +347,56 @@ namespace EasyTracker } } - + /** + */ + void Tracker::MatchClipVertices(int& aTopIndex, int& aMiddleIndex, int& aBottomIndex) + { + //Bitmap origin is top left + iTrackedPoints.clear(); + // 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 < (int)iPoints.size(); i++) + { + if (iPoints[i].y < minY) + { + minY = iPoints[i].y; + aTopIndex = i; + } + } + + + int maxY = 0; + + // Find bottom most point + for (int i = 0; i < (int)iPoints.size(); i++) + { + // Excluding top most point + if (i != aTopIndex && iPoints[i].y > maxY) + { + maxY = iPoints[i].y; + aBottomIndex = i; + } + } + + + // Find center point, the last one + for (int i = 0; i < (int)iPoints.size(); i++) + { + // Excluding the three points we already have + if (i != aTopIndex && i != aBottomIndex) + { + aMiddleIndex = i; + } + } + + // Order matters + iTrackedPoints.push_back(iPoints[aTopIndex]); + iTrackedPoints.push_back(iPoints[aMiddleIndex]); + iTrackedPoints.push_back(iPoints[aBottomIndex]); + } + + /// /// @@ -725,18 +779,29 @@ namespace EasyTracker // We are converting them from millimeters to centimeters. // TODO: Need to support clip too. That's cap only for now. iModel.clear(); - iModel.push_back(cv::Point3f(iSettings.iVertexTopX / 10.0, iSettings.iVertexTopY / 10.0, iSettings.iVertexTopZ / 10.0)); // Top - iModel.push_back(cv::Point3f(iSettings.iVertexRightX / 10.0, iSettings.iVertexRightY / 10.0, iSettings.iVertexRightZ / 10.0)); // Right - iModel.push_back(cv::Point3f(iSettings.iVertexLeftX / 10.0, iSettings.iVertexLeftY / 10.0, iSettings.iVertexLeftZ / 10.0)); // Left - if (iSettings.iCustomModelFour) + if (!iSettings.iClipModelThree) { - iModel.push_back(cv::Point3f(iSettings.iVertexCenterX / 10.0, iSettings.iVertexCenterY / 10.0, iSettings.iVertexCenterZ / 10.0)); // Center + iModel.push_back(cv::Point3f(iSettings.iVertexTopX / 10.0, iSettings.iVertexTopY / 10.0, iSettings.iVertexTopZ / 10.0)); // Top + iModel.push_back(cv::Point3f(iSettings.iVertexRightX / 10.0, iSettings.iVertexRightY / 10.0, iSettings.iVertexRightZ / 10.0)); // Right + iModel.push_back(cv::Point3f(iSettings.iVertexLeftX / 10.0, iSettings.iVertexLeftY / 10.0, iSettings.iVertexLeftZ / 10.0)); // Left + + if (iSettings.iCustomModelFour) + { + iModel.push_back(cv::Point3f(iSettings.iVertexCenterX / 10.0, iSettings.iVertexCenterY / 10.0, iSettings.iVertexCenterZ / 10.0)); // Center + } + else if (iSettings.iCustomModelFive) + { + iModel.push_back(cv::Point3f(iSettings.iVertexTopRightX / 10.0, iSettings.iVertexTopRightY / 10.0, iSettings.iVertexTopRightZ / 10.0)); // Top Right + iModel.push_back(cv::Point3f(iSettings.iVertexTopLeftX / 10.0, iSettings.iVertexTopLeftY / 10.0, iSettings.iVertexTopLeftZ / 10.0)); // Top Left + } } - else if (iSettings.iCustomModelFive) + else { - iModel.push_back(cv::Point3f(iSettings.iVertexTopRightX / 10.0, iSettings.iVertexTopRightY / 10.0, iSettings.iVertexTopRightZ / 10.0)); // Top Right - iModel.push_back(cv::Point3f(iSettings.iVertexTopLeftX / 10.0, iSettings.iVertexTopLeftY / 10.0, iSettings.iVertexTopLeftZ / 10.0)); // Top Left + // Clip model type + iModel.push_back(cv::Point3f(iSettings.iVertexClipTopX / 10.0, iSettings.iVertexClipTopY / 10.0, iSettings.iVertexClipTopZ / 10.0)); // Top + iModel.push_back(cv::Point3f(iSettings.iVertexClipMiddleX / 10.0, iSettings.iVertexClipMiddleY / 10.0, iSettings.iVertexClipMiddleZ / 10.0)); // Middle + iModel.push_back(cv::Point3f(iSettings.iVertexClipBottomX / 10.0, iSettings.iVertexClipBottomY / 10.0, iSettings.iVertexClipBottomZ / 10.0)); // Bottom } infout << "Update model - end"; diff --git a/tracker-easy/tracker-easy.h b/tracker-easy/tracker-easy.h index 0b51f9c7..4510fc7d 100644 --- a/tracker-easy/tracker-easy.h +++ b/tracker-easy/tracker-easy.h @@ -77,6 +77,7 @@ namespace EasyTracker void MatchVertices(int& aTopIndex, int& aRightIndex, int& aLeftIndex, int& aCenterIndex, int& aTopRight, int& aTopLeft); void MatchThreeOrFourVertices(int& aTopIndex, int& aRightIndex, int& aLeftIndex, int& aCenterIndex); void MatchFiveVertices(int& aTopIndex, int& aRightIndex, int& aLeftIndex, int& aTopRight, int& aTopLeft); + void MatchClipVertices(int& aTopIndex, int& aMiddleIndex, int& aBottomIndex); // -- cgit v1.2.3