From e52e28acc24242f87703d2ff825cfd719918e33c Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 9 Apr 2013 11:29:44 +0200 Subject: New HT --- ftnoir_tracker_ht/ftnoir_tracker_ht.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'ftnoir_tracker_ht') diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp index c5e860ee..f91cb555 100644 --- a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp +++ b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp @@ -109,18 +109,18 @@ static void load_settings(ht_config_t* config, Tracker* tracker) config->field_of_view = iniFile.value("fov", 52).toFloat(); config->pyrlk_pyramids = 3; config->pyrlk_win_size_w = config->pyrlk_win_size_h = 21; - config->max_keypoints = 100; - config->keypoint_quality = 7; + config->max_keypoints = 150; + config->keypoint_quality = 2; config->keypoint_distance = 1.5; - config->keypoint_3distance = 5.0; + config->keypoint_3distance = 5.5; //config->force_width = 640; //config->force_height = 480; config->force_fps = iniFile.value("fps", 0).toInt(); config->camera_index = iniFile.value("camera-index", -1).toInt(); config->ransac_num_iters = 100; - config->ransac_max_reprojection_error = 3.75; - config->ransac_max_inlier_error = 3.8; - config->ransac_max_mean_error = 4; + config->ransac_max_reprojection_error = 3.7; + config->ransac_max_inlier_error = 4; + config->ransac_max_mean_error = 3.6; config->ransac_abs_max_mean_error = 10; config->debug = 0; config->ransac_min_features = 0.85; -- cgit v1.2.3 From 002f3345e9ac8c1364f9f16efe0a1995e6d151a1 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Wed, 10 Apr 2013 00:56:59 +0200 Subject: new coefficients for fixed HT --- bin/tracker-ht/headtracker-ftnoir.exe | Bin 4485632 -> 4487168 bytes ftnoir_tracker_ht/ftnoir_tracker_ht.cpp | 14 +++++++------- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'ftnoir_tracker_ht') diff --git a/bin/tracker-ht/headtracker-ftnoir.exe b/bin/tracker-ht/headtracker-ftnoir.exe index a7e20dec..f69b48b5 100644 Binary files a/bin/tracker-ht/headtracker-ftnoir.exe and b/bin/tracker-ht/headtracker-ftnoir.exe differ diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp index f91cb555..a6623619 100644 --- a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp +++ b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp @@ -109,19 +109,19 @@ static void load_settings(ht_config_t* config, Tracker* tracker) config->field_of_view = iniFile.value("fov", 52).toFloat(); config->pyrlk_pyramids = 3; config->pyrlk_win_size_w = config->pyrlk_win_size_h = 21; - config->max_keypoints = 150; - config->keypoint_quality = 2; + config->max_keypoints = 100; + config->keypoint_quality = 5; config->keypoint_distance = 1.5; - config->keypoint_3distance = 5.5; + config->keypoint_3distance = 7; //config->force_width = 640; //config->force_height = 480; config->force_fps = iniFile.value("fps", 0).toInt(); config->camera_index = iniFile.value("camera-index", -1).toInt(); config->ransac_num_iters = 100; - config->ransac_max_reprojection_error = 3.7; - config->ransac_max_inlier_error = 4; - config->ransac_max_mean_error = 3.6; - config->ransac_abs_max_mean_error = 10; + config->ransac_max_reprojection_error = 3.9; + config->ransac_max_inlier_error = 3.8; + config->ransac_max_mean_error = 3.7; + config->ransac_abs_max_mean_error = 9; config->debug = 0; config->ransac_min_features = 0.85; int res = iniFile.value("resolution", 0).toInt(); -- cgit v1.2.3 From 4c0a25afd17900a21f9d9b62508cba7f821422f3 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Wed, 10 Apr 2013 03:12:08 +0200 Subject: Externalize classification delay in milliseconds --- bin/tracker-ht/headtracker-ftnoir.exe | Bin 4487168 -> 4482560 bytes ftnoir_tracker_ht/ftnoir_tracker_ht.cpp | 29 +-- ftnoir_tracker_ht/ht-api.h | 1 + ftnoir_tracker_ht/ht-trackercontrols.ui | 308 +------------------------------- 4 files changed, 25 insertions(+), 313 deletions(-) (limited to 'ftnoir_tracker_ht') diff --git a/bin/tracker-ht/headtracker-ftnoir.exe b/bin/tracker-ht/headtracker-ftnoir.exe index f69b48b5..c1d9d3a7 100644 Binary files a/bin/tracker-ht/headtracker-ftnoir.exe and b/bin/tracker-ht/headtracker-ftnoir.exe differ diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp index a6623619..4ea8180c 100644 --- a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp +++ b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp @@ -109,28 +109,30 @@ static void load_settings(ht_config_t* config, Tracker* tracker) config->field_of_view = iniFile.value("fov", 52).toFloat(); config->pyrlk_pyramids = 3; config->pyrlk_win_size_w = config->pyrlk_win_size_h = 21; - config->max_keypoints = 100; - config->keypoint_quality = 5; - config->keypoint_distance = 1.5; - config->keypoint_3distance = 7; + config->max_keypoints = 200; + config->keypoint_quality = 11; + config->keypoint_distance = 1; + config->keypoint_3distance = 4; //config->force_width = 640; //config->force_height = 480; config->force_fps = iniFile.value("fps", 0).toInt(); config->camera_index = iniFile.value("camera-index", -1).toInt(); config->ransac_num_iters = 100; - config->ransac_max_reprojection_error = 3.9; - config->ransac_max_inlier_error = 3.8; - config->ransac_max_mean_error = 3.7; + config->ransac_max_reprojection_error = 3.1; + config->ransac_max_inlier_error = 3.6; + config->ransac_max_mean_error = 3.8; config->ransac_abs_max_mean_error = 9; - config->debug = 0; - config->ransac_min_features = 0.85; + config->debug = 1; + config->ransac_min_features = 0.82; int res = iniFile.value("resolution", 0).toInt(); if (res < 0 || res >= (int)(sizeof(*resolution_choices) / sizeof(resolution_tuple))) res = 0; resolution_tuple r = resolution_choices[res]; config->force_width = r.width; config->force_height = r.height; - config->user_landmarks = iniFile.value("use-bashed-coords").toBool(); + config->user_landmarks = false; //iniFile.value("use-bashed-coords").toBool(); + config->flandmark_delay = 200; +#if 0 if (config->user_landmarks) { config->user_landmark_locations[0][0] = iniFile.value("b1").toDouble(); @@ -146,6 +148,7 @@ static void load_settings(ht_config_t* config, Tracker* tracker) config->user_landmark_locations[1][3] = iniFile.value("b11").toDouble(); config->user_landmark_locations[2][3] = iniFile.value("b12").toDouble(); } +#endif qDebug() << "width" << r.width << "height" << r.height; if (tracker) { @@ -330,7 +333,7 @@ TrackerControls::TrackerControls() connect(ui.tz, SIGNAL(stateChanged(int)), this, SLOT(settingChanged(int))); connect(ui.buttonCancel, SIGNAL(clicked()), this, SLOT(doCancel())); connect(ui.buttonOK, SIGNAL(clicked()), this, SLOT(doOK())); - connect(ui.buttonSettings, SIGNAL(clicked()), this, SLOT(cameraSettings())); + //connect(ui.buttonSettings, SIGNAL(clicked()), this, SLOT(cameraSettings())); loadSettings(); settingsDirty = false; } @@ -386,6 +389,7 @@ void TrackerControls::loadSettings() ui.ty->setCheckState(iniFile.value("enable-ty", true).toBool() ? Qt::Checked : Qt::Unchecked); ui.tz->setCheckState(iniFile.value("enable-tz", true).toBool() ? Qt::Checked : Qt::Unchecked); ui.resolution->setCurrentIndex(iniFile.value("resolution", 0).toInt()); +#if 0 ui.groupBox_2->setChecked(iniFile.value("use-bashed-coords").toBool()); ui.doubleSpinBox_1->setValue(iniFile.value("b1", 0).toDouble()); ui.doubleSpinBox_2->setValue(iniFile.value("b2", 0).toDouble()); @@ -399,6 +403,7 @@ void TrackerControls::loadSettings() ui.doubleSpinBox_10->setValue(iniFile.value("b10", 0).toDouble()); ui.doubleSpinBox_11->setValue(iniFile.value("b11", 0).toDouble()); ui.doubleSpinBox_12->setValue(iniFile.value("b12", 0).toDouble()); +#endif iniFile.endGroup(); settingsDirty = false; } @@ -437,6 +442,7 @@ void TrackerControls::save() iniFile.setValue("enable-ty", ui.ty->checkState() != Qt::Unchecked ? true : false); iniFile.setValue("enable-tz", ui.tz->checkState() != Qt::Unchecked ? true : false); iniFile.setValue("resolution", ui.resolution->currentIndex()); +#if 0 iniFile.setValue("b1", ui.doubleSpinBox_1->value()); iniFile.setValue("b2", ui.doubleSpinBox_2->value()); iniFile.setValue("b3", ui.doubleSpinBox_3->value()); @@ -450,6 +456,7 @@ void TrackerControls::save() iniFile.setValue("b11", ui.doubleSpinBox_11->value()); iniFile.setValue("b12", ui.doubleSpinBox_12->value()); iniFile.setValue("use-bashed-coords", ui.groupBox_2->isChecked()); +#endif iniFile.endGroup(); settingsDirty = false; } diff --git a/ftnoir_tracker_ht/ht-api.h b/ftnoir_tracker_ht/ht-api.h index 81caf16f..c09dbf55 100644 --- a/ftnoir_tracker_ht/ht-api.h +++ b/ftnoir_tracker_ht/ht-api.h @@ -41,6 +41,7 @@ typedef struct ht_config { float ransac_abs_max_mean_error; bool user_landmarks; float user_landmark_locations[3][4]; + float flandmark_delay; } ht_config_t; typedef struct { diff --git a/ftnoir_tracker_ht/ht-trackercontrols.ui b/ftnoir_tracker_ht/ht-trackercontrols.ui index 968b7dc7..5f414fc2 100644 --- a/ftnoir_tracker_ht/ht-trackercontrols.ui +++ b/ftnoir_tracker_ht/ht-trackercontrols.ui @@ -9,8 +9,8 @@ 0 0 - 724 - 160 + 549 + 131 @@ -122,8 +122,8 @@ - 220 - 130 + 390 + 100 75 23 @@ -135,8 +135,8 @@ - 300 - 130 + 470 + 100 75 23 @@ -289,302 +289,6 @@ - - - - 500 - 10 - 221 - 141 - - - - Bashed coordinates - - - true - - - false - - - - - 10 - 20 - 61 - 22 - - - - true - - - QAbstractSpinBox::NoButtons - - - 5 - - - -99.000000000000000 - - - - - - 80 - 20 - 61 - 22 - - - - true - - - QAbstractSpinBox::NoButtons - - - 5 - - - -99.000000000000000 - - - - - - 150 - 20 - 61 - 22 - - - - true - - - QAbstractSpinBox::NoButtons - - - 5 - - - -99.000000000000000 - - - - - - 150 - 50 - 61 - 22 - - - - true - - - QAbstractSpinBox::NoButtons - - - 5 - - - -99.000000000000000 - - - - - - 10 - 50 - 61 - 22 - - - - true - - - QAbstractSpinBox::NoButtons - - - 5 - - - -99.000000000000000 - - - - - - 80 - 50 - 61 - 22 - - - - true - - - QAbstractSpinBox::NoButtons - - - 5 - - - -99.000000000000000 - - - - - - 150 - 80 - 61 - 22 - - - - true - - - QAbstractSpinBox::NoButtons - - - 5 - - - -99.000000000000000 - - - - - - 10 - 80 - 61 - 22 - - - - true - - - QAbstractSpinBox::NoButtons - - - 5 - - - -99.000000000000000 - - - - - - 80 - 80 - 61 - 22 - - - - true - - - QAbstractSpinBox::NoButtons - - - 5 - - - -99.000000000000000 - - - - - - 150 - 110 - 61 - 22 - - - - true - - - QAbstractSpinBox::NoButtons - - - 5 - - - -99.000000000000000 - - - - - - 80 - 110 - 61 - 22 - - - - true - - - QAbstractSpinBox::NoButtons - - - 5 - - - -99.000000000000000 - - - - - - 10 - 110 - 61 - 22 - - - - true - - - QAbstractSpinBox::NoButtons - - - 5 - - - -99.000000000000000 - - - - - - - 10 - 130 - 101 - 23 - - - - Camera settings - - -- cgit v1.2.3 From 79f3cabf4639be401ae79ca73f58fdec84e5e2e0 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 11 Apr 2013 18:27:04 +0200 Subject: Adjust coefficients --- ftnoir_tracker_ht/ftnoir_tracker_ht.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'ftnoir_tracker_ht') diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp index 4ea8180c..4f7d68f0 100644 --- a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp +++ b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp @@ -110,20 +110,20 @@ static void load_settings(ht_config_t* config, Tracker* tracker) config->pyrlk_pyramids = 3; config->pyrlk_win_size_w = config->pyrlk_win_size_h = 21; config->max_keypoints = 200; - config->keypoint_quality = 11; - config->keypoint_distance = 1; - config->keypoint_3distance = 4; + config->keypoint_quality = 2; + config->keypoint_distance = 1.5; + config->keypoint_3distance = 5; //config->force_width = 640; //config->force_height = 480; config->force_fps = iniFile.value("fps", 0).toInt(); config->camera_index = iniFile.value("camera-index", -1).toInt(); config->ransac_num_iters = 100; - config->ransac_max_reprojection_error = 3.1; - config->ransac_max_inlier_error = 3.6; - config->ransac_max_mean_error = 3.8; - config->ransac_abs_max_mean_error = 9; + config->ransac_max_reprojection_error = 3.05; + config->ransac_max_inlier_error = 3.14; + config->ransac_max_mean_error = 3; + config->ransac_abs_max_mean_error = 12; config->debug = 1; - config->ransac_min_features = 0.82; + config->ransac_min_features = 0.86; int res = iniFile.value("resolution", 0).toInt(); if (res < 0 || res >= (int)(sizeof(*resolution_choices) / sizeof(resolution_tuple))) res = 0; @@ -131,7 +131,7 @@ static void load_settings(ht_config_t* config, Tracker* tracker) config->force_width = r.width; config->force_height = r.height; config->user_landmarks = false; //iniFile.value("use-bashed-coords").toBool(); - config->flandmark_delay = 200; + config->flandmark_delay = 150; #if 0 if (config->user_landmarks) { -- cgit v1.2.3 From b98f07d984dff6718d7184ed1bf68709f4dae348 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 12 Apr 2013 11:40:43 +0200 Subject: reduce CPU usage during tracking --- facetracknoir/tracker.cpp | 13 ++++++------- ftnoir_tracker_ht/ftnoir_tracker_ht.cpp | 1 + ftnoir_tracker_pt/camera.cpp | 4 ++-- ftnoir_tracker_pt/ftnoir_tracker_pt.cpp | 15 +++++++-------- qfunctionconfigurator/functionconfig.h | 2 +- 5 files changed, 17 insertions(+), 18 deletions(-) (limited to 'ftnoir_tracker_ht') diff --git a/facetracknoir/tracker.cpp b/facetracknoir/tracker.cpp index 15b36f69..f624d6a1 100644 --- a/facetracknoir/tracker.cpp +++ b/facetracknoir/tracker.cpp @@ -143,15 +143,14 @@ void Tracker::run() { bool bTracker2Confid = false; THeadPoseData last; + THeadPoseData newpose; + THeadPoseData last_post_filter; forever { if (should_quit) break; - // Check event for stop thread - - THeadPoseData newpose; newpose.pitch = 0.0f; newpose.roll = 0.0f; newpose.yaw = 0.0f; @@ -199,7 +198,7 @@ void Tracker::run() { // // Only copy valid values // - if (Tracker::confid) { + if (confid) { offset_camera.x = GlobalPose->X.headPos; offset_camera.y = GlobalPose->Y.headPos; offset_camera.z = GlobalPose->Z.headPos; @@ -222,7 +221,7 @@ void Tracker::run() { do_game_zero = false; } - if (Tracker::do_tracking && Tracker::confid) { + if (do_tracking && confid) { // get values target_camera.x = GlobalPose->X.headPos; target_camera.y = GlobalPose->Y.headPos; @@ -238,7 +237,7 @@ void Tracker::run() { // Use advanced filtering, when a filter was selected. // if (Libraries->pFilter) { - THeadPoseData last_post_filter = gameoutput_camera; + last_post_filter = gameoutput_camera; Libraries->pFilter->FilterHeadPoseData(¤t_camera, &target_camera, &new_camera, &last_post_filter, newp); } else { @@ -261,7 +260,7 @@ void Tracker::run() { // // Reverse Axis. // - if (Tracker::do_axis_reverse) { + if (do_axis_reverse) { output_camera.z = Z_PosWhenReverseAxis; // Set the desired Z-position } diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp index 4f7d68f0..33b4c944 100644 --- a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp +++ b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp @@ -228,6 +228,7 @@ bool Tracker::GiveHeadPoseData(THeadPoseData* data) videoWidget->updateImage(shm->frame.frame, shm->frame.width, shm->frame.height); //memcpy(foo, shm->frame.frame, shm->frame.width * shm->frame.height * 3); fresh = true; + shm->frame.width = 0; } if (shm->result.filled) { if (enableRX) diff --git a/ftnoir_tracker_pt/camera.cpp b/ftnoir_tracker_pt/camera.cpp index 96ba3b89..90fcfaaf 100644 --- a/ftnoir_tracker_pt/camera.cpp +++ b/ftnoir_tracker_pt/camera.cpp @@ -92,8 +92,8 @@ bool CVCamera::_get_frame(Mat* frame) { Mat tmp; bool ret = cap->read(tmp); - if (ret) - flip(tmp, *frame, 0); + //if (ret) + // flip(tmp, *frame, 0); return ret; } diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp index b4cb613b..96017d52 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp @@ -66,7 +66,6 @@ void Tracker::run() { { - refreshVideo(); QMutexLocker lock(&mutex); if (should_quit) break; @@ -84,14 +83,16 @@ void Tracker::run() const std::vector& points = point_extractor.extract_points(frame, dt, draw_frame); tracking_valid = point_tracker.track(points, camera.get_info().f, dt); frame_count++; + fresh = true; } #ifdef PT_PERF_LOG log_stream<<"dt: "< > points; { - QMutexLocker lock(&mutex); +//QMutexLocker lock(&mutex); if (!draw_frame || frame.empty()) return; // copy the frame and points from the tracker thread @@ -157,8 +158,7 @@ void Tracker::refreshVideo() } video_widget->update_image(frame_copy, points); - fresh = true; - } + } } void Tracker::StartTracker(QFrame* videoframe) @@ -194,7 +194,6 @@ void Tracker::paint_widget() { bool Tracker::GiveHeadPoseData(THeadPoseData *data) { - refreshVideo(); const float rad2deg = 180.0/3.14159265; const float deg2rad = 1.0/rad2deg; { @@ -245,7 +244,7 @@ bool Tracker::GiveHeadPoseData(THeadPoseData *data) data->yaw = rad2deg * alpha; } if (bEnablePitch) { - data->pitch = -rad2deg * beta; + data->pitch = rad2deg * beta; } if (bEnableRoll) { data->roll = rad2deg * gamma; diff --git a/qfunctionconfigurator/functionconfig.h b/qfunctionconfigurator/functionconfig.h index d81711a7..9f380000 100644 --- a/qfunctionconfigurator/functionconfig.h +++ b/qfunctionconfigurator/functionconfig.h @@ -28,7 +28,7 @@ private: QString _title; float getValueInternal(int x); QPointF lastValueTracked; // The last input value requested by the Tracker, with it's output-value. - bool _tracking_active; + volatile bool _tracking_active; int _max_Input; int _max_Output; -- cgit v1.2.3 From 4ff08e52cc4d10491d7676ece8c52792e9e89d82 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 12 Apr 2013 11:49:30 +0200 Subject: Track more features to be robust in poor lighting --- ftnoir_tracker_ht/ftnoir_tracker_ht.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ftnoir_tracker_ht') diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp index 33b4c944..59af6991 100644 --- a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp +++ b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp @@ -111,8 +111,8 @@ static void load_settings(ht_config_t* config, Tracker* tracker) config->pyrlk_win_size_w = config->pyrlk_win_size_h = 21; config->max_keypoints = 200; config->keypoint_quality = 2; - config->keypoint_distance = 1.5; - config->keypoint_3distance = 5; + config->keypoint_distance = 1; + config->keypoint_3distance = 4; //config->force_width = 640; //config->force_height = 480; config->force_fps = iniFile.value("fps", 0).toInt(); -- cgit v1.2.3