From fc03209f0819e2d247f0b24ed02842fc5505ef73 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 1 Jun 2015 17:10:06 +0200 Subject: pt, aruco, ht: select camera by name, not index --- ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 4 ++-- ftnoir_tracker_aruco/ftnoir_tracker_aruco.h | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'ftnoir_tracker_aruco') 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 fov, headpos_x, headpos_y, headpos_z; - value camera_index, force_fps, resolution; + value camera_name; + value 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) {} -- cgit v1.2.3