diff options
author | Patrick Ruoff <c14-radioactive@19e81ba0-9b1a-49c3-bd6c-561e1906d5fb> | 2013-01-12 14:07:45 +0000 |
---|---|---|
committer | Patrick Ruoff <c14-radioactive@19e81ba0-9b1a-49c3-bd6c-561e1906d5fb> | 2013-01-12 14:07:45 +0000 |
commit | 5fd06c5d0a28a861e02f000d95cf82d987465041 (patch) | |
tree | 29a7b7eb16d606133abb9363a2b21e9363afab47 /FTNoIR_Tracker_PT | |
parent | f87e2f694b731fad0e2b60926858ca21b64b79e8 (diff) |
PointTracker: Tracker state is reported to FTNoIR, Camera pitch correction, Dynamic pose resolution made optional
git-svn-id: svn+ssh://svn.code.sf.net/p/facetracknoir/code@207 19e81ba0-9b1a-49c3-bd6c-561e1906d5fb
Diffstat (limited to 'FTNoIR_Tracker_PT')
-rw-r--r-- | FTNoIR_Tracker_PT/FTNoIR_PT_Controls.ui | 833 | ||||
-rw-r--r-- | FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp | 22 | ||||
-rw-r--r-- | FTNoIR_Tracker_PT/ftnoir_tracker_pt.h | 5 | ||||
-rw-r--r-- | FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.cpp | 22 | ||||
-rw-r--r-- | FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.h | 2 | ||||
-rw-r--r-- | FTNoIR_Tracker_PT/ftnoir_tracker_pt_settings.cpp | 36 | ||||
-rw-r--r-- | FTNoIR_Tracker_PT/ftnoir_tracker_pt_settings.h | 16 | ||||
-rw-r--r-- | FTNoIR_Tracker_PT/point_tracker.cpp | 4 | ||||
-rw-r--r-- | FTNoIR_Tracker_PT/point_tracker.h | 2 |
9 files changed, 597 insertions, 345 deletions
diff --git a/FTNoIR_Tracker_PT/FTNoIR_PT_Controls.ui b/FTNoIR_Tracker_PT/FTNoIR_PT_Controls.ui index 20e16985..a2389f71 100644 --- a/FTNoIR_Tracker_PT/FTNoIR_PT_Controls.ui +++ b/FTNoIR_Tracker_PT/FTNoIR_PT_Controls.ui @@ -9,8 +9,8 @@ <rect>
<x>0</x>
<y>0</y>
- <width>393</width>
- <height>585</height>
+ <width>405</width>
+ <height>489</height>
</rect>
</property>
<property name="sizePolicy">
@@ -64,85 +64,57 @@ <item>
<widget class="QGroupBox" name="groupBox_6">
<property name="title">
- <string>TrackerThread</string>
+ <string>Tracker Thread</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
- <layout class="QHBoxLayout" name="horizontalLayout_8">
- <item>
- <layout class="QFormLayout" name="formLayout_2">
- <property name="fieldGrowthPolicy">
- <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="3">
+ <widget class="QCheckBox" name="videowidget_check">
+ <property name="toolTip">
+ <string>Whether to update the content of the VideoWidget</string>
</property>
- <item row="0" column="0">
- <widget class="QLabel" name="label_39">
- <property name="text">
- <string>Sleep time</string>
+ <property name="text">
+ <string>Show VideoWidget</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_39">
+ <property name="text">
+ <string>Sleep time</string>
+ </property>
+ <property name="buddy">
+ <cstring>sleep_spin</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <layout class="QHBoxLayout" name="horizontalLayout_11">
+ <item>
+ <widget class="QSpinBox" name="sleep_spin">
+ <property name="toolTip">
+ <string>Time the tracker thread sleeps after each processed frame</string>
</property>
- <property name="buddy">
- <cstring>sleep_spin</cstring>
+ <property name="suffix">
+ <string/>
+ </property>
+ <property name="maximum">
+ <number>9999</number>
</property>
</widget>
</item>
- <item row="0" column="1">
- <layout class="QHBoxLayout" name="horizontalLayout_11">
- <item>
- <widget class="QSpinBox" name="sleep_spin">
- <property name="toolTip">
- <string>Time the tracker thread sleeps after each processed frame</string>
- </property>
- <property name="suffix">
- <string/>
- </property>
- <property name="maximum">
- <number>9999</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="label_40">
- <property name="text">
- <string>ms</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_43">
+ <item>
+ <widget class="QLabel" name="label_40">
<property name="text">
- <string>Auto-reset time</string>
- </property>
- <property name="buddy">
- <cstring>reset_spin</cstring>
+ <string>ms</string>
</property>
</widget>
</item>
- <item row="1" column="1">
- <layout class="QHBoxLayout" name="horizontalLayout_12">
- <item>
- <widget class="QSpinBox" name="reset_spin">
- <property name="toolTip">
- <string>Time until automatic reset of tracker's internal state when no valid tracking result is found</string>
- </property>
- <property name="maximum">
- <number>9999</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="label_42">
- <property name="text">
- <string>ms</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
</layout>
</item>
- <item>
- <spacer name="horizontalSpacer_7">
+ <item row="0" column="2">
+ <spacer name="horizontalSpacer_11">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@@ -154,32 +126,420 @@ </property>
</spacer>
</item>
- <item>
- <layout class="QFormLayout" name="formLayout_3">
- <property name="fieldGrowthPolicy">
- <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_43">
+ <property name="text">
+ <string>Auto-reset time</string>
+ </property>
+ <property name="buddy">
+ <cstring>reset_spin</cstring>
</property>
- <item row="0" column="0">
- <widget class="QCheckBox" name="videowidget_check">
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <layout class="QHBoxLayout" name="horizontalLayout_12">
+ <item>
+ <widget class="QSpinBox" name="reset_spin">
<property name="toolTip">
- <string>Whether to update the content of the VideoWidget</string>
+ <string>Time until automatic reset of tracker's internal state when no valid tracking result is found</string>
+ </property>
+ <property name="maximum">
+ <number>9999</number>
</property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_42">
<property name="text">
- <string>Show VideoWidget</string>
+ <string>ms</string>
</property>
</widget>
</item>
</layout>
</item>
+ <item row="1" column="3">
+ <widget class="QCheckBox" name="dynpose_check">
+ <property name="toolTip">
+ <string/>
+ </property>
+ <property name="text">
+ <string>Dynamic Pose Resolution</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="2">
+ <spacer name="horizontalSpacer_7">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="groupBox_3">
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>85</height>
+ </size>
+ </property>
+ <property name="title">
+ <string>Enable Axis</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout_5">
+ <item>
+ <layout class="QGridLayout" name="gridLayout_2">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_6">
+ <property name="text">
+ <string>Roll:</string>
+ </property>
+ <property name="buddy">
+ <cstring>chkEnableRoll</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_9">
+ <property name="text">
+ <string>Pitch:</string>
+ </property>
+ <property name="buddy">
+ <cstring>chkEnablePitch</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_11">
+ <property name="text">
+ <string>Yaw:</string>
+ </property>
+ <property name="buddy">
+ <cstring>chkEnableYaw</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QCheckBox" name="chkEnableRoll">
+ <property name="maximumSize">
+ <size>
+ <width>20</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="layoutDirection">
+ <enum>Qt::LeftToRight</enum>
+ </property>
+ <property name="styleSheet">
+ <string notr="true"/>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QCheckBox" name="chkEnablePitch">
+ <property name="maximumSize">
+ <size>
+ <width>20</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="layoutDirection">
+ <enum>Qt::LeftToRight</enum>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QCheckBox" name="chkEnableYaw">
+ <property name="maximumSize">
+ <size>
+ <width>20</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="layoutDirection">
+ <enum>Qt::LeftToRight</enum>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="3">
+ <widget class="QLabel" name="label_14">
+ <property name="text">
+ <string>X:</string>
+ </property>
+ <property name="buddy">
+ <cstring>chkEnableX</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="4">
+ <widget class="QCheckBox" name="chkEnableX">
+ <property name="maximumSize">
+ <size>
+ <width>20</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="layoutDirection">
+ <enum>Qt::LeftToRight</enum>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="3">
+ <widget class="QLabel" name="label_15">
+ <property name="text">
+ <string>Y:</string>
+ </property>
+ <property name="buddy">
+ <cstring>chkEnableY</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="4">
+ <widget class="QCheckBox" name="chkEnableY">
+ <property name="maximumSize">
+ <size>
+ <width>20</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="layoutDirection">
+ <enum>Qt::LeftToRight</enum>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="3">
+ <widget class="QLabel" name="label_16">
+ <property name="text">
+ <string>Z:</string>
+ </property>
+ <property name="buddy">
+ <cstring>chkEnableZ</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="4">
+ <widget class="QCheckBox" name="chkEnableZ">
+ <property name="maximumSize">
+ <size>
+ <width>20</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="layoutDirection">
+ <enum>Qt::LeftToRight</enum>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="2">
+ <spacer name="horizontalSpacer_3">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Minimum</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="1" column="2">
+ <spacer name="horizontalSpacer_5">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Minimum</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="2" column="2">
+ <spacer name="horizontalSpacer_8">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Minimum</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_4">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="groupBox_11">
+ <property name="title">
+ <string>Status</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_8">
+ <item>
+ <layout class="QFormLayout" name="formLayout_2">
+ <property name="fieldGrowthPolicy">
+ <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
+ </property>
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_65">
+ <property name="text">
+ <string>Camera Info:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLabel" name="caminfo_label_2">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>120</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_17">
+ <property name="text">
+ <string>Extracted Points:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLabel" name="pointinfo_label_2">
+ <property name="minimumSize">
+ <size>
+ <width>50</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
+ <layout class="QHBoxLayout" name="horizontalLayout_10">
+ <item>
+ <widget class="QPushButton" name="center_button">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="toolTip">
+ <string>Center the tracker</string>
+ </property>
+ <property name="text">
+ <string>Center</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="reset_button">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="toolTip">
+ <string>Reset the tracker's internal state</string>
+ </property>
+ <property name="text">
+ <string>Reset</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="tab_2">
+ <attribute name="title">
+ <string>Camera</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_7">
+ <item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
- <string>Camera</string>
+ <string>Camera Settings</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
@@ -325,6 +685,53 @@ </item>
</layout>
</item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_6">
+ <item>
+ <widget class="QLabel" name="label_4">
+ <property name="text">
+ <string>Camera Pitch (upwards = positive)</string>
+ </property>
+ <property name="buddy">
+ <cstring>campitch_spin</cstring>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="campitch_spin">
+ <property name="contextMenuPolicy">
+ <enum>Qt::DefaultContextMenu</enum>
+ </property>
+ <property name="toolTip">
+ <string>The angle the camera is facing upwards</string>
+ </property>
+ <property name="minimum">
+ <number>-99</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_5">
+ <property name="text">
+ <string>deg</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_10">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
</layout>
</widget>
</item>
@@ -433,196 +840,14 @@ </widget>
</item>
<item>
- <widget class="QGroupBox" name="groupBox_3">
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>85</height>
- </size>
- </property>
- <property name="title">
- <string>Enable Axis</string>
- </property>
- <widget class="QWidget" name="layoutWidget">
- <property name="geometry">
- <rect>
- <x>10</x>
- <y>20</y>
- <width>143</width>
- <height>60</height>
- </rect>
- </property>
- <layout class="QGridLayout" name="gridLayout_2">
- <item row="0" column="0">
- <widget class="QLabel" name="label_6">
- <property name="text">
- <string>Roll:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_9">
- <property name="text">
- <string>Pitch:</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="label_11">
- <property name="text">
- <string>Yaw:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QCheckBox" name="chkEnableRoll">
- <property name="maximumSize">
- <size>
- <width>20</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="layoutDirection">
- <enum>Qt::LeftToRight</enum>
- </property>
- <property name="styleSheet">
- <string notr="true"/>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QCheckBox" name="chkEnablePitch">
- <property name="maximumSize">
- <size>
- <width>20</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="layoutDirection">
- <enum>Qt::LeftToRight</enum>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QCheckBox" name="chkEnableYaw">
- <property name="maximumSize">
- <size>
- <width>20</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="layoutDirection">
- <enum>Qt::LeftToRight</enum>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item row="0" column="3">
- <widget class="QLabel" name="label_14">
- <property name="text">
- <string>X:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="4">
- <widget class="QCheckBox" name="chkEnableX">
- <property name="maximumSize">
- <size>
- <width>20</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="layoutDirection">
- <enum>Qt::LeftToRight</enum>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item row="1" column="3">
- <widget class="QLabel" name="label_15">
- <property name="text">
- <string>Y:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="4">
- <widget class="QCheckBox" name="chkEnableY">
- <property name="maximumSize">
- <size>
- <width>20</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="layoutDirection">
- <enum>Qt::LeftToRight</enum>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item row="2" column="3">
- <widget class="QLabel" name="label_16">
- <property name="text">
- <string>Z:</string>
- </property>
- </widget>
- </item>
- <item row="2" column="4">
- <widget class="QCheckBox" name="chkEnableZ">
- <property name="maximumSize">
- <size>
- <width>20</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="layoutDirection">
- <enum>Qt::LeftToRight</enum>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item row="0" column="2">
- <spacer name="horizontalSpacer_3">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Minimum</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer">
+ <spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
- <height>20</height>
+ <height>40</height>
</size>
</property>
</spacer>
@@ -689,36 +914,6 @@ </layout>
</widget>
</item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_10">
- <item>
- <widget class="QPushButton" name="center_button">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="toolTip">
- <string>Center the tracker</string>
- </property>
- <property name="text">
- <string>Center</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="reset_button">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="toolTip">
- <string>Reset the tracker's internal state</string>
- </property>
- <property name="text">
- <string>Reset</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
</layout>
</widget>
<widget class="QWidget" name="tab_4">
@@ -732,7 +927,7 @@ <enum>QTabWidget::Rounded</enum>
</property>
<property name="currentIndex">
- <number>0</number>
+ <number>2</number>
</property>
<property name="usesScrollButtons">
<bool>false</bool>
@@ -1343,7 +1538,7 @@ </item>
<item>
<layout class="QGridLayout" name="gridLayout_6">
- <item row="3" column="2">
+ <item row="3" column="1">
<widget class="QSpinBox" name="tz_spin">
<property name="suffix">
<string/>
@@ -1356,28 +1551,28 @@ </property>
</widget>
</item>
- <item row="1" column="1">
+ <item row="1" column="0">
<widget class="QLabel" name="label_61">
<property name="text">
<string>x:</string>
</property>
</widget>
</item>
- <item row="2" column="1">
+ <item row="2" column="0">
<widget class="QLabel" name="label_62">
<property name="text">
<string>y:</string>
</property>
</widget>
</item>
- <item row="3" column="1">
+ <item row="3" column="0">
<widget class="QLabel" name="label_66">
<property name="text">
<string>z:</string>
</property>
</widget>
</item>
- <item row="2" column="2">
+ <item row="2" column="1">
<widget class="QSpinBox" name="ty_spin">
<property name="minimum">
<number>-999</number>
@@ -1387,7 +1582,7 @@ </property>
</widget>
</item>
- <item row="1" column="2">
+ <item row="1" column="1">
<widget class="QSpinBox" name="tx_spin">
<property name="minimum">
<number>-999</number>
@@ -1397,13 +1592,6 @@ </property>
</widget>
</item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_72">
- <property name="text">
- <string>T:</string>
- </property>
- </widget>
- </item>
</layout>
</item>
<item>
@@ -1526,21 +1714,27 @@ </widget>
<tabstops>
<tabstop>tabWidget</tabstop>
- <tabstop>ok_button</tabstop>
- <tabstop>cancel_button</tabstop>
<tabstop>sleep_spin</tabstop>
- <tabstop>reset_spin</tabstop>
<tabstop>videowidget_check</tabstop>
+ <tabstop>reset_spin</tabstop>
+ <tabstop>dynpose_check</tabstop>
+ <tabstop>chkEnableRoll</tabstop>
+ <tabstop>chkEnablePitch</tabstop>
+ <tabstop>chkEnableYaw</tabstop>
+ <tabstop>chkEnableX</tabstop>
+ <tabstop>chkEnableY</tabstop>
+ <tabstop>chkEnableZ</tabstop>
+ <tabstop>center_button</tabstop>
+ <tabstop>reset_button</tabstop>
<tabstop>camindex_spin</tabstop>
<tabstop>res_x_spin</tabstop>
<tabstop>res_y_spin</tabstop>
<tabstop>fps_spin</tabstop>
<tabstop>f_dspin</tabstop>
+ <tabstop>campitch_spin</tabstop>
<tabstop>threshold_slider</tabstop>
<tabstop>mindiam_spin</tabstop>
<tabstop>maxdiam_spin</tabstop>
- <tabstop>center_button</tabstop>
- <tabstop>reset_button</tabstop>
<tabstop>model_tabs</tabstop>
<tabstop>clip_tlength_spin</tabstop>
<tabstop>clip_theight_spin</tabstop>
@@ -1559,11 +1753,30 @@ <tabstop>ty_spin</tabstop>
<tabstop>tz_spin</tabstop>
<tabstop>tcalib_button</tabstop>
+ <tabstop>ok_button</tabstop>
+ <tabstop>cancel_button</tabstop>
</tabstops>
<resources>
<include location="ftnoir_tracker_pt.qrc"/>
</resources>
- <connections/>
+ <connections>
+ <connection>
+ <sender>dynpose_check</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>reset_spin</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>285</x>
+ <y>105</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>139</x>
+ <y>111</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
<slots>
<slot>startEngineClicked()</slot>
<slot>stopEngineClicked()</slot>
diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp b/FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp index 412d35d4..e9394eff 100644 --- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp +++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp @@ -20,7 +20,7 @@ using namespace boost; //-----------------------------------------------------------------------------
Tracker::Tracker()
- : frame_count(0), commands(0), video_widget(NULL)
+ : frame_count(0), commands(0), video_widget(NULL), tracking_valid(false)
{
qDebug()<<"Tracker::Tracker";
TrackerSettings settings;
@@ -79,7 +79,7 @@ void Tracker::run() if (new_frame && !frame.empty())
{
const std::vector<cv::Vec2f>& points = point_extractor.extract_points(frame, dt, draw_frame);
- point_tracker.track(points, camera.get_info().f, dt);
+ tracking_valid = point_tracker.track(points, camera.get_info().f, dt);
frame_count++;
}
#ifdef PT_PERF_LOG
@@ -106,9 +106,11 @@ void Tracker::apply(const TrackerSettings& settings) point_extractor.min_size = settings.min_point_size;
point_extractor.max_size = settings.max_point_size;
point_tracker.point_model = boost::shared_ptr<PointModel>(new PointModel(settings.M01, settings.M02));
+ point_tracker.dynamic_pose_resolution = settings.dyn_pose_res;
sleep_time = settings.sleep_time;
point_tracker.dt_reset = settings.reset_time / 1000.0;
draw_frame = settings.video_widget;
+ cam_pitch = settings.cam_pitch;
bEnableRoll = settings.bEnableRoll;
bEnablePitch = settings.bEnablePitch;
@@ -188,9 +190,12 @@ void Tracker::StopTracker(bool exit) bool Tracker::GiveHeadPoseData(THeadPoseData *data)
{
const float rad2deg = 180.0/3.14159265;
+ const float deg2rad = 1.0/rad2deg;
{
QMutexLocker lock(&mutex);
+ if (!tracking_valid) return false;
+
FrameTrafo X_CM = point_tracker.get_pose();
FrameTrafo X_MH(Matx33f::eye(), t_MH);
FrameTrafo X_CH = X_CM * X_MH;
@@ -202,13 +207,18 @@ bool Tracker::GiveHeadPoseData(THeadPoseData *data) if (bEnableX) {
data->x = t[0] / 10.0; // convert to cm
}
-
if (bEnableY) {
data->y = t[1] / 10.0;
}
if (bEnableZ) {
data->z = t[2] / 10.0;
}
+
+ // correct for camera pitch
+ Matx33f R_CP( 1, 0, 0,
+ 0, cos(deg2rad*cam_pitch), sin(deg2rad*cam_pitch),
+ 0, -sin(deg2rad*cam_pitch), cos(deg2rad*cam_pitch));
+ R = R_CP * R * R_CP.t();
// translate rotation matrix from opengl (G) to roll-pitch-yaw (R) frame
// -z -> x, y -> z, x -> -y
@@ -225,13 +235,13 @@ bool Tracker::GiveHeadPoseData(THeadPoseData *data) gamma = atan2( R(2,1), R(2,2));
if (bEnableYaw) {
- data->yaw = rad2deg * alpha;
+ data->yaw = rad2deg * alpha;
}
if (bEnablePitch) {
- data->pitch = -rad2deg * beta; // this is what ftnoir expects?
+ data->pitch = rad2deg * beta;
}
if (bEnableRoll) {
- data->roll = rad2deg * gamma;
+ data->roll = rad2deg * gamma;
}
}
return true;
diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt.h b/FTNoIR_Tracker_PT/ftnoir_tracker_pt.h index c381b807..2533a39b 100644 --- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt.h +++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt.h @@ -62,9 +62,14 @@ protected: VICamera camera;
PointExtractor point_extractor;
PointTracker point_tracker;
+ bool tracking_valid;
+
cv::Vec3f t_MH;
+ int cam_pitch;
+
bool draw_frame;
int sleep_time;
+
bool bEnableRoll;
bool bEnablePitch;
bool bEnableYaw;
diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.cpp b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.cpp index f3daae0c..83c04305 100644 --- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.cpp +++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.cpp @@ -24,6 +24,7 @@ TrackerDialog::TrackerDialog() // initialize ui values
ui.videowidget_check->setChecked(settings.video_widget);
+ ui.dynpose_check->setChecked(settings.dyn_pose_res);
ui.sleep_spin->setValue(settings.sleep_time);
ui.reset_spin->setValue(settings.reset_time);
ui.camindex_spin->setValue(settings.cam_index);
@@ -31,6 +32,7 @@ TrackerDialog::TrackerDialog() ui.res_x_spin->setValue(settings.cam_res_x);
ui.res_y_spin->setValue(settings.cam_res_y);
ui.fps_spin->setValue(settings.cam_fps);
+ ui.campitch_spin->setValue(settings.cam_pitch);
ui.threshold_slider->setValue(settings.threshold);
ui.chkEnableRoll->setChecked(settings.bEnableRoll);
@@ -62,6 +64,7 @@ TrackerDialog::TrackerDialog() // connect Qt signals and slots
connect( ui.videowidget_check,SIGNAL(toggled(bool)), this,SLOT(set_video_widget(bool)) );
+ connect( ui.dynpose_check,SIGNAL(toggled(bool)), this,SLOT(set_dyn_pose_res(bool)) );
connect( ui.sleep_spin,SIGNAL(valueChanged(int)), this,SLOT(set_sleep_time(int)) );
connect( ui.reset_spin,SIGNAL(valueChanged(int)), this,SLOT(set_reset_time(int)) );
connect( ui.camindex_spin,SIGNAL(valueChanged(int)), this,SLOT(set_cam_index(int)) );
@@ -69,6 +72,7 @@ TrackerDialog::TrackerDialog() connect( ui.res_x_spin,SIGNAL(valueChanged(int)), this,SLOT(set_cam_res_x(int)) );
connect( ui.res_y_spin,SIGNAL(valueChanged(int)), this,SLOT(set_cam_res_y(int)) );
connect( ui.fps_spin,SIGNAL(valueChanged(int)), this,SLOT(set_cam_fps(int)) );
+ connect( ui.campitch_spin,SIGNAL(valueChanged(int)), this,SLOT(set_cam_pitch(int)) );
connect( ui.threshold_slider,SIGNAL(sliderMoved(int)), this,SLOT(set_threshold(int)) );
connect( ui.chkEnableRoll,SIGNAL(toggled(bool)), this,SLOT(set_ena_roll(bool)) );
@@ -259,28 +263,36 @@ void TrackerDialog::doCancel() void TrackerDialog::poll_tracker_info()
{
if (tracker)
- {
+ {
+ QString to_print;
+
// display caminfo
CamInfo info;
tracker->get_cam_info(&info);
- ui.caminfo_label->setText(QString::number(info.res_x)+"x"+QString::number(info.res_y)+" @ "+QString::number(info.fps)+" FPS");
+ to_print = QString::number(info.res_x)+"x"+QString::number(info.res_y)+" @ "+QString::number(info.fps)+" FPS";
+ ui.caminfo_label->setText(to_print);
+ ui.caminfo_label_2->setText(to_print);
// display pointinfo
int n_points = tracker->get_n_points();
- QString to_print = QString::number(n_points);
+ to_print = QString::number(n_points);
if (n_points == 3)
to_print += " OK!";
else
to_print += " BAD!";
ui.pointinfo_label->setText(to_print);
+ ui.pointinfo_label_2->setText(to_print);
// update calibration
if (trans_calib_running) trans_calib_step();
}
else
{
- ui.caminfo_label->setText("Tracker offline");
- ui.pointinfo_label->setText("Tracker offline");
+ QString to_print = "Tracker offline";
+ ui.caminfo_label->setText(to_print);
+ ui.caminfo_label_2->setText(to_print);
+ ui.pointinfo_label->setText(to_print);
+ ui.pointinfo_label_2->setText(to_print);
}
}
diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.h b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.h index 19404444..0f836dfe 100644 --- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.h +++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.h @@ -34,6 +34,7 @@ public: protected slots:
// ugly qt stuff
void set_video_widget(bool val) { settings.video_widget = val; settings_changed(); }
+ void set_dyn_pose_res(bool val) { settings.dyn_pose_res = val; settings_changed(); }
void set_sleep_time(int val) { settings.sleep_time = val; settings_changed(); }
void set_reset_time(int val) { settings.reset_time = val; settings_changed(); }
void set_cam_index(int val) { settings.cam_index = val; settings_changed(); }
@@ -41,6 +42,7 @@ protected slots: void set_cam_res_x(int val) { settings.cam_res_x = val; settings_changed(); }
void set_cam_res_y(int val) { settings.cam_res_y = val; settings_changed(); }
void set_cam_fps(int val) { settings.cam_fps = val; settings_changed(); }
+ void set_cam_pitch(int val) { settings.cam_pitch = val; settings_changed(); }
void set_min_point_size(int val) { settings.min_point_size = val; settings_changed(); }
void set_max_point_size(int val) { settings.max_point_size = val; settings_changed(); }
void set_threshold(int val) { settings.threshold = val; settings_changed(); }
diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_settings.cpp b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_settings.cpp index 7c356694..40d1bc4f 100644 --- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_settings.cpp +++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_settings.cpp @@ -25,6 +25,7 @@ void TrackerSettings::load_ini() cam_res_x = iniFile.value("CameraResX", 640).toInt();
cam_res_y = iniFile.value("CameraResY", 480).toInt();
cam_fps = iniFile.value("CameraFPS", 30).toInt();
+ cam_pitch = iniFile.value("CameraPitch", 0).toInt();
threshold = iniFile.value("PointExtractThreshold", 128).toInt();
min_point_size = iniFile.value("PointExtractMinSize", 2).toInt();
max_point_size = iniFile.value("PointExtractMaxSize", 50).toInt();
@@ -37,16 +38,17 @@ void TrackerSettings::load_ini() t_MH[0] = iniFile.value("tMHx", 0).toFloat();
t_MH[1] = iniFile.value("tMHy", 0).toFloat();
t_MH[2] = iniFile.value("tMHz", 0).toFloat();
+ dyn_pose_res = iniFile.value("DynamicPoseResolution", true).toBool();
video_widget = iniFile.value("VideoWidget", true).toBool();
sleep_time = iniFile.value("SleepTime", 10).toInt();
reset_time = iniFile.value("ResetTime", 1000).toInt();
- bEnableRoll = iniFile.value ( "EnableRoll", 1 ).toBool();
- bEnablePitch = iniFile.value ( "EnablePitch", 1 ).toBool();
- bEnableYaw = iniFile.value ( "EnableYaw", 1 ).toBool();
- bEnableX = iniFile.value ( "EnableX", 1 ).toBool();
- bEnableY = iniFile.value ( "EnableY", 1 ).toBool();
- bEnableZ = iniFile.value ( "EnableZ", 1 ).toBool();
+ bEnableRoll = iniFile.value( "EnableRoll", 1 ).toBool();
+ bEnablePitch = iniFile.value( "EnablePitch", 1 ).toBool();
+ bEnableYaw = iniFile.value( "EnableYaw", 1 ).toBool();
+ bEnableX = iniFile.value( "EnableX", 1 ).toBool();
+ bEnableY = iniFile.value( "EnableY", 1 ).toBool();
+ bEnableZ = iniFile.value( "EnableZ", 1 ).toBool();
iniFile.endGroup();
}
@@ -62,10 +64,11 @@ void TrackerSettings::save_ini() const iniFile.beginGroup ( "PointTracker" );
iniFile.setValue("CameraId", cam_index);
- iniFile.setValue("CameraF", cam_f);
- iniFile.setValue("CameraResX", cam_res_x);
- iniFile.setValue("CameraResY", cam_res_y);
- iniFile.setValue("CameraFPS", cam_fps);
+ iniFile.setValue("CameraF", cam_f);
+ iniFile.setValue("CameraResX", cam_res_x);
+ iniFile.setValue("CameraResY", cam_res_y);
+ iniFile.setValue("CameraFPS", cam_fps);
+ iniFile.setValue("CameraPitch", cam_pitch);
iniFile.setValue("PointExtractThreshold", threshold);
iniFile.setValue("PointExtractMinSize", min_point_size);
iniFile.setValue("PointExtractMaxSize", max_point_size);
@@ -78,16 +81,17 @@ void TrackerSettings::save_ini() const iniFile.setValue("tMHx", t_MH[0]);
iniFile.setValue("tMHy", t_MH[1]);
iniFile.setValue("tMHz", t_MH[2]);
+ iniFile.setValue("DynamicPoseResolution", dyn_pose_res);
iniFile.setValue("VideoWidget", video_widget);
iniFile.setValue("SleepTime", sleep_time);
iniFile.setValue("ResetTime", reset_time);
- iniFile.setValue ( "EnableRoll", bEnableRoll );
- iniFile.setValue ( "EnablePitch", bEnablePitch );
- iniFile.setValue ( "EnableYaw", bEnableYaw );
- iniFile.setValue ( "EnableX", bEnableX );
- iniFile.setValue ( "EnableY", bEnableY );
- iniFile.setValue ( "EnableZ", bEnableZ );
+ iniFile.setValue( "EnableRoll", bEnableRoll );
+ iniFile.setValue( "EnablePitch", bEnablePitch );
+ iniFile.setValue( "EnableYaw", bEnableYaw );
+ iniFile.setValue( "EnableX", bEnableX );
+ iniFile.setValue( "EnableY", bEnableY );
+ iniFile.setValue( "EnableZ", bEnableZ );
iniFile.endGroup();
}
diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_settings.h b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_settings.h index 16ee20f3..88162c86 100644 --- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_settings.h +++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_settings.h @@ -21,6 +21,7 @@ struct TrackerSettings int cam_res_x;
int cam_res_y;
int cam_fps;
+ int cam_pitch;
// point extraction
int threshold;
@@ -30,13 +31,7 @@ struct TrackerSettings // point tracking
cv::Vec3f M01;
cv::Vec3f M02;
-
- bool bEnableRoll;
- bool bEnablePitch;
- bool bEnableYaw;
- bool bEnableX;
- bool bEnableY;
- bool bEnableZ;
+ bool dyn_pose_res;
// head to model translation
cv::Vec3f t_MH;
@@ -45,6 +40,13 @@ struct TrackerSettings int reset_time; // in ms
bool video_widget;
+ bool bEnableRoll;
+ bool bEnablePitch;
+ bool bEnableYaw;
+ bool bEnableX;
+ bool bEnableY;
+ bool bEnableZ;
+
void load_ini();
void save_ini() const;
};
diff --git a/FTNoIR_Tracker_PT/point_tracker.cpp b/FTNoIR_Tracker_PT/point_tracker.cpp index 03914bb4..d617de19 100644 --- a/FTNoIR_Tracker_PT/point_tracker.cpp +++ b/FTNoIR_Tracker_PT/point_tracker.cpp @@ -87,7 +87,7 @@ void PointModel::get_d_order(const std::vector<cv::Vec2f>& points, int d_order[] // ----------------------------------------------------------------------------
-PointTracker::PointTracker() : init_phase(true), dt_valid(0), dt_reset(1), v_t(0,0,0), v_r(0,0,0)
+PointTracker::PointTracker() : init_phase(true), dt_valid(0), dt_reset(1), v_t(0,0,0), v_r(0,0,0), dynamic_pose_resolution(true)
{
X_CM.t[2] = 1000; // default position: 1 m away from cam;
}
@@ -109,6 +109,8 @@ void PointTracker::reset_velocities() bool PointTracker::track(const vector<Vec2f>& points, float f, float dt)
{
+ if (!dynamic_pose_resolution) init_phase = true;
+
dt_valid += dt;
// if there was no valid tracking result for too long, do a reset
if (dt_valid > dt_reset)
diff --git a/FTNoIR_Tracker_PT/point_tracker.h b/FTNoIR_Tracker_PT/point_tracker.h index efd40424..21baad19 100644 --- a/FTNoIR_Tracker_PT/point_tracker.h +++ b/FTNoIR_Tracker_PT/point_tracker.h @@ -74,9 +74,11 @@ public: // track the pose using the set of normalized point coordinates (x pos in range -0.5:0.5)
// f : (focal length)/(sensor width)
+ // dt : time since last call
bool track(const std::vector<cv::Vec2f>& points, float f, float dt);
boost::shared_ptr<PointModel> point_model;
+ bool dynamic_pose_resolution;
float dt_reset;
FrameTrafo get_pose() const { return X_CM; }
|