diff options
-rw-r--r-- | ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 4 | ||||
-rw-r--r-- | ftnoir_tracker_aruco/ftnoir_tracker_aruco.h | 5 | ||||
-rw-r--r-- | ftnoir_tracker_ht/ftnoir_tracker_ht.cpp | 4 | ||||
-rw-r--r-- | ftnoir_tracker_ht/ftnoir_tracker_ht.h | 5 | ||||
-rw-r--r-- | ftnoir_tracker_pt/ftnoir_tracker_pt.cpp | 3 | ||||
-rw-r--r-- | ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp | 2 | ||||
-rw-r--r-- | ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h | 6 |
7 files changed, 16 insertions, 13 deletions
diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index a6394b71..34bffa0a 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -97,7 +97,7 @@ void Tracker::run() fps = 200; break; } - camera = cv::VideoCapture(s.camera_index); + camera = cv::VideoCapture(camera_name_to_index(s.camera_name)); if (res.width) { camera.set(CV_CAP_PROP_FRAME_WIDTH, res.width); @@ -375,7 +375,7 @@ TrackerControls::TrackerControls() ui.setupUi(this); setAttribute(Qt::WA_NativeWindow, true); ui.cameraName->addItems(get_camera_names()); - tie_setting(s.camera_index, ui.cameraName); + tie_setting(s.camera_name, ui.cameraName); tie_setting(s.resolution, ui.resolution); tie_setting(s.force_fps, ui.cameraFPS); tie_setting(s.fov, ui.cameraFOV); diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h index 0cb8fd8f..875a9d41 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h @@ -26,14 +26,15 @@ using namespace options; struct settings : opts { value<double> fov, headpos_x, headpos_y, headpos_z; - value<int> camera_index, force_fps, resolution; + value<QString> camera_name; + value<int> force_fps, resolution; settings() : opts("aruco-tracker"), fov(b, "field-of-view", 56), headpos_x(b, "headpos-x", 0), headpos_y(b, "headpos-y", 0), headpos_z(b, "headpos-z", 0), - camera_index(b, "camera-index", 0), + camera_name(b, "camera-name", ""), force_fps(b, "force-fps", 0), resolution(b, "force-resolution", 0) {} diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp index bd5595e1..b922c0b2 100644 --- a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp +++ b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp @@ -49,7 +49,7 @@ void Tracker::load_settings(ht_config_t* config) config->max_keypoints = 150; config->keypoint_distance = 3.5; config->force_fps = nframes; - config->camera_index = s.camera_idx - 1; + config->camera_index = camera_name_to_index(s.camera_name); config->ransac_num_iters = 100; config->ransac_max_reprojection_error = 10; config->ransac_max_inlier_error = 10; @@ -164,7 +164,7 @@ TrackerControls::TrackerControls() QList<QString> names = get_camera_names(); names.prepend("Any available"); ui.cameraName->addItems(names); - tie_setting(s.camera_idx, ui.cameraName); + tie_setting(s.camera_name, ui.cameraName); tie_setting(s.fps, ui.cameraFPS); tie_setting(s.fov, ui.cameraFOV); tie_setting(s.resolution, ui.resolution); diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht.h b/ftnoir_tracker_ht/ftnoir_tracker_ht.h index ce264b8c..cd4ffa16 100644 --- a/ftnoir_tracker_ht/ftnoir_tracker_ht.h +++ b/ftnoir_tracker_ht/ftnoir_tracker_ht.h @@ -20,12 +20,13 @@ using namespace options; struct settings : opts { value<double> fov; - value<int> fps, camera_idx, resolution; + value<QString> camera_name; + value<int> fps, resolution; settings() : opts("HT-Tracker"), fov(b, "fov", 56), + camera_name(b, "camera-name", ""), fps(b, "fps", 0), - camera_idx(b, "camera-index", 0), resolution(b, "resolution", 0) {} }; diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp index acf4daa0..b14d803a 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp @@ -6,6 +6,7 @@ */ #include "ftnoir_tracker_pt.h" +#include "opentrack/camera-names.hpp" #include <QHBoxLayout> #include <cmath> #include <QDebug> @@ -129,7 +130,7 @@ void Tracker::apply_settings() { qDebug()<<"Tracker:: Applying settings"; QMutexLocker lock(&mutex); - camera.set_device_index(s.cam_index); + camera.set_device_index(camera_name_to_index(s.camera_name)); camera.set_res(s.cam_res_x, s.cam_res_y); camera.set_fps(s.cam_fps); qDebug()<<"Tracker::apply ends"; diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp b/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp index 3486f234..6fa149ed 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp @@ -39,7 +39,7 @@ TrackerDialog::TrackerDialog() } #endif - tie_setting(s.cam_index, ui.camdevice_combo); + tie_setting(s.camera_name, ui.camdevice_combo); tie_setting(s.cam_res_x, ui.res_x_spin); tie_setting(s.cam_res_y, ui.res_y_spin); tie_setting(s.cam_fps, ui.fps_spin); diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h b/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h index 20ede0dd..fba755bd 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h @@ -15,8 +15,8 @@ using namespace options; struct settings : opts { - value<int> cam_index, - cam_res_x, + value<QString> camera_name; + value<int> cam_res_x, cam_res_y, cam_fps, threshold, @@ -38,7 +38,7 @@ struct settings : opts settings() : opts("tracker-pt"), - cam_index(b, "camera-index", 0), + camera_name(b, "camera-name", ""), cam_res_x(b, "camera-res-width", 640), cam_res_y(b, "camera-res-height", 480), cam_fps(b, "camera-fps", 30), |