diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2013-01-29 21:51:02 +0000 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2013-01-29 21:51:02 +0000 |
commit | e3c532a6c542d3ec956544902dade2a919d30be0 (patch) | |
tree | 3a4c9127b1926094cd5bba32bcc82d022f275c64 | |
parent | 0d9a02b99b0ee5f2a9805fbd929d19e4b32dff98 (diff) |
Add the ability to change camera resolution in a dropdown menu
git-svn-id: svn+ssh://svn.code.sf.net/p/facetracknoir/code@254 19e81ba0-9b1a-49c3-bd6c-561e1906d5fb
-rw-r--r-- | FTNoIR_Tracker_HT/TrackerControls.ui | 51 | ||||
-rw-r--r-- | FTNoIR_Tracker_HT/ftnoir_tracker_ht.cpp | 32 |
2 files changed, 73 insertions, 10 deletions
diff --git a/FTNoIR_Tracker_HT/TrackerControls.ui b/FTNoIR_Tracker_HT/TrackerControls.ui index 23ae4cad..0a1bc3ae 100644 --- a/FTNoIR_Tracker_HT/TrackerControls.ui +++ b/FTNoIR_Tracker_HT/TrackerControls.ui @@ -10,7 +10,7 @@ <x>0</x> <y>0</y> <width>500</width> - <height>127</height> + <height>160</height> </rect> </property> <property name="sizePolicy"> @@ -22,7 +22,7 @@ <property name="maximumSize"> <size> <width>500</width> - <height>127</height> + <height>160</height> </size> </property> <property name="windowTitle"> @@ -123,7 +123,7 @@ <property name="geometry"> <rect> <x>340</x> - <y>100</y> + <y>130</y> <width>75</width> <height>23</height> </rect> @@ -136,7 +136,7 @@ <property name="geometry"> <rect> <x>420</x> - <y>100</y> + <y>130</y> <width>75</width> <height>23</height> </rect> @@ -246,6 +246,49 @@ </rect> </property> </widget> + <widget class="QLabel" name="label_4"> + <property name="geometry"> + <rect> + <x>10</x> + <y>100</y> + <width>61</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>Resolution</string> + </property> + </widget> + <widget class="QComboBox" name="resolution"> + <property name="geometry"> + <rect> + <x>130</x> + <y>100</y> + <width>251</width> + <height>22</height> + </rect> + </property> + <item> + <property name="text"> + <string>640x480</string> + </property> + </item> + <item> + <property name="text"> + <string>320x240</string> + </property> + </item> + <item> + <property name="text"> + <string>320x200</string> + </property> + </item> + <item> + <property name="text"> + <string>Default (not recommended!)</string> + </property> + </item> + </widget> </widget> <resources/> <connections/> diff --git a/FTNoIR_Tracker_HT/ftnoir_tracker_ht.cpp b/FTNoIR_Tracker_HT/ftnoir_tracker_ht.cpp index 97c50e11..6adad5db 100644 --- a/FTNoIR_Tracker_HT/ftnoir_tracker_ht.cpp +++ b/FTNoIR_Tracker_HT/ftnoir_tracker_ht.cpp @@ -62,6 +62,18 @@ static QList<QString> get_camera_names(void) { return ret; } +typedef struct { + int width; + int height; +} resolution_tuple; + +static resolution_tuple resolution_choices[] = { + { 640, 480 }, + { 320, 240 }, + { 320, 200 }, + { 0, 0 } +}; + static void load_settings(ht_config_t* config, Tracker* tracker) { QSettings settings("Abbequerque Inc.", "FaceTrackNoIR"); @@ -77,17 +89,23 @@ static void load_settings(ht_config_t* config, Tracker* tracker) config->keypoint_quality = 12; config->keypoint_distance = 2.3f; config->keypoint_3distance = 6; - config->force_width = 0; - config->force_height = 0; + //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 = 4.0f; - config->ransac_max_inlier_error = 4.0f; - config->ransac_max_mean_error = 2.9f; - config->ransac_abs_max_mean_error = 4.0f; + config->ransac_max_reprojection_error = 5.5f; + config->ransac_max_inlier_error = 5.5f; + config->ransac_max_mean_error = 4.0f; + config->ransac_abs_max_mean_error = 6.0f; config->debug = 0; config->ransac_min_features = 0.75f; + int res = iniFile.value("resolution", 0).toInt(); + if (res < 0 || res >= sizeof(*resolution_choices) / sizeof(resolution_tuple)) + res = 0; + resolution_tuple r = resolution_choices[res]; + config->force_width = r.width; + config->force_height = r.height; if (tracker) { tracker->enableRX = iniFile.value("enable-rx", true).toBool(); @@ -364,6 +382,7 @@ void TrackerControls::loadSettings() ui.tx->setCheckState(iniFile.value("enable-tx", true).toBool() ? Qt::Checked : Qt::Unchecked); 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()); iniFile.endGroup(); settingsDirty = false; } @@ -401,6 +420,7 @@ void TrackerControls::save() iniFile.setValue("enable-tx", ui.tx->checkState() != Qt::Unchecked ? true : false); 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()); iniFile.endGroup(); settingsDirty = false; } |