summaryrefslogtreecommitdiffhomepage
path: root/FTNoIR_Tracker_PT
diff options
context:
space:
mode:
Diffstat (limited to 'FTNoIR_Tracker_PT')
-rw-r--r--FTNoIR_Tracker_PT/FTNoIR_PT_Controls.ui1165
-rw-r--r--FTNoIR_Tracker_PT/FTNoIR_Tracker_PT_vc9.vcproj66
-rw-r--r--FTNoIR_Tracker_PT/Resources/cap_front.pngbin0 -> 1164 bytes
-rw-r--r--FTNoIR_Tracker_PT/Resources/cap_side.pngbin0 -> 1733 bytes
-rw-r--r--FTNoIR_Tracker_PT/Resources/clip_front.pngbin0 -> 571 bytes
-rw-r--r--FTNoIR_Tracker_PT/Resources/clip_side.pngbin0 -> 2677 bytes
-rw-r--r--FTNoIR_Tracker_PT/camera.cpp224
-rw-r--r--FTNoIR_Tracker_PT/camera.h85
-rw-r--r--FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp48
-rw-r--r--FTNoIR_Tracker_PT/ftnoir_tracker_pt.h5
-rw-r--r--FTNoIR_Tracker_PT/ftnoir_tracker_pt.qrc12
-rw-r--r--FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.cpp134
-rw-r--r--FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.h31
-rw-r--r--FTNoIR_Tracker_PT/ftnoir_tracker_pt_dll.cpp2
-rw-r--r--FTNoIR_Tracker_PT/ftnoir_tracker_pt_settings.cpp59
-rw-r--r--FTNoIR_Tracker_PT/ftnoir_tracker_pt_settings.h35
-rw-r--r--FTNoIR_Tracker_PT/point_extractor.cpp34
-rw-r--r--FTNoIR_Tracker_PT/point_tracker.cpp165
-rw-r--r--FTNoIR_Tracker_PT/point_tracker.h25
-rw-r--r--FTNoIR_Tracker_PT/timer.cpp66
-rw-r--r--FTNoIR_Tracker_PT/timer.h44
-rw-r--r--FTNoIR_Tracker_PT/videoInput/videoInput.h385
-rw-r--r--FTNoIR_Tracker_PT/videoInput/videoInput_vc8.libbin0 -> 2145206 bytes
-rw-r--r--FTNoIR_Tracker_PT/videoInput/videoInput_vc9.libbin0 -> 2119546 bytes
24 files changed, 1993 insertions, 592 deletions
diff --git a/FTNoIR_Tracker_PT/FTNoIR_PT_Controls.ui b/FTNoIR_Tracker_PT/FTNoIR_PT_Controls.ui
index 6ba6a1db..9c70b397 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>395</width>
- <height>511</height>
+ <width>401</width>
+ <height>497</height>
</rect>
</property>
<property name="sizePolicy">
@@ -50,6 +50,9 @@
<height>0</height>
</size>
</property>
+ <property name="locale">
+ <locale language="English" country="UnitedStates"/>
+ </property>
<property name="currentIndex">
<number>0</number>
</property>
@@ -67,30 +70,6 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
- <layout class="QFormLayout" name="formLayout_3">
- <item row="0" column="0">
- <widget class="QCheckBox" name="videowidget_check">
- <property name="text">
- <string>Show VideoWidget</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <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>
- <item>
<layout class="QFormLayout" name="formLayout_2">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
@@ -109,6 +88,9 @@
<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>
@@ -140,6 +122,9 @@
<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>
@@ -148,7 +133,7 @@
<item>
<widget class="QLabel" name="label_42">
<property name="text">
- <string>s</string>
+ <string>ms</string>
</property>
</widget>
</item>
@@ -156,34 +141,8 @@
</item>
</layout>
</item>
- </layout>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="groupBox">
- <property name="title">
- <string>Camera</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_3">
- <item>
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>Index</string>
- </property>
- <property name="buddy">
- <cstring>camindex_spin</cstring>
- </property>
- </widget>
- </item>
<item>
- <widget class="QSpinBox" name="camindex_spin"/>
- </item>
- <item>
- <spacer name="horizontalSpacer_2">
+ <spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@@ -196,62 +155,75 @@
</spacer>
</item>
<item>
- <widget class="QLabel" name="label_34">
- <property name="text">
- <string>(Focal length)/(Sensor width)</string>
- </property>
- <property name="buddy">
- <cstring>f_dspin</cstring>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QDoubleSpinBox" name="f_dspin">
- <property name="singleStep">
- <double>0.100000000000000</double>
+ <layout class="QFormLayout" name="formLayout_3">
+ <property name="fieldGrowthPolicy">
+ <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
- </widget>
+ <item row="0" column="0">
+ <widget class="QCheckBox" name="videowidget_check">
+ <property name="toolTip">
+ <string>Whether to update the content of the VideoWidget</string>
+ </property>
+ <property name="text">
+ <string>Show VideoWidget</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
</layout>
</item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="groupBox">
+ <property name="title">
+ <string>Camera</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
<item>
- <layout class="QHBoxLayout" name="horizontalLayout_9">
- <item>
- <widget class="QLabel" name="label_36">
- <property name="text">
- <string>Resolution</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QSpinBox" name="res_x_spin">
- <property name="maximum">
- <number>2000</number>
- </property>
- <property name="singleStep">
- <number>10</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="label_41">
- <property name="text">
- <string>x</string>
- </property>
- </widget>
- </item>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
- <widget class="QSpinBox" name="res_y_spin">
- <property name="maximum">
- <number>2000</number>
- </property>
- <property name="singleStep">
- <number>10</number>
- </property>
- </widget>
+ <layout class="QFormLayout" name="formLayout_4">
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>Index</string>
+ </property>
+ <property name="buddy">
+ <cstring>camindex_spin</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QSpinBox" name="camindex_spin">
+ <property name="toolTip">
+ <string>Capture device index</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_37">
+ <property name="text">
+ <string>FPS</string>
+ </property>
+ <property name="buddy">
+ <cstring>fps_spin</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QSpinBox" name="fps_spin">
+ <property name="toolTip">
+ <string>Desired capture framerate</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
<item>
- <spacer name="horizontalSpacer_9">
+ <spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@@ -264,17 +236,92 @@
</spacer>
</item>
<item>
- <widget class="QLabel" name="label_37">
- <property name="text">
- <string>FPS</string>
- </property>
- <property name="buddy">
- <cstring>fps_spin</cstring>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QSpinBox" name="fps_spin"/>
+ <layout class="QVBoxLayout" name="verticalLayout_10">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_13">
+ <item>
+ <widget class="QLabel" name="label_36">
+ <property name="text">
+ <string>Resolution</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_9">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="res_x_spin">
+ <property name="toolTip">
+ <string>Desired capture width</string>
+ </property>
+ <property name="maximum">
+ <number>2000</number>
+ </property>
+ <property name="singleStep">
+ <number>10</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_41">
+ <property name="text">
+ <string>x</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="res_y_spin">
+ <property name="toolTip">
+ <string>Desired capture height</string>
+ </property>
+ <property name="maximum">
+ <number>2000</number>
+ </property>
+ <property name="singleStep">
+ <number>10</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_9">
+ <item>
+ <widget class="QLabel" name="label_34">
+ <property name="text">
+ <string>(Focal length)/(Sensor width)</string>
+ </property>
+ <property name="buddy">
+ <cstring>f_dspin</cstring>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QDoubleSpinBox" name="f_dspin">
+ <property name="toolTip">
+ <string>The camera's focal length devided by its sensor width</string>
+ </property>
+ <property name="decimals">
+ <number>2</number>
+ </property>
+ <property name="singleStep">
+ <double>0.100000000000000</double>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
</item>
</layout>
</item>
@@ -301,6 +348,9 @@
</item>
<item>
<widget class="QSlider" name="threshold_slider">
+ <property name="toolTip">
+ <string>Intensity threshold for point extraction</string>
+ </property>
<property name="maximum">
<number>255</number>
</property>
@@ -327,7 +377,11 @@
</widget>
</item>
<item>
- <widget class="QSpinBox" name="mindiam_spin"/>
+ <widget class="QSpinBox" name="mindiam_spin">
+ <property name="toolTip">
+ <string>Minimum point diameter</string>
+ </property>
+ </widget>
</item>
<item>
<widget class="QLabel" name="label_12">
@@ -360,7 +414,11 @@
</widget>
</item>
<item>
- <widget class="QSpinBox" name="maxdiam_spin"/>
+ <widget class="QSpinBox" name="maxdiam_spin">
+ <property name="toolTip">
+ <string>Maximum point diameter</string>
+ </property>
+ </widget>
</item>
<item>
<widget class="QLabel" name="label_13">
@@ -382,7 +440,7 @@
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
- <height>40</height>
+ <height>20</height>
</size>
</property>
</spacer>
@@ -447,28 +505,33 @@
</layout>
</item>
</layout>
- <zorder></zorder>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_10">
<item>
- <widget class="QPushButton" name="reset_button">
+ <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>Reset</string>
+ <string>Center</string>
</property>
</widget>
</item>
<item>
- <widget class="QPushButton" name="center_button">
+ <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>Center</string>
+ <string>Reset</string>
</property>
</widget>
</item>
@@ -476,230 +539,628 @@
</item>
</layout>
</widget>
- <widget class="QWidget" name="tab_2">
+ <widget class="QWidget" name="tab_4">
<attribute name="title">
<string>Model</string>
</attribute>
- <layout class="QVBoxLayout" name="verticalLayout_7">
+ <layout class="QVBoxLayout" name="verticalLayout_16">
<item>
- <widget class="QGroupBox" name="groupBox_3">
- <property name="title">
- <string>Model Dimensions</string>
+ <widget class="QTabWidget" name="model_tabs">
+ <property name="tabShape">
+ <enum>QTabWidget::Rounded</enum>
</property>
- <layout class="QVBoxLayout" name="verticalLayout_8">
- <item>
- <widget class="QLabel" name="label_4">
- <property name="text">
- <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Location of the two remaining model points&lt;br/&gt;with respect to the reference point in default pose&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_6">
- <item>
- <layout class="QGridLayout" name="gridLayout_2">
- <item row="3" column="1">
- <widget class="QLabel" name="label_22">
- <property name="text">
- <string>z:</string>
- </property>
- </widget>
- </item>
- <item row="3" column="2">
- <widget class="QSpinBox" name="m1z_spin">
- <property name="minimum">
- <number>-999</number>
- </property>
- <property name="maximum">
- <number>999</number>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QLabel" name="label_17">
- <property name="text">
- <string>y:</string>
- </property>
- </widget>
- </item>
- <item row="2" column="2">
- <widget class="QSpinBox" name="m1y_spin">
- <property name="minimum">
- <number>-999</number>
- </property>
- <property name="maximum">
- <number>999</number>
- </property>
- </widget>
- </item>
- <item row="1" column="3">
- <widget class="QLabel" name="label_19">
- <property name="text">
- <string>mm</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_16">
- <property name="text">
- <string>M1:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="2">
- <widget class="QSpinBox" name="m1x_spin">
- <property name="minimum">
- <number>-999</number>
+ <property name="currentIndex">
+ <number>0</number>
+ </property>
+ <property name="usesScrollButtons">
+ <bool>false</bool>
+ </property>
+ <property name="documentMode">
+ <bool>false</bool>
+ </property>
+ <property name="tabsClosable">
+ <bool>false</bool>
+ </property>
+ <widget class="QWidget" name="tab_5">
+ <attribute name="title">
+ <string>Clip</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_13">
+ <item>
+ <widget class="QGroupBox" name="groupBox_8">
+ <property name="title">
+ <string>Model Dimensions (mm)</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout_16">
+ <item>
+ <widget class="QWidget" name="widget_4" native="true">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
</property>
- <property name="maximum">
- <number>999</number>
+ <property name="minimumSize">
+ <size>
+ <width>150</width>
+ <height>170</height>
+ </size>
</property>
+ <widget class="QLabel" name="label_44">
+ <property name="geometry">
+ <rect>
+ <x>30</x>
+ <y>30</y>
+ <width>71</width>
+ <height>111</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="pixmap">
+ <pixmap resource="ftnoir_tracker_pt.qrc">:/Resources/clip_side.png</pixmap>
+ </property>
+ </widget>
+ <widget class="QSpinBox" name="clip_theight_spin">
+ <property name="geometry">
+ <rect>
+ <x>100</x>
+ <y>50</y>
+ <width>46</width>
+ <height>22</height>
+ </rect>
+ </property>
+ <property name="maximum">
+ <number>999</number>
+ </property>
+ </widget>
+ <widget class="QSpinBox" name="clip_tlength_spin">
+ <property name="geometry">
+ <rect>
+ <x>60</x>
+ <y>10</y>
+ <width>46</width>
+ <height>22</height>
+ </rect>
+ </property>
+ <property name="maximum">
+ <number>999</number>
+ </property>
+ </widget>
+ <widget class="QSpinBox" name="clip_bheight_spin">
+ <property name="geometry">
+ <rect>
+ <x>100</x>
+ <y>90</y>
+ <width>46</width>
+ <height>22</height>
+ </rect>
+ </property>
+ <property name="maximum">
+ <number>999</number>
+ </property>
+ </widget>
+ <widget class="QLabel" name="label_50">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>10</y>
+ <width>46</width>
+ <height>13</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Side</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox" name="clip_blength_spin">
+ <property name="geometry">
+ <rect>
+ <x>40</x>
+ <y>140</y>
+ <width>46</width>
+ <height>22</height>
+ </rect>
+ </property>
+ <property name="maximum">
+ <number>999</number>
+ </property>
+ </widget>
+ <widget class="QLabel" name="label_52">
+ <property name="geometry">
+ <rect>
+ <x>70</x>
+ <y>70</y>
+ <width>16</width>
+ <height>16</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>R</string>
+ </property>
+ </widget>
</widget>
</item>
- <item row="3" column="3">
- <widget class="QLabel" name="label_18">
- <property name="text">
- <string>mm</string>
+ <item>
+ <widget class="QWidget" name="widget_3" native="true">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
</property>
- </widget>
- </item>
- <item row="2" column="3">
- <widget class="QLabel" name="label_21">
- <property name="text">
- <string>mm</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QLabel" name="label_20">
- <property name="text">
- <string>x:</string>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>140</height>
+ </size>
</property>
+ <widget class="QLabel" name="label_51">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>10</y>
+ <width>46</width>
+ <height>13</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Front</string>
+ </property>
+ </widget>
+ <widget class="QLabel" name="label_45">
+ <property name="geometry">
+ <rect>
+ <x>40</x>
+ <y>30</y>
+ <width>21</width>
+ <height>111</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="pixmap">
+ <pixmap resource="ftnoir_tracker_pt.qrc">:/Resources/clip_front.png</pixmap>
+ </property>
+ </widget>
+ <widget class="QLabel" name="label_53">
+ <property name="geometry">
+ <rect>
+ <x>60</x>
+ <y>70</y>
+ <width>16</width>
+ <height>16</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>R</string>
+ </property>
+ </widget>
</widget>
</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>
- <item>
- <layout class="QGridLayout" name="gridLayout">
- <item row="1" column="0">
- <widget class="QLabel" name="label_5">
- <property name="text">
- <string>M2:</string>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="tab_6">
+ <attribute name="title">
+ <string>Cap</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_14">
+ <item>
+ <widget class="QGroupBox" name="groupBox_9">
+ <property name="title">
+ <string>Model Dimensions (mm)</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout_15">
+ <item>
+ <widget class="QWidget" name="widget" native="true">
+ <property name="minimumSize">
+ <size>
+ <width>140</width>
+ <height>130</height>
+ </size>
</property>
+ <widget class="QLabel" name="label_46">
+ <property name="geometry">
+ <rect>
+ <x>20</x>
+ <y>50</y>
+ <width>111</width>
+ <height>81</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="pixmap">
+ <pixmap resource="ftnoir_tracker_pt.qrc">:/Resources/cap_side.png</pixmap>
+ </property>
+ </widget>
+ <widget class="QSpinBox" name="cap_height_spin">
+ <property name="geometry">
+ <rect>
+ <x>30</x>
+ <y>80</y>
+ <width>46</width>
+ <height>22</height>
+ </rect>
+ </property>
+ <property name="maximum">
+ <number>999</number>
+ </property>
+ </widget>
+ <widget class="QLabel" name="label_54">
+ <property name="geometry">
+ <rect>
+ <x>130</x>
+ <y>50</y>
+ <width>16</width>
+ <height>16</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>R</string>
+ </property>
+ </widget>
+ <widget class="QLabel" name="label_48">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>10</y>
+ <width>46</width>
+ <height>13</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Side</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox" name="cap_length_spin">
+ <property name="geometry">
+ <rect>
+ <x>50</x>
+ <y>40</y>
+ <width>46</width>
+ <height>22</height>
+ </rect>
+ </property>
+ <property name="maximum">
+ <number>999</number>
+ </property>
+ </widget>
</widget>
</item>
- <item row="3" column="2">
- <widget class="QSpinBox" name="m2z_spin">
- <property name="suffix">
- <string/>
+ <item>
+ <widget class="QWidget" name="widget_2" native="true">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
</property>
- <property name="minimum">
- <number>-999</number>
- </property>
- <property name="maximum">
- <number>999</number>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>130</height>
+ </size>
</property>
+ <widget class="QLabel" name="label_49">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>10</y>
+ <width>46</width>
+ <height>13</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Front</string>
+ </property>
+ </widget>
+ <widget class="QLabel" name="label_55">
+ <property name="geometry">
+ <rect>
+ <x>30</x>
+ <y>50</y>
+ <width>16</width>
+ <height>16</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>R</string>
+ </property>
+ </widget>
+ <widget class="QLabel" name="label_47">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>50</y>
+ <width>81</width>
+ <height>81</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="pixmap">
+ <pixmap resource="ftnoir_tracker_pt.qrc">:/Resources/cap_front.png</pixmap>
+ </property>
+ </widget>
+ <widget class="QSpinBox" name="cap_width_spin">
+ <property name="geometry">
+ <rect>
+ <x>50</x>
+ <y>30</y>
+ <width>46</width>
+ <height>22</height>
+ </rect>
+ </property>
+ <property name="maximum">
+ <number>999</number>
+ </property>
+ </widget>
</widget>
</item>
- <item row="3" column="3">
- <widget class="QLabel" name="label_15">
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="tab_7">
+ <attribute name="title">
+ <string>Custom</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_15">
+ <item>
+ <widget class="QGroupBox" name="groupBox_7">
+ <property name="title">
+ <string>Model Dimensions (mm)</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_12">
+ <item>
+ <widget class="QLabel" name="label_56">
<property name="text">
- <string>mm</string>
+ <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Location of the two remaining model points&lt;br/&gt;with respect to the reference point in default pose&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
- <item row="1" column="2">
- <widget class="QSpinBox" name="m2x_spin">
- <property name="minimum">
- <number>-999</number>
+ <item>
+ <spacer name="verticalSpacer_4">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
</property>
- <property name="maximum">
- <number>999</number>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
</property>
- </widget>
+ </spacer>
</item>
- <item row="1" column="3">
- <widget class="QLabel" name="label_6">
- <property name="text">
- <string>mm</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QLabel" name="label_9">
- <property name="text">
- <string>x:</string>
- </property>
- </widget>
- </item>
- <item row="2" column="3">
- <widget class="QLabel" name="label_11">
- <property name="text">
- <string>mm</string>
- </property>
- </widget>
- </item>
- <item row="3" column="1">
- <widget class="QLabel" name="label_14">
- <property name="text">
- <string>z:</string>
- </property>
- </widget>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_14">
+ <item>
+ <spacer name="horizontalSpacer_14">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <layout class="QGridLayout" name="gridLayout_4">
+ <item row="3" column="2">
+ <widget class="QSpinBox" name="m1z_spin">
+ <property name="minimum">
+ <number>-999</number>
+ </property>
+ <property name="maximum">
+ <number>999</number>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QLabel" name="label_58">
+ <property name="text">
+ <string>y:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="2">
+ <widget class="QSpinBox" name="m1y_spin">
+ <property name="minimum">
+ <number>-999</number>
+ </property>
+ <property name="maximum">
+ <number>999</number>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <widget class="QLabel" name="label_57">
+ <property name="text">
+ <string>z:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_60">
+ <property name="text">
+ <string>M1:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="2">
+ <widget class="QSpinBox" name="m1x_spin">
+ <property name="minimum">
+ <number>-999</number>
+ </property>
+ <property name="maximum">
+ <number>999</number>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLabel" name="label_63">
+ <property name="text">
+ <string>x:</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_15">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <layout class="QGridLayout" name="gridLayout_5">
+ <item row="1" column="2">
+ <widget class="QSpinBox" name="m2x_spin">
+ <property name="minimum">
+ <number>-999</number>
+ </property>
+ <property name="maximum">
+ <number>999</number>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLabel" name="label_67">
+ <property name="text">
+ <string>x:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <widget class="QLabel" name="label_69">
+ <property name="text">
+ <string>z:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="2">
+ <widget class="QSpinBox" name="m2y_spin">
+ <property name="minimum">
+ <number>-999</number>
+ </property>
+ <property name="maximum">
+ <number>999</number>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QLabel" name="label_70">
+ <property name="text">
+ <string>y:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_64">
+ <property name="text">
+ <string>M2:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="2">
+ <widget class="QSpinBox" name="m2z_spin">
+ <property name="suffix">
+ <string/>
+ </property>
+ <property name="minimum">
+ <number>-999</number>
+ </property>
+ <property name="maximum">
+ <number>999</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_16">
+ <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>
- <item row="2" column="2">
- <widget class="QSpinBox" name="m2y_spin">
- <property name="minimum">
- <number>-999</number>
+ <item>
+ <spacer name="verticalSpacer_3">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
</property>
- <property name="maximum">
- <number>999</number>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
</property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QLabel" name="label_23">
- <property name="text">
- <string>y:</string>
- </property>
- </widget>
+ </spacer>
</item>
</layout>
- </item>
- </layout>
- </item>
- </layout>
+ </widget>
+ </item>
+ </layout>
+ </widget>
</widget>
</item>
<item>
- <widget class="QGroupBox" name="groupBox_4">
+ <widget class="QGroupBox" name="groupBox_10">
<property name="title">
- <string>Model Translation</string>
+ <string>Model Position (mm)</string>
</property>
- <layout class="QVBoxLayout" name="verticalLayout_9">
+ <layout class="QVBoxLayout" name="verticalLayout_11">
<item>
- <widget class="QLabel" name="label_32">
+ <widget class="QLabel" name="label_59">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Translation from head center to model reference point&lt;br/&gt; in default pose&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
- <layout class="QHBoxLayout" name="horizontalLayout_5">
+ <layout class="QHBoxLayout" name="horizontalLayout_17">
+ <item>
+ <spacer name="horizontalSpacer_17">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
<item>
- <layout class="QGridLayout" name="gridLayout_3">
+ <layout class="QGridLayout" name="gridLayout_6">
<item row="3" column="2">
<widget class="QSpinBox" name="tz_spin">
<property name="suffix">
@@ -714,40 +1175,26 @@
</widget>
</item>
<item row="1" column="1">
- <widget class="QLabel" name="label_28">
+ <widget class="QLabel" name="label_61">
<property name="text">
<string>x:</string>
</property>
</widget>
</item>
<item row="2" column="1">
- <widget class="QLabel" name="label_31">
+ <widget class="QLabel" name="label_62">
<property name="text">
<string>y:</string>
</property>
</widget>
</item>
- <item row="3" column="3">
- <widget class="QLabel" name="label_26">
- <property name="text">
- <string>mm</string>
- </property>
- </widget>
- </item>
<item row="3" column="1">
- <widget class="QLabel" name="label_30">
+ <widget class="QLabel" name="label_66">
<property name="text">
<string>z:</string>
</property>
</widget>
</item>
- <item row="2" column="3">
- <widget class="QLabel" name="label_29">
- <property name="text">
- <string>mm</string>
- </property>
- </widget>
- </item>
<item row="2" column="2">
<widget class="QSpinBox" name="ty_spin">
<property name="minimum">
@@ -758,13 +1205,6 @@
</property>
</widget>
</item>
- <item row="1" column="3">
- <widget class="QLabel" name="label_27">
- <property name="text">
- <string>mm</string>
- </property>
- </widget>
- </item>
<item row="1" column="2">
<widget class="QSpinBox" name="tx_spin">
<property name="minimum">
@@ -776,7 +1216,7 @@
</widget>
</item>
<item row="1" column="0">
- <widget class="QLabel" name="label_25">
+ <widget class="QLabel" name="label_72">
<property name="text">
<string>T:</string>
</property>
@@ -785,13 +1225,13 @@
</layout>
</item>
<item>
- <spacer name="horizontalSpacer_3">
+ <spacer name="horizontalSpacer_18">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
- <width>40</width>
+ <width>20</width>
<height>20</height>
</size>
</property>
@@ -810,55 +1250,24 @@
</property>
</widget>
</item>
+ <item>
+ <spacer name="horizontalSpacer_19">
+ <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>
- <item>
- <widget class="QLabel" name="label_33">
- <property name="text">
- <string>Camera frame = Model frame in default pose:</string>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_7">
- <item>
- <spacer name="horizontalSpacer_5">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QLabel" name="label_24">
- <property name="text">
- <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;z axis: Out of camera to you&lt;br/&gt;y axis: Upwards&lt;br/&gt;x axis: To the right&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer_8">
- <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>
<widget class="QWidget" name="tab_3">
@@ -875,7 +1284,7 @@
</rect>
</property>
<property name="text">
- <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;FTNoIR PointTracker Plugin&lt;br/&gt;Version 0.2&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;by Patrick Ruoff&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;http://ftnoirpt.sourceforge.net/&quot;&gt;&lt;span style=&quot; font-weight:600; text-decoration: underline; color:#0000ff;&quot;&gt;Manual (external)&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;FTNoIR PointTracker Plugin&lt;br/&gt;Version 1.0 beta&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;by Patrick Ruoff&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;http://ftnoirpt.sourceforge.net/&quot;&gt;&lt;span style=&quot; font-weight:600; text-decoration: underline; color:#0000ff;&quot;&gt;Manual (external)&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
@@ -937,19 +1346,27 @@
<tabstop>tabWidget</tabstop>
<tabstop>ok_button</tabstop>
<tabstop>cancel_button</tabstop>
- <tabstop>videowidget_check</tabstop>
<tabstop>sleep_spin</tabstop>
<tabstop>reset_spin</tabstop>
+ <tabstop>videowidget_check</tabstop>
<tabstop>camindex_spin</tabstop>
- <tabstop>f_dspin</tabstop>
<tabstop>res_x_spin</tabstop>
<tabstop>res_y_spin</tabstop>
<tabstop>fps_spin</tabstop>
+ <tabstop>f_dspin</tabstop>
<tabstop>threshold_slider</tabstop>
<tabstop>mindiam_spin</tabstop>
<tabstop>maxdiam_spin</tabstop>
- <tabstop>reset_button</tabstop>
<tabstop>center_button</tabstop>
+ <tabstop>reset_button</tabstop>
+ <tabstop>model_tabs</tabstop>
+ <tabstop>clip_tlength_spin</tabstop>
+ <tabstop>clip_theight_spin</tabstop>
+ <tabstop>clip_bheight_spin</tabstop>
+ <tabstop>clip_blength_spin</tabstop>
+ <tabstop>cap_length_spin</tabstop>
+ <tabstop>cap_height_spin</tabstop>
+ <tabstop>cap_width_spin</tabstop>
<tabstop>m1x_spin</tabstop>
<tabstop>m1y_spin</tabstop>
<tabstop>m1z_spin</tabstop>
diff --git a/FTNoIR_Tracker_PT/FTNoIR_Tracker_PT_vc9.vcproj b/FTNoIR_Tracker_PT/FTNoIR_Tracker_PT_vc9.vcproj
index 51d2a38a..3c895e51 100644
--- a/FTNoIR_Tracker_PT/FTNoIR_Tracker_PT_vc9.vcproj
+++ b/FTNoIR_Tracker_PT/FTNoIR_Tracker_PT_vc9.vcproj
@@ -4,6 +4,7 @@
Version="9,00"
Name="FTNoIR_Tracker_PT"
ProjectGUID="{7A2A2560-9253-4CC8-A9D5-4B9D9C224D9D}"
+ RootNamespace="FTNoIR_Tracker_PT"
Keyword="Qt4VSv1.0"
TargetFrameworkVersion="0"
>
@@ -39,8 +40,6 @@
<Tool
Name="VCCLCompilerTool"
Optimization="2"
- FavorSizeOrSpeed="1"
- WholeProgramOptimization="true"
AdditionalIncludeDirectories="&quot;.&quot;;&quot;.\GeneratedFiles&quot;;&quot;.\GeneratedFiles\$(ConfigurationName)&quot;;&quot;$(QTDIR)\include&quot;;&quot;$(QTDIR)\include\QtCore&quot;;&quot;$(QTDIR)\include\QtGui&quot;;&quot;$(OPENCV_DIR)\include&quot;;&quot;$(BOOST_DIR)&quot;;&quot;$(QTDIR)\include\QtOpenGL&quot;"
PreprocessorDefinitions="UNICODE;WIN32;QT_LARGEFILE_SUPPORT;QT_DLL;QT_NO_DEBUG;NDEBUG;QT_CORE_LIB;QT_GUI_LIB;FTNOIR_TRACKER_BASE_LIB;QT_OPENGL_LIB"
RuntimeLibrary="2"
@@ -58,12 +57,12 @@
/>
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="qtmain.lib QtCore4.lib QtGui4.lib QtOpenGL4.lib opengl32.lib glu32.lib opencv_core242.lib opencv_highgui242.lib opencv_imgproc242.lib libjasper.lib libjpeg.lib libpng.lib libtiff.lib vfw32.lib"
+ AdditionalDependencies="qtmain.lib QtCore4.lib QtGui4.lib QtOpenGL4.lib opengl32.lib glu32.lib opencv_core242.lib opencv_imgproc242.lib opencv_calib3d242.lib videoInput_vc9.lib"
OutputFile="$(OutDir)\$(ProjectName).dll"
- AdditionalLibraryDirectories="&quot;$(QTDIR)\lib&quot;;&quot;$(OPENCV_DIR)\x86\vc9\static_lib&quot;"
+ AdditionalLibraryDirectories="&quot;$(QTDIR)\lib&quot;;&quot;$(OPENCV_DIR)\x86\vc9\static_lib&quot;;&quot;$(ProjectDir)\videoInput&quot;"
+ IgnoreDefaultLibraryNames="atlthunk.lib;libcmt"
GenerateDebugInformation="false"
SubSystem="2"
- LinkTimeCodeGeneration="1"
/>
<Tool
Name="VCALinkTool"
@@ -89,7 +88,7 @@
</Configuration>
<Configuration
Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)\bin"
+ OutputDirectory="$(SolutionDir)/bin_dbg"
IntermediateDirectory="$(SolutionDir)\$(ConfigurationName)"
ConfigurationType="2"
>
@@ -128,9 +127,10 @@
/>
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="qtmain.lib QtCore4.lib QtGui4.lib QtOpenGL4.lib opengl32.lib glu32.lib opencv_core242d.lib opencv_highgui242d.lib opencv_imgproc242d.lib opencv_calib3d242d.lib"
- OutputFile="$(OutDir)\$(ProjectName)d.dll"
- AdditionalLibraryDirectories="&quot;$(QTDIR)\lib&quot;;&quot;$(OPENCV_DIR)\x86\vc9\lib&quot;"
+ AdditionalDependencies="qtmaind.lib QtCored4.lib QtGuid4.lib QtOpenGLd4.lib opengl32.lib glu32.lib opencv_core242d.lib opencv_imgproc242d.lib opencv_calib3d242d.lib videoInput_vc9.lib"
+ OutputFile="$(OutDir)\$(ProjectName).dll"
+ AdditionalLibraryDirectories="&quot;$(QTDIR)\lib&quot;;&quot;$(OPENCV_DIR)\x86\vc9\lib&quot;;&quot;$(ProjectDir)\videoInput&quot;"
+ IgnoreDefaultLibraryNames="atlthunk.lib;libcmt"
GenerateDebugInformation="true"
SubSystem="2"
/>
@@ -194,6 +194,10 @@
>
</File>
<File
+ RelativePath=".\timer.cpp"
+ >
+ </File>
+ <File
RelativePath=".\trans_calib.cpp"
>
</File>
@@ -288,6 +292,10 @@
>
</File>
<File
+ RelativePath=".\timer.h"
+ >
+ </File>
+ <File
RelativePath=".\trans_calib.h"
>
</File>
@@ -382,46 +390,6 @@
/>
</FileConfiguration>
</File>
- <File
- RelativePath=".\Resources\icon.ico"
- >
- <FileConfiguration
- Name="Release|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCustomBuildTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCustomBuildTool"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath=".\Resources\Logo_IR.png"
- >
- <FileConfiguration
- Name="Release|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCustomBuildTool"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCustomBuildTool"
- />
- </FileConfiguration>
- </File>
</Filter>
<Filter
Name="Generated Files"
diff --git a/FTNoIR_Tracker_PT/Resources/cap_front.png b/FTNoIR_Tracker_PT/Resources/cap_front.png
new file mode 100644
index 00000000..14207a67
--- /dev/null
+++ b/FTNoIR_Tracker_PT/Resources/cap_front.png
Binary files differ
diff --git a/FTNoIR_Tracker_PT/Resources/cap_side.png b/FTNoIR_Tracker_PT/Resources/cap_side.png
new file mode 100644
index 00000000..5ad4ee65
--- /dev/null
+++ b/FTNoIR_Tracker_PT/Resources/cap_side.png
Binary files differ
diff --git a/FTNoIR_Tracker_PT/Resources/clip_front.png b/FTNoIR_Tracker_PT/Resources/clip_front.png
new file mode 100644
index 00000000..04880138
--- /dev/null
+++ b/FTNoIR_Tracker_PT/Resources/clip_front.png
Binary files differ
diff --git a/FTNoIR_Tracker_PT/Resources/clip_side.png b/FTNoIR_Tracker_PT/Resources/clip_side.png
new file mode 100644
index 00000000..72667ac7
--- /dev/null
+++ b/FTNoIR_Tracker_PT/Resources/clip_side.png
Binary files differ
diff --git a/FTNoIR_Tracker_PT/camera.cpp b/FTNoIR_Tracker_PT/camera.cpp
index 1a233cef..fc11c738 100644
--- a/FTNoIR_Tracker_PT/camera.cpp
+++ b/FTNoIR_Tracker_PT/camera.cpp
@@ -1,57 +1,95 @@
+/* Copyright (c) 2012 Patrick Ruoff
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ */
+
#include "camera.h"
+#include <QDebug>
using namespace cv;
// ----------------------------------------------------------------------------
-Camera::Camera()
- : dt_valid(0), dt_mean(0), cap(NULL), active_index(-1)
-{}
-
-Camera::~Camera()
-{
- if (cap) cvReleaseCapture(&cap);
-}
-
void Camera::set_index(int index)
{
- if (index == active_index) return;
- if (cap) cvReleaseCapture(&cap);
+ if (desired_index != index)
+ {
+ desired_index = index;
+ _set_index();
- cap = cvCreateCameraCapture(index);
+ // reset fps
+ dt_valid = 0;
+ dt_mean = 0;
+ active_index = index;
+ }
+}
- // extract camera info
- if (cap)
+void Camera::set_f(float f)
+{
+ if (cam_desired.f != f)
{
- cam_info.res_x = cvGetCaptureProperty(cap, CV_CAP_PROP_FRAME_WIDTH);
- cam_info.res_y = cvGetCaptureProperty(cap, CV_CAP_PROP_FRAME_HEIGHT);
+ cam_desired.f = f;
+ _set_f();
+ }
+}
+void Camera::set_fps(int fps)
+{
+ if (cam_desired.fps != fps)
+ {
+ cam_desired.fps = fps;
+ _set_fps();
}
+}
- active_index = index;
- dt_mean = 0; // reset fps calculation
+void Camera::set_res(int x_res, int y_res)
+{
+ if (cam_desired.res_x != x_res || cam_desired.res_y != y_res)
+ {
+ cam_desired.res_x = x_res;
+ cam_desired.res_y = y_res;
+ _set_res();
+ }
}
-bool Camera::set_fps(int fps)
+bool Camera::get_frame(float dt, cv::Mat* frame)
{
- return cap && cvSetCaptureProperty(cap, CV_CAP_PROP_FPS, fps);
+ bool new_frame = _get_frame(frame);
+ // measure fps of valid frames
+ const float dt_smoothing_const = 0.9;
+ dt_valid += dt;
+ if (new_frame)
+ {
+ dt_mean = dt_smoothing_const * dt_mean + (1.0 - dt_smoothing_const) * dt_valid;
+ cam_info.fps = 1.0 / dt_mean;
+ dt_valid = 0;
+ }
+ return new_frame;
}
-bool Camera::set_res(int x_res, int y_res)
+// ----------------------------------------------------------------------------
+/*
+void CVCamera::start()
{
+ cap = cvCreateCameraCapture(desired_index);
+ // extract camera info
if (cap)
{
- if (x_res == cam_info.res_x && y_res == cam_info.res_y) return true;
- cvSetCaptureProperty(cap, CV_CAP_PROP_FRAME_WIDTH, x_res);
- cvSetCaptureProperty(cap, CV_CAP_PROP_FRAME_HEIGHT, y_res);
+ active = true;
+ active_index = desired_index;
cam_info.res_x = cvGetCaptureProperty(cap, CV_CAP_PROP_FRAME_WIDTH);
cam_info.res_y = cvGetCaptureProperty(cap, CV_CAP_PROP_FRAME_HEIGHT);
- if (x_res == cam_info.res_x && y_res == cam_info.res_y) return true;
}
- return false;
}
-cv::Mat Camera::get_frame(float dt)
+void CVCamera::stop()
+{
+ if (cap) cvReleaseCapture(&cap);
+ active = false;
+}
+
+bool CVCamera::_get_frame(Mat* frame)
{
- cv::Mat frame;
if (cap && cvGrabFrame(cap) != 0)
{
// retrieve frame
@@ -59,24 +97,130 @@ cv::Mat Camera::get_frame(float dt)
if(_img)
{
if(_img->origin == IPL_ORIGIN_TL)
- frame = Mat(_img);
+ *frame = Mat(_img);
else
{
Mat temp(_img);
- flip(temp, frame, 0);
- }
+ flip(temp, *frame, 0);
+ }
+ return true;
}
}
+ return false;
+}
- // measure fps of valid frames
- const float dt_smoothing_const = 0.9;
- dt_valid += dt;
- if (!frame.empty())
+void CVCamera::_set_index()
+{
+ if (active) restart();
+}
+
+void CVCamera::_set_f()
+{
+ cam_info.f = cam_desired.f;
+}
+
+void CVCamera::_set_fps()
+{
+ if (cap) cvSetCaptureProperty(cap, CV_CAP_PROP_FPS, cam_desired.fps);
+}
+
+void CVCamera::_set_res()
+{
+ if (cap)
{
- dt_mean = dt_smoothing_const * dt_mean + (1.0 - dt_smoothing_const) * dt_valid;
- cam_info.fps = 1.0 / dt_mean;
- dt_valid = 0;
+ cvSetCaptureProperty(cap, CV_CAP_PROP_FRAME_WIDTH, cam_desired.res_x);
+ cvSetCaptureProperty(cap, CV_CAP_PROP_FRAME_HEIGHT, cam_desired.res_y);
+ cam_info.res_x = cvGetCaptureProperty(cap, CV_CAP_PROP_FRAME_WIDTH);
+ cam_info.res_y = cvGetCaptureProperty(cap, CV_CAP_PROP_FRAME_HEIGHT);
+ }
+}
+*/
+
+// ----------------------------------------------------------------------------
+VICamera::VICamera() : frame_buffer(NULL)
+{
+ VI.listDevices();
+}
+
+void VICamera::start()
+{
+ if (desired_index >= 0)
+ {
+
+
+ if (cam_desired.res_x == 0 || cam_desired.res_y == 0)
+ VI.setupDevice(desired_index);
+ else
+ VI.setupDevice(desired_index, cam_desired.res_x, cam_desired.res_y);
+
+ active = true;
+ active_index = desired_index;
+
+ cam_info.res_x = VI.getWidth(active_index);
+ cam_info.res_y = VI.getHeight(active_index);
+ new_frame = cv::Mat(cam_info.res_y, cam_info.res_x, CV_8UC3);
+ // If matrix is not continuous we have to copy manually via frame_buffer
+ if (!new_frame.isContinuous()) {
+ unsigned int size = VI.getSize(active_index);
+ frame_buffer = new unsigned char[size];
+ }
+ }
+}
+
+void VICamera::stop()
+{
+ if (active)
+ {
+ VI.stopDevice(active_index);
}
+ if (frame_buffer)
+ {
+ delete[] frame_buffer;
+ frame_buffer = NULL;
+ }
+ active = false;
+}
+
+bool VICamera::_get_frame(Mat* frame)
+{
+ if (active && VI.isFrameNew(active_index))
+ {
+ if (new_frame.isContinuous())
+ {
+ VI.getPixels(active_index, new_frame.data, false, true);
+ }
+ else
+ {
+ // If matrix is not continuous we have to copy manually via frame_buffer
+ VI.getPixels(active_index, frame_buffer, false, true);
+ new_frame = cv::Mat(cam_info.res_y, cam_info.res_x, CV_8UC3, frame_buffer).clone();
+ }
+ *frame = new_frame;
+ return true;
+ }
+ return false;
+}
+
+void VICamera::_set_index()
+{
+ if (active) restart();
+}
+
+void VICamera::_set_f()
+{
+ cam_info.f = cam_desired.f;
+}
+
+void VICamera::_set_fps()
+{
+ bool was_active = active;
+ if (active) stop();
+ VI.setIdealFramerate(desired_index, cam_desired.fps);
+ if (was_active) start();
+}
+
+void VICamera::_set_res()
+{
+ if (active) restart();
+}
- return frame;
-} \ No newline at end of file
diff --git a/FTNoIR_Tracker_PT/camera.h b/FTNoIR_Tracker_PT/camera.h
index f26a7a8f..cd1f0842 100644
--- a/FTNoIR_Tracker_PT/camera.h
+++ b/FTNoIR_Tracker_PT/camera.h
@@ -9,10 +9,13 @@
#define CAMERA_H
#include <opencv2/opencv.hpp>
+#include "videoInput/videoInput.h"
// ----------------------------------------------------------------------------
struct CamInfo
{
+ CamInfo() : res_x(0), res_y(0), fps(0), f(1) {}
+
int res_x;
int res_y;
int fps;
@@ -20,30 +23,94 @@ struct CamInfo
};
// ----------------------------------------------------------------------------
+// base class for cameras
class Camera
{
public:
-
- Camera();
- ~Camera();
+ Camera() : dt_valid(0), dt_mean(0), desired_index(0), active_index(-1), active(false) {}
+ virtual ~Camera() {}
+
+ // start/stop capturing
+ virtual void start() = 0;
+ virtual void stop() = 0;
+ void restart() { stop(); start(); }
void set_index(int index);
- void set_f(float f) { cam_info.f = f; }
- bool set_fps(int fps);
- bool set_res(int x_res, int y_res);
+ void set_f(float f);
+ void set_fps(int fps);
+ void set_res(int x_res, int y_res);
// gets a frame from the camera, dt: time since last call in seconds
- cv::Mat get_frame(float dt);
+ bool get_frame(float dt, cv::Mat* frame);
- // WARNING: returned reference is valid as long as object
+ // WARNING: returned references are valid as long as object
const CamInfo& get_info() const { return cam_info; }
+ const CamInfo& get_desired() const { return cam_desired; }
protected:
+ // get a frame from the camera
+ virtual bool _get_frame(cv::Mat* frame) = 0;
+
+ // update the camera
+ virtual void _set_index() = 0;
+ virtual void _set_f() = 0;
+ virtual void _set_fps() = 0;
+ virtual void _set_res() = 0;
+
+ bool active;
+ int desired_index;
int active_index;
- CvCapture* cap;
CamInfo cam_info;
+ CamInfo cam_desired;
float dt_valid;
float dt_mean;
};
+
+// ----------------------------------------------------------------------------
+// OpenCV camera
+/*
+class CVCamera : public Camera
+{
+public:
+ CVCamera() : cap(NULL) {}
+ ~CVCamera() { stop(); }
+
+ void start();
+ void stop();
+
+protected:
+ bool _get_frame(cv::Mat* frame);
+ void _set_index();
+ void _set_f();
+ void _set_fps();
+ void _set_res();
+
+ CvCapture* cap;
+};
+*/
+
+// ----------------------------------------------------------------------------
+// videoInput camera
+class VICamera : public Camera
+{
+public:
+ VICamera();
+ ~VICamera() { stop(); }
+
+ void start();
+ void stop();
+
+protected:
+ bool _get_frame(cv::Mat* frame);
+ void _set_index();
+ void _set_f();
+ void _set_fps();
+ void _set_res();
+
+ videoInput VI;
+ cv::Mat new_frame;
+ unsigned char* frame_buffer;
+};
+
#endif //CAMERA_H
diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp b/FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp
index aa0e4272..13522863 100644
--- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp
+++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp
@@ -9,25 +9,30 @@
#include <QHBoxLayout>
#include <cmath>
#include <QDebug>
+#include <QFile>
+#include <QCoreApplication>
using namespace std;
using namespace cv;
using namespace boost;
+//#define PT_PERF_LOG //log performance
+
//-----------------------------------------------------------------------------
Tracker::Tracker()
: frame_count(0), commands(0), video_widget(NULL)
{
- qDebug()<<"Tracker Const";
+ qDebug()<<"Tracker::Tracker";
TrackerSettings settings;
settings.load_ini();
apply(settings);
- qDebug()<<"Tracker Starting";
+ camera.start();
start();
}
Tracker::~Tracker()
{
+ qDebug()<<"Tracker::~Tracker";
set_command(ABORT);
wait();
if (video_widget) delete video_widget;
@@ -47,8 +52,17 @@ void Tracker::reset_command(Command command)
void Tracker::run()
{
- qDebug()<<"Tracker Thread started";
+ qDebug()<<"Tracker:: Thread started";
+
+#ifdef PT_PERF_LOG
+ QFile log_file(QCoreApplication::applicationDirPath() + "/PointTrackerPerformance.txt");
+ if (!log_file.open(QIODevice::WriteOnly | QIODevice::Text)) return;
+ QTextStream log_stream(&log_file);
+#endif
+
time.start();
+ float dt;
+ bool new_frame;
forever
{
{
@@ -58,47 +72,55 @@ void Tracker::run()
if (commands & PAUSE) continue;
commands = 0;
- float dt = time.elapsed() / 1000.0;
+ dt = time.elapsed() / 1000.0;
time.restart();
- frame = camera.get_frame(dt);
- if (!frame.empty())
+ new_frame = camera.get_frame(dt, &frame);
+ 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);
frame_count++;
}
+#ifdef PT_PERF_LOG
+ log_stream<<"dt: "<<dt;
+ if (!frame.empty()) log_stream<<" fps: "<<camera.get_info().fps;
+ log_stream<<"\n";
+#endif
}
msleep(sleep_time);
}
- qDebug()<<"Tracker Thread stopping";
+
+ qDebug()<<"Tracker:: Thread stopping";
}
void Tracker::apply(const TrackerSettings& settings)
{
- qDebug()<<"Tracker::apply";
+ qDebug()<<"Tracker:: Applying settings";
QMutexLocker lock(&mutex);
camera.set_index(settings.cam_index);
- camera.set_f(settings.cam_f);
- camera.set_res(settings.cam_res_x, settings.cam_res_y);
+ camera.set_res(settings.cam_res_x, settings.cam_res_y);
camera.set_fps(settings.cam_fps);
+ camera.set_f(settings.cam_f);
point_extractor.threshold_val = settings.threshold;
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));
sleep_time = settings.sleep_time;
- // TODO: reset time
+ point_tracker.dt_reset = settings.reset_time / 1000.0;
draw_frame = settings.video_widget;
t_MH = settings.t_MH;
}
void Tracker::reset()
{
- //TODO
+ QMutexLocker lock(&mutex);
+ point_tracker.reset();
}
void Tracker::center()
{
+ point_tracker.reset(); // we also do a reset here since there is no reset shortkey yet
QMutexLocker lock(&mutex);
FrameTrafo X_CM_0 = point_tracker.get_pose();
FrameTrafo X_MH(Matx33f::eye(), t_MH);
@@ -112,7 +134,7 @@ void Tracker::Initialize(QFrame *videoframe)
const int VIDEO_FRAME_WIDTH = 252;
const int VIDEO_FRAME_HEIGHT = 189;
- qDebug("Tracker::Initialize()");
+ qDebug("Tracker::Initialize");
// setup video frame
videoframe->setAttribute(Qt::WA_NativeWindow);
videoframe->show();
diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt.h b/FTNoIR_Tracker_PT/ftnoir_tracker_pt.h
index 5461d133..bfc262b3 100644
--- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt.h
+++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt.h
@@ -14,6 +14,7 @@
#include "point_extractor.h"
#include "point_tracker.h"
#include "video_widget.h"
+#include "timer.h"
#include <QThread>
#include <QMutex>
@@ -57,7 +58,7 @@ protected:
void reset_command(Command command);
int commands;
- Camera camera;
+ VICamera camera;
PointExtractor point_extractor;
PointTracker point_tracker;
cv::Vec3f t_MH;
@@ -67,7 +68,7 @@ protected:
long frame_count;
VideoWidget* video_widget;
- QTime time;
+ Timer time;
};
#endif // FTNOIR_TRACKER_PT_H
diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt.qrc b/FTNoIR_Tracker_PT/ftnoir_tracker_pt.qrc
index d1dab18a..eb1fba2c 100644
--- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt.qrc
+++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt.qrc
@@ -1,6 +1,10 @@
<RCC>
- <qresource prefix="/">
- <file>Resources/icon.ico</file>
- <file>Resources/Logo_IR.png</file>
- </qresource>
+ <qresource prefix="/">
+ <file>Resources/icon.ico</file>
+ <file>Resources/cap_front.png</file>
+ <file>Resources/cap_side.png</file>
+ <file>Resources/clip_front.png</file>
+ <file>Resources/clip_side.png</file>
+ <file>Resources/Logo_IR.png</file>
+ </qresource>
</RCC>
diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.cpp b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.cpp
index fca18fee..357cd67f 100644
--- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.cpp
+++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.cpp
@@ -20,6 +20,7 @@ TrackerDialog::TrackerDialog()
ui.setupUi( this );
settings.load_ini();
+ dialog_settings.load_ini();
// initialize ui values
ui.videowidget_check->setChecked(settings.video_widget);
@@ -33,39 +34,53 @@ TrackerDialog::TrackerDialog()
ui.threshold_slider->setValue(settings.threshold);
ui.mindiam_spin->setValue(settings.min_point_size);
ui.maxdiam_spin->setValue(settings.max_point_size);
-
- ui.m1x_spin->setValue(settings.M01[0]);
- ui.m1y_spin->setValue(settings.M01[1]);
- ui.m1z_spin->setValue(settings.M01[2]);
- ui.m2x_spin->setValue(settings.M02[0]);
- ui.m2y_spin->setValue(settings.M02[1]);
- ui.m2z_spin->setValue(settings.M02[2]);
+ ui.model_tabs->setCurrentIndex(dialog_settings.active_model_panel);
+ ui.clip_bheight_spin->setValue(dialog_settings.clip_by);
+ ui.clip_blength_spin->setValue(dialog_settings.clip_bz);
+ ui.clip_theight_spin->setValue(dialog_settings.clip_ty);
+ ui.clip_tlength_spin->setValue(dialog_settings.clip_tz);
+ ui.cap_width_spin->setValue(dialog_settings.cap_x);
+ ui.cap_height_spin->setValue(dialog_settings.cap_y);
+ ui.cap_length_spin->setValue(dialog_settings.cap_z);
+ ui.m1x_spin->setValue(dialog_settings.M01x);
+ ui.m1y_spin->setValue(dialog_settings.M01y);
+ ui.m1z_spin->setValue(dialog_settings.M01z);
+ ui.m2x_spin->setValue(dialog_settings.M02x);
+ ui.m2y_spin->setValue(dialog_settings.M02y);
+ ui.m2z_spin->setValue(dialog_settings.M02z);
ui.tx_spin->setValue(settings.t_MH[0]);
ui.ty_spin->setValue(settings.t_MH[1]);
ui.tz_spin->setValue(settings.t_MH[2]);
-
+
// connect Qt signals and slots
- connect( ui.videowidget_check,SIGNAL(toggled(bool)), this,SLOT(set_video_widget(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)) );
- connect( ui.f_dspin,SIGNAL(valueChanged(double)), this,SLOT(set_cam_f(double)) );
- 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.threshold_slider,SIGNAL(sliderMoved(int)), this,SLOT(set_threshold(int)) );
- connect( ui.mindiam_spin,SIGNAL(valueChanged(int)), this,SLOT(set_min_point_size(int)) );
- connect( ui.maxdiam_spin,SIGNAL(valueChanged(int)), this,SLOT(set_max_point_size(int)) );
-
- connect( ui.m1x_spin,SIGNAL(valueChanged(int)), this,SLOT(set_m1x(int)) );
- connect( ui.m1y_spin,SIGNAL(valueChanged(int)), this,SLOT(set_m1y(int)) );
- connect( ui.m1z_spin,SIGNAL(valueChanged(int)), this,SLOT(set_m1z(int)) );
- connect( ui.m2x_spin,SIGNAL(valueChanged(int)), this,SLOT(set_m2x(int)) );
- connect( ui.m2y_spin,SIGNAL(valueChanged(int)), this,SLOT(set_m2y(int)) );
- connect( ui.m2z_spin,SIGNAL(valueChanged(int)), this,SLOT(set_m2z(int)) );
- connect( ui.tx_spin,SIGNAL(valueChanged(int)), this,SLOT(set_tx(int)) );
- connect( ui.ty_spin,SIGNAL(valueChanged(int)), this,SLOT(set_ty(int)) );
- connect( ui.tz_spin,SIGNAL(valueChanged(int)), this,SLOT(set_tz(int)) );
+ connect( ui.videowidget_check,SIGNAL(toggled(bool)), this,SLOT(set_video_widget(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)) );
+ connect( ui.f_dspin,SIGNAL(valueChanged(double)), this,SLOT(set_cam_f(double)) );
+ 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.threshold_slider,SIGNAL(sliderMoved(int)), this,SLOT(set_threshold(int)) );
+ connect( ui.mindiam_spin,SIGNAL(valueChanged(int)), this,SLOT(set_min_point_size(int)) );
+ connect( ui.maxdiam_spin,SIGNAL(valueChanged(int)), this,SLOT(set_max_point_size(int)) );
+ connect( ui.model_tabs,SIGNAL(currentChanged(int)), this,SLOT(set_model(int)) );
+ connect( ui.clip_theight_spin,SIGNAL(valueChanged(int)), this,SLOT(set_clip_t_height(int)) );
+ connect( ui.clip_tlength_spin,SIGNAL(valueChanged(int)), this,SLOT(set_clip_t_length(int)) );
+ connect( ui.clip_bheight_spin,SIGNAL(valueChanged(int)), this,SLOT(set_clip_b_height(int)) );
+ connect( ui.clip_blength_spin,SIGNAL(valueChanged(int)), this,SLOT(set_clip_b_length(int)) );
+ connect( ui.cap_width_spin,SIGNAL(valueChanged(int)), this,SLOT(set_cap_width(int)) );
+ connect( ui.cap_height_spin,SIGNAL(valueChanged(int)), this,SLOT(set_cap_height(int)) );
+ connect( ui.cap_length_spin,SIGNAL(valueChanged(int)), this,SLOT(set_cap_length(int)) );
+ connect( ui.m1x_spin,SIGNAL(valueChanged(int)), this,SLOT(set_m1x(int)) );
+ connect( ui.m1y_spin,SIGNAL(valueChanged(int)), this,SLOT(set_m1y(int)) );
+ connect( ui.m1z_spin,SIGNAL(valueChanged(int)), this,SLOT(set_m1z(int)) );
+ connect( ui.m2x_spin,SIGNAL(valueChanged(int)), this,SLOT(set_m2x(int)) );
+ connect( ui.m2y_spin,SIGNAL(valueChanged(int)), this,SLOT(set_m2y(int)) );
+ connect( ui.m2z_spin,SIGNAL(valueChanged(int)), this,SLOT(set_m2z(int)) );
+ connect( ui.tx_spin,SIGNAL(valueChanged(int)), this,SLOT(set_tx(int)) );
+ connect( ui.ty_spin,SIGNAL(valueChanged(int)), this,SLOT(set_ty(int)) );
+ connect( ui.tz_spin,SIGNAL(valueChanged(int)), this,SLOT(set_tz(int)) );
connect( ui.tcalib_button,SIGNAL(toggled(bool)), this,SLOT(startstop_trans_calib(bool)) );
@@ -84,6 +99,65 @@ TrackerDialog::~TrackerDialog()
qDebug()<<"TrackerDialog::~TrackerDialog";
}
+void TrackerDialog::set_clip()
+{
+ settings.M01[0] = 0;
+ settings.M01[1] = dialog_settings.clip_ty;
+ settings.M01[2] = -dialog_settings.clip_tz;
+ settings.M02[0] = 0;
+ settings.M02[1] = -dialog_settings.clip_by;
+ settings.M02[2] = -dialog_settings.clip_bz;
+
+ settings_changed();
+}
+
+void TrackerDialog::set_cap()
+{
+ settings.M01[0] = -dialog_settings.cap_x;
+ settings.M01[1] = -dialog_settings.cap_y;
+ settings.M01[2] = -dialog_settings.cap_z;
+ settings.M02[0] = dialog_settings.cap_x;
+ settings.M02[1] = -dialog_settings.cap_y;
+ settings.M02[2] = -dialog_settings.cap_z;
+
+ settings_changed();
+}
+
+void TrackerDialog::set_custom()
+{
+ settings.M01[0] = dialog_settings.M01x;
+ settings.M01[1] = dialog_settings.M01y;
+ settings.M01[2] = dialog_settings.M01z;
+ settings.M02[0] = dialog_settings.M02x;
+ settings.M02[1] = dialog_settings.M02y;
+ settings.M02[2] = dialog_settings.M02z;
+
+ settings_changed();
+}
+
+void TrackerDialog::set_model(int val)
+{
+ dialog_settings.active_model_panel = val;
+
+ switch (val) {
+
+ case TrackerDialogSettings::MODEL_CLIP:
+ set_clip();
+ break;
+
+ case TrackerDialogSettings::MODEL_CAP:
+ set_cap();
+ break;
+
+ case TrackerDialogSettings::MODEL_CUSTOM:
+ set_custom();
+ break;
+
+ default:
+ break;
+ }
+}
+
void TrackerDialog::startstop_trans_calib(bool start)
{
if (start)
@@ -135,6 +209,7 @@ void TrackerDialog::doReset()
void TrackerDialog::doOK()
{
settings.save_ini();
+ dialog_settings.save_ini();
close();
}
@@ -146,6 +221,7 @@ void TrackerDialog::doCancel()
switch (ret) {
case QMessageBox::Save:
settings.save_ini();
+ dialog_settings.save_ini();
close();
break;
case QMessageBox::Discard:
diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.h b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.h
index e5a27dc5..68baf87a 100644
--- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.h
+++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.h
@@ -44,15 +44,23 @@ protected slots:
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(); }
- void set_m1x(int val) { settings.M01[0] = val; settings_changed(); }
- void set_m1y(int val) { settings.M01[1] = val; settings_changed(); }
- void set_m1z(int val) { settings.M01[2] = val; settings_changed(); }
- void set_m2x(int val) { settings.M02[0] = val; settings_changed(); }
- void set_m2y(int val) { settings.M02[1] = val; settings_changed(); }
- void set_m2z(int val) { settings.M02[2] = val; settings_changed(); }
- void set_tx(int val) { settings.t_MH[0] = val; settings_changed(); }
- void set_ty(int val) { settings.t_MH[1] = val; settings_changed(); }
- void set_tz(int val) { settings.t_MH[2] = val; settings_changed(); }
+ void set_clip_t_height(int val) { dialog_settings.clip_ty = val; set_clip(); }
+ void set_clip_t_length(int val) { dialog_settings.clip_tz = val; set_clip(); }
+ void set_clip_b_height(int val) { dialog_settings.clip_by = val; set_clip(); }
+ void set_clip_b_length(int val) { dialog_settings.clip_bz = val; set_clip(); }
+ void set_cap_width(int val) { dialog_settings.cap_x = val; set_cap(); }
+ void set_cap_height(int val) { dialog_settings.cap_y = val; set_cap(); }
+ void set_cap_length(int val) { dialog_settings.cap_z = val; set_cap(); }
+ void set_m1x(int val) { dialog_settings.M01x = val; set_custom(); }
+ void set_m1y(int val) { dialog_settings.M01y = val; set_custom(); }
+ void set_m1z(int val) { dialog_settings.M01z = val; set_custom(); }
+ void set_m2x(int val) { dialog_settings.M02x = val; set_custom(); }
+ void set_m2y(int val) { dialog_settings.M02y = val; set_custom(); }
+ void set_m2z(int val) { dialog_settings.M02z = val; set_custom(); }
+ void set_tx(int val) { settings.t_MH[0] = val; settings_changed(); }
+ void set_ty(int val) { settings.t_MH[1] = val; settings_changed(); }
+ void set_tz(int val) { settings.t_MH[2] = val; settings_changed(); }
+ void set_model(int model_id);
void doCenter();
void doReset();
@@ -65,9 +73,14 @@ protected slots:
void poll_tracker_info();
protected:
+ void set_clip();
+ void set_cap();
+ void set_custom();
+
void settings_changed();
TrackerSettings settings;
+ TrackerDialogSettings dialog_settings;
bool settings_dirty;
Tracker* tracker;
diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dll.cpp b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dll.cpp
index d41e5db2..9ceaa321 100644
--- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dll.cpp
+++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dll.cpp
@@ -12,7 +12,7 @@
//-----------------------------------------------------------------------------
void TrackerDll::getFullName(QString *strToBeFilled)
{
- *strToBeFilled = "PointTracker 0.2";
+ *strToBeFilled = "PointTracker 1.0 beta";
}
void TrackerDll::getShortName(QString *strToBeFilled)
diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_settings.cpp b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_settings.cpp
index d67ced5e..036b0558 100644
--- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_settings.cpp
+++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_settings.cpp
@@ -13,8 +13,8 @@
void TrackerSettings::load_ini()
{
qDebug("TrackerSettings::load_ini()");
- QSettings settings("Abbequerque Inc.", "FaceTrackNoIR"); // Registry settings (in HK_USER)
+ QSettings settings("Abbequerque Inc.", "FaceTrackNoIR"); // Registry settings (in HK_USER)
QString currentFile = settings.value( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString();
QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file)
@@ -39,7 +39,7 @@ void TrackerSettings::load_ini()
t_MH[2] = iniFile.value("tMHz", 0).toFloat();
video_widget = iniFile.value("VideoWidget", true).toBool();
sleep_time = iniFile.value("SleepTime", 10).toInt();
- reset_time = iniFile.value("ResetTime", 3).toInt();
+ reset_time = iniFile.value("ResetTime", 1000).toInt();
iniFile.endGroup();
}
@@ -47,8 +47,8 @@ void TrackerSettings::load_ini()
void TrackerSettings::save_ini() const
{
qDebug("TrackerSettings::save_ini()");
- QSettings settings("Abbequerque Inc.", "FaceTrackNoIR"); // Registry settings (in HK_USER)
+ QSettings settings("Abbequerque Inc.", "FaceTrackNoIR"); // Registry settings (in HK_USER)
QString currentFile = settings.value( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString();
QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file)
@@ -76,4 +76,57 @@ void TrackerSettings::save_ini() const
iniFile.setValue("ResetTime", reset_time);
iniFile.endGroup();
+}
+
+//-----------------------------------------------------------------------------
+void TrackerDialogSettings::load_ini()
+{
+ qDebug("TrackerDialogSettings::load_ini()");
+
+ QSettings settings("Abbequerque Inc.", "FaceTrackNoIR"); // Registry settings (in HK_USER)
+ QString currentFile = settings.value( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString();
+ QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file)
+
+ iniFile.beginGroup( "PointTrackerDialog" );
+
+ active_model_panel = iniFile.value("ActiveModelPanel", MODEL_CLIP).toInt();
+ M01x = iniFile.value("CustomM01x", 0).toInt();
+ M01y = iniFile.value("CustomM01y", 40).toInt();
+ M01z = iniFile.value("CustomM01z", -30).toInt();
+ M02x = iniFile.value("CustomM02x", 0).toInt();
+ M02y = iniFile.value("CustomM02y", -70).toInt();
+ M02z = iniFile.value("CustomM02z", -80).toInt();
+ clip_ty = iniFile.value("ClipTopHeight", 40).toInt();
+ clip_tz = iniFile.value("ClipTopLength", 30).toInt();
+ clip_by = iniFile.value("ClipBottomHeight", 70).toInt();
+ clip_bz = iniFile.value("ClipBottomLength", 80).toInt();
+ cap_x = iniFile.value("CapHalfWidth", 40).toInt();
+ cap_y = iniFile.value("CapHeight", 60).toInt();
+ cap_z = iniFile.value("CapLength", 100).toInt();
+}
+
+void TrackerDialogSettings::save_ini() const
+{
+ qDebug("TrackerDialogSettings::save_ini()");
+
+ QSettings settings("Abbequerque Inc.", "FaceTrackNoIR"); // Registry settings (in HK_USER)
+ QString currentFile = settings.value( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString();
+ QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file)
+
+ iniFile.beginGroup ( "PointTrackerDialog" );
+
+ iniFile.setValue("ActiveModelPanel", active_model_panel);
+ iniFile.setValue("CustomM01x", M01x);
+ iniFile.setValue("CustomM01y", M01y);
+ iniFile.setValue("CustomM01z", M01z);
+ iniFile.setValue("CustomM02x", M02x);
+ iniFile.setValue("CustomM02y", M02y);
+ iniFile.setValue("CustomM02z", M02z);
+ iniFile.setValue("ClipTopHeight", clip_ty);
+ iniFile.setValue("ClipTopLength", clip_tz);
+ iniFile.setValue("ClipBottomHeight", clip_by);
+ iniFile.setValue("ClipBottomLength", clip_bz);
+ iniFile.setValue("CapHalfWidth", cap_x);
+ iniFile.setValue("CapHeight", cap_y);
+ iniFile.setValue("CapLength", cap_z);
} \ No newline at end of file
diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_settings.h b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_settings.h
index 8868f418..23496d91 100644
--- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_settings.h
+++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_settings.h
@@ -11,9 +11,10 @@
#include <opencv2/opencv.hpp>
#include "point_tracker.h"
+
//-----------------------------------------------------------------------------
struct TrackerSettings
-{
+{
// camera
int cam_index;
float cam_f;
@@ -34,11 +35,41 @@ struct TrackerSettings
cv::Vec3f t_MH;
int sleep_time; // in ms
- int reset_time; // in s
+ int reset_time; // in ms
bool video_widget;
void load_ini();
void save_ini() const;
};
+
+//-----------------------------------------------------------------------------
+struct TrackerDialogSettings
+{
+ enum
+ {
+ MODEL_CLIP,
+ MODEL_CAP,
+ MODEL_CUSTOM
+ };
+ int active_model_panel;
+
+ int M01x;
+ int M01y;
+ int M01z;
+ int M02x;
+ int M02y;
+ int M02z;
+ int clip_ty;
+ int clip_tz;
+ int clip_by;
+ int clip_bz;
+ int cap_x;
+ int cap_y;
+ int cap_z;
+
+ void load_ini();
+ void save_ini() const;
+};
+
#endif //FTNOIR_TRACKER_PT_SETTINGS_H \ No newline at end of file
diff --git a/FTNoIR_Tracker_PT/point_extractor.cpp b/FTNoIR_Tracker_PT/point_extractor.cpp
index b26f7068..4aa1a658 100644
--- a/FTNoIR_Tracker_PT/point_extractor.cpp
+++ b/FTNoIR_Tracker_PT/point_extractor.cpp
@@ -6,7 +6,6 @@
*/
#include "point_extractor.h"
-
#include <QDebug>
using namespace cv;
@@ -39,36 +38,7 @@ const vector<Vec2f>& PointExtractor::extract_points(Mat frame, float dt, bool dr
//erode(frame_bw, frame_bw, Mat(), Point(-1,-1), min_size); //destroys information -> bad for subpixel accurarcy
// find connected components...
- // Method 1: contours
- //*
- // find contours
- vector< vector<Point> > contours;
- findContours(frame_bw.clone(), contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_SIMPLE);
-
- // extract points
- // TODO: use proximity to old points for classification
- float r;
- Vec2f c;
- Point2f dummy;
- points.clear();
- for (vector< vector<Point> >::iterator iter = contours.begin();
- iter!= contours.end();
- ++iter)
- {
- minEnclosingCircle(*iter, dummy, r);
- if (r > max_size) continue;
- Moments m = moments(*iter);
- if (m.m00 < 3.14*min_size*min_size) continue;
- // convert to centered camera coordinate system with y axis upwards
- c[0] = (m.m10/m.m00 - frame.cols/2)/frame.cols;
- c[1] = -(m.m01/m.m00 - frame.rows/2)/frame.cols;
- points.push_back(c);
- }
- //*/
-
- // Method 2: floodfill
- /*
- // extract blobs
+ // extract blobs with floodfill
struct BlobInfo
{
BlobInfo() : m00(0), m10(0), m01(0) {}
@@ -97,6 +67,7 @@ const vector<Vec2f>& PointExtractor::extract_points(Mat frame, float dt, bool dr
blob_count++;
if (blob_count >= 255) break;
}
+ if (blob_count >= 255) break;
}
// extract points
@@ -115,7 +86,6 @@ const vector<Vec2f>& PointExtractor::extract_points(Mat frame, float dt, bool dr
c[1] = -(m.m01/float(m.m00) - frame.rows/2)/frame.cols;
points.push_back(c);
}
- */
// draw output image
if (draw_output)
diff --git a/FTNoIR_Tracker_PT/point_tracker.cpp b/FTNoIR_Tracker_PT/point_tracker.cpp
index 90093032..03914bb4 100644
--- a/FTNoIR_Tracker_PT/point_tracker.cpp
+++ b/FTNoIR_Tracker_PT/point_tracker.cpp
@@ -87,37 +87,159 @@ void PointModel::get_d_order(const std::vector<cv::Vec2f>& points, int d_order[]
// ----------------------------------------------------------------------------
-PointTracker::PointTracker()
+PointTracker::PointTracker() : init_phase(true), dt_valid(0), dt_reset(1), v_t(0,0,0), v_r(0,0,0)
{
- X_CM.t[2] = 1000; // default position: 1 m away from cam
+ X_CM.t[2] = 1000; // default position: 1 m away from cam;
}
+void PointTracker::reset()
+{
+ // enter init phase and reset velocities
+ init_phase = true;
+ dt_valid = 0;
+ reset_velocities();
+}
+
+void PointTracker::reset_velocities()
+{
+ v_t = Vec3f(0,0,0);
+ v_r = Vec3f(0,0,0);
+}
+
+
bool PointTracker::track(const vector<Vec2f>& points, float f, float dt)
{
- if (!point_model) return false;
- if (!find_correspondences(points)) return false;
- POSIT(f);
+ dt_valid += dt;
+ // if there was no valid tracking result for too long, do a reset
+ if (dt_valid > dt_reset)
+ {
+ //qDebug()<<"dt_valid "<<dt_valid<<" > dt_reset "<<dt_reset;
+ reset();
+ }
+
+ // if there is a pointtracking problem, reset the velocities
+ if (!point_model || points.size() != PointModel::N_POINTS)
+ {
+ //qDebug()<<"Wrong number of points!";
+ reset_velocities();
+ return false;
+ }
+
+ X_CM_old = X_CM; // backup old transformation for velocity calculation
+
+ if (!init_phase)
+ predict(dt_valid);
+
+ // if there is a point correspondence problem something has gone wrong, do a reset
+ if (!find_correspondences(points, f))
+ {
+ //qDebug()<<"Error in finding point correspondences!";
+ X_CM = X_CM_old; // undo prediction
+ reset();
+ return false;
+ }
+
+ int n_iter = POSIT(f);
+ //qDebug()<<"Number of POSIT iterations: "<<n_iter;
+
+ if (!init_phase)
+ update_velocities(dt_valid);
+
+ // we have a valid tracking result, leave init phase and reset time since valid result
+ init_phase = false;
+ dt_valid = 0;
return true;
}
-bool PointTracker::find_correspondences(const vector<Vec2f>& points)
+void PointTracker::predict(float dt)
{
- if (points.size() != PointModel::N_POINTS) return false;
+ // predict with constant velocity
+ Matx33f R;
+ Rodrigues(dt*v_r, R);
+ X_CM.R = R*X_CM.R;
+ X_CM.t += dt * v_t;
+}
- // sort points
- int point_d_order[PointModel::N_POINTS];
- point_model->get_d_order(points, point_d_order);
+void PointTracker::update_velocities(float dt)
+{
+ // update velocities
+ Rodrigues(X_CM.R*X_CM_old.R.t(), v_r);
+ v_r /= dt;
+ v_t = (X_CM.t - X_CM_old.t)/dt;
+}
- // set correspondences
- for (int i=0; i<PointModel::N_POINTS; ++i)
- {
- p[point_model->d_order[i]] = points[point_d_order[i]];
+bool PointTracker::find_correspondences(const vector<Vec2f>& points, float f)
+{
+ if (init_phase) {
+ // We do a simple freetrack-like sorting in the init phase...
+ // sort points
+ int point_d_order[PointModel::N_POINTS];
+ point_model->get_d_order(points, point_d_order);
+
+ // set correspondences
+ for (int i=0; i<PointModel::N_POINTS; ++i)
+ {
+ p[point_model->d_order[i]] = points[point_d_order[i]];
+ }
+ }
+ else {
+ // ... otherwise we look at the distance to the projection of the expected model points
+ // project model points under current pose
+ p_exp[0] = project(Vec3f(0,0,0), f);
+ p_exp[1] = project(point_model->M01, f);
+ p_exp[2] = project(point_model->M02, f);
+
+ // set correspondences by minimum distance to projected model point
+ bool point_taken[PointModel::N_POINTS];
+ for (int i=0; i<PointModel::N_POINTS; ++i)
+ point_taken[i] = false;
+
+ float min_sdist = 0;
+ int min_idx = 0;
+
+ for (int i=0; i<PointModel::N_POINTS; ++i)
+ {
+ // find closest point to projected model point i
+ for (int j=0; j<PointModel::N_POINTS; ++j)
+ {
+ Vec2f d = p_exp[i]-points[j];
+ float sdist = d.dot(d);
+ if (sdist < min_sdist || j==0)
+ {
+ min_idx = j;
+ min_sdist = sdist;
+ }
+ }
+ // if one point is closest to more than one model point, abort
+ if (point_taken[min_idx]) return false;
+ point_taken[min_idx] = true;
+ p[i] = points[min_idx];
+ }
}
return true;
}
-void PointTracker::POSIT(float f)
+
+
+int PointTracker::POSIT(float f)
{
+ // POSIT algorithm for coplanar points as presented in
+ // [Denis Oberkampf, Daniel F. DeMenthon, Larry S. Davis: "Iterative Pose Estimation Using Coplanar Feature Points"]
+ // we use the same notation as in the paper here
+
+ // The expected rotation used for resolving the ambiguity in POSIT:
+ // In every iteration step the rotation closer to R_expected is taken
+ Matx33f R_expected;
+ if (init_phase)
+ R_expected = Matx33f::eye(); // in the init phase, we want to be close to the default pose = no rotation
+ else
+ R_expected = X_CM.R; // later we want to be close to the last (predicted) rotation
+
+ // initial pose = last (predicted) pose
+ Vec3f k;
+ get_row(X_CM.R, 2, k);
+ float Z0 = X_CM.t[2];
+
float old_epsilon_1 = 0;
float old_epsilon_2 = 0;
float epsilon_1 = 1;
@@ -130,13 +252,6 @@ void PointTracker::POSIT(float f)
Matx33f R_1, R_2;
Matx33f* R_current;
- //TODO: do extrapolation or reinit here!
- Vec3f k;
- get_row(X_CM.R, 2, k);
- float Z0 = X_CM.t[2];
- Matx33f R_expected = Matx33f::eye();
- //Matx33f R_expected = X_CM.R;
-
const int MAX_ITER = 100;
const float EPS_THRESHOLD = 1e-4;
@@ -218,14 +333,18 @@ void PointTracker::POSIT(float f)
old_epsilon_2 = epsilon_2;
}
+ // apply results
X_CM.R = *R_current;
X_CM.t[0] = p[0][0] * Z0/f;
X_CM.t[1] = p[0][1] * Z0/f;
X_CM.t[2] = Z0;
+ return i;
+
+ //Rodrigues(X_CM.R, r);
//qDebug()<<"iter: "<<i;
//qDebug()<<"t: "<<X_CM.t[0]<<' '<<X_CM.t[1]<<' '<<X_CM.t[2];
//Vec3f r;
- //Rodrigues(X_CM.R, r);
+ //
//qDebug()<<"r: "<<r[0]<<' '<<r[1]<<' '<<r[2]<<'\n';
}
diff --git a/FTNoIR_Tracker_PT/point_tracker.h b/FTNoIR_Tracker_PT/point_tracker.h
index ca222a3b..efd40424 100644
--- a/FTNoIR_Tracker_PT/point_tracker.h
+++ b/FTNoIR_Tracker_PT/point_tracker.h
@@ -77,15 +77,36 @@ public:
bool track(const std::vector<cv::Vec2f>& points, float f, float dt);
boost::shared_ptr<PointModel> point_model;
+ float dt_reset;
+
FrameTrafo get_pose() const { return X_CM; }
+ void reset();
protected:
- bool find_correspondences(const std::vector<cv::Vec2f>& points);
+ inline cv::Vec2f project(const cv::Vec3f& v_M, float f)
+ {
+ cv::Vec3f v_C = X_CM * v_M;
+ return cv::Vec2f(f*v_C[0]/v_C[2], f*v_C[1]/v_C[2]);
+ }
+
+ bool find_correspondences(const std::vector<cv::Vec2f>& points, float f);
+
cv::Vec2f p[PointModel::N_POINTS]; // the points in model order
+ cv::Vec2f p_exp[PointModel::N_POINTS]; // the expected point positions
+
+ void predict(float dt);
+ void update_velocities(float dt);
+ void reset_velocities();
- void POSIT(float f);
+
+ int POSIT(float f); // The POSIT algorithm, returns the number of iterations
+ bool init_phase;
+ float dt_valid; // time since last valid tracking result
+ cv::Vec3f v_t; // velocities
+ cv::Vec3f v_r;
FrameTrafo X_CM; // trafo from model to camera
+ FrameTrafo X_CM_old;
};
#endif //POINTTRACKER_H
diff --git a/FTNoIR_Tracker_PT/timer.cpp b/FTNoIR_Tracker_PT/timer.cpp
new file mode 100644
index 00000000..363b5b09
--- /dev/null
+++ b/FTNoIR_Tracker_PT/timer.cpp
@@ -0,0 +1,66 @@
+/* Copyright (c) 2012 Patrick Ruoff
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ */
+
+#include "timer.h"
+
+#include <stdlib.h>
+
+// ----------------------------------------------------------------------------
+Timer::Timer()
+: startTime(0), endTime(0), running(false)
+{
+#ifdef WIN32
+ QueryPerformanceFrequency(&frequency);
+ startCount.QuadPart = 0;
+ endCount.QuadPart = 0;
+#else
+ startCount.tv_sec = startCount.tv_usec = 0;
+ endCount.tv_sec = endCount.tv_usec = 0;
+#endif
+}
+
+
+void Timer::start()
+{
+#ifdef WIN32
+ QueryPerformanceCounter(&startCount);
+#else
+ gettimeofday(&startCount, NULL);
+#endif
+ running = true;
+}
+
+
+void Timer::stop()
+{
+#ifdef WIN32
+ QueryPerformanceCounter(&endCount);
+#else
+ gettimeofday(&endCount, NULL);
+#endif
+ running = false;
+}
+
+
+double Timer::elapsed()
+{
+#ifdef WIN32
+ if (running)
+ QueryPerformanceCounter(&endCount);
+
+ startTime = startCount.QuadPart * (1e3 / frequency.QuadPart);
+ endTime = endCount.QuadPart * (1e3 / frequency.QuadPart);
+#else
+ if(!stopped)
+ gettimeofday(&endCount, NULL);
+
+ startTime = (startCount.tv_sec * 1e3) + startCount.tv_usec;
+ endTime = (endCount.tv_sec * 1e3) + endCount.tv_usec;
+#endif
+
+ return endTime - startTime;
+} \ No newline at end of file
diff --git a/FTNoIR_Tracker_PT/timer.h b/FTNoIR_Tracker_PT/timer.h
new file mode 100644
index 00000000..2aaf725a
--- /dev/null
+++ b/FTNoIR_Tracker_PT/timer.h
@@ -0,0 +1,44 @@
+/* Copyright (c) 2012 Patrick Ruoff
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ */
+
+#ifndef PT_TIMER_H
+#define PT_TIMER_H
+
+#ifdef WIN32 // Windows system specific
+#include <windows.h>
+#else // Unix based system specific
+#include <sys/time.h>
+#endif
+
+// ----------------------------------------------------------------------------
+// high resolution timer based on http://www.songho.ca/misc/timer/timer.html
+class Timer
+{
+public:
+ Timer();
+
+ void start();
+ void stop();
+ void restart() { start(); } // for Qt compatibility
+ double elapsed(); // get elapsed time in ms
+
+protected:
+ double startTime; // starting time in ms
+ double endTime; // ending time in ms
+ bool running;
+
+#ifdef WIN32
+ LARGE_INTEGER frequency; // ticks per second
+ LARGE_INTEGER startCount;
+ LARGE_INTEGER endCount;
+#else
+ timeval startCount;
+ timeval endCount;
+#endif
+};
+
+#endif //PT_TIMER_H \ No newline at end of file
diff --git a/FTNoIR_Tracker_PT/videoInput/videoInput.h b/FTNoIR_Tracker_PT/videoInput/videoInput.h
new file mode 100644
index 00000000..4244902c
--- /dev/null
+++ b/FTNoIR_Tracker_PT/videoInput/videoInput.h
@@ -0,0 +1,385 @@
+#ifndef _VIDEOINPUT
+#define _VIDEOINPUT
+
+//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+//THE SOFTWARE.
+
+//////////////////////////////////////////////////////////
+//Written by Theodore Watson - theo.watson@gmail.com //
+//Do whatever you want with this code but if you find //
+//a bug or make an improvement I would love to know! //
+// //
+//Warning This code is experimental //
+//use at your own risk :) //
+//////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////
+/* Shoutouts
+
+Thanks to:
+
+ Dillip Kumar Kara for crossbar code.
+ Zachary Lieberman for getting me into this stuff
+ and for being so generous with time and code.
+ The guys at Potion Design for helping me with VC++
+ Josh Fisher for being a serious C++ nerd :)
+ Golan Levin for helping me debug the strangest
+ and slowest bug in the world!
+
+ And all the people using this library who send in
+ bugs, suggestions and improvements who keep me working on
+ the next version - yeah thanks a lot ;)
+
+*/
+/////////////////////////////////////////////////////////
+
+
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <math.h>
+#include <string.h>
+#include <wchar.h>
+
+//this is for TryEnterCriticalSection
+#ifndef _WIN32_WINNT
+ # define _WIN32_WINNT 0x400
+#endif
+#include <windows.h>
+
+
+//Example Usage
+/*
+ //create a videoInput object
+ videoInput VI;
+
+ //Prints out a list of available devices and returns num of devices found
+ int numDevices = VI.listDevices();
+
+ int device1 = 0; //this could be any deviceID that shows up in listDevices
+ int device2 = 1; //this could be any deviceID that shows up in listDevices
+
+ //if you want to capture at a different frame rate (default is 30)
+ //specify it here, you are not guaranteed to get this fps though.
+ //VI.setIdealFramerate(dev, 60);
+
+ //setup the first device - there are a number of options:
+
+ VI.setupDevice(device1); //setup the first device with the default settings
+ //VI.setupDevice(device1, VI_COMPOSITE); //or setup device with specific connection type
+ //VI.setupDevice(device1, 320, 240); //or setup device with specified video size
+ //VI.setupDevice(device1, 320, 240, VI_COMPOSITE); //or setup device with video size and connection type
+
+ //VI.setFormat(device1, VI_NTSC_M); //if your card doesn't remember what format it should be
+ //call this with the appropriate format listed above
+ //NOTE: must be called after setupDevice!
+
+ //optionally setup a second (or third, fourth ...) device - same options as above
+ VI.setupDevice(device2);
+
+ //As requested width and height can not always be accomodated
+ //make sure to check the size once the device is setup
+
+ int width = VI.getWidth(device1);
+ int height = VI.getHeight(device1);
+ int size = VI.getSize(device1);
+
+ unsigned char * yourBuffer1 = new unsigned char[size];
+ unsigned char * yourBuffer2 = new unsigned char[size];
+
+ //to get the data from the device first check if the data is new
+ if(VI.isFrameNew(device1)){
+ VI.getPixels(device1, yourBuffer1, false, false); //fills pixels as a BGR (for openCV) unsigned char array - no flipping
+ VI.getPixels(device1, yourBuffer2, true, true); //fills pixels as a RGB (for openGL) unsigned char array - flipping!
+ }
+
+ //same applies to device2 etc
+
+ //to get a settings dialog for the device
+ VI.showSettingsWindow(device1);
+
+
+ //Shut down devices properly
+ VI.stopDevice(device1);
+ VI.stopDevice(device2);
+*/
+
+
+////////////////////////////////////// VARS AND DEFS //////////////////////////////////
+
+
+//STUFF YOU CAN CHANGE
+
+//change for verbose debug info
+static bool verbose = true;
+
+//if you need VI to use multi threaded com
+//#define VI_COM_MULTI_THREADED
+
+//STUFF YOU DON'T CHANGE
+
+//videoInput defines
+#define VI_VERSION 0.1995
+#define VI_MAX_CAMERAS 20
+#define VI_NUM_TYPES 18 //DON'T TOUCH
+#define VI_NUM_FORMATS 18 //DON'T TOUCH
+
+//defines for setPhyCon - tuner is not as well supported as composite and s-video
+#define VI_COMPOSITE 0
+#define VI_S_VIDEO 1
+#define VI_TUNER 2
+#define VI_USB 3
+#define VI_1394 4
+
+//defines for formats
+#define VI_NTSC_M 0
+#define VI_PAL_B 1
+#define VI_PAL_D 2
+#define VI_PAL_G 3
+#define VI_PAL_H 4
+#define VI_PAL_I 5
+#define VI_PAL_M 6
+#define VI_PAL_N 7
+#define VI_PAL_NC 8
+#define VI_SECAM_B 9
+#define VI_SECAM_D 10
+#define VI_SECAM_G 11
+#define VI_SECAM_H 12
+#define VI_SECAM_K 13
+#define VI_SECAM_K1 14
+#define VI_SECAM_L 15
+#define VI_NTSC_M_J 16
+#define VI_NTSC_433 17
+
+
+//allows us to directShow classes here with the includes in the cpp
+struct ICaptureGraphBuilder2;
+struct IGraphBuilder;
+struct IBaseFilter;
+struct IAMCrossbar;
+struct IMediaControl;
+struct ISampleGrabber;
+struct IMediaEventEx;
+struct IAMStreamConfig;
+struct _AMMediaType;
+class SampleGrabberCallback;
+typedef _AMMediaType AM_MEDIA_TYPE;
+
+//keeps track of how many instances of VI are being used
+//don't touch
+static int comInitCount = 0;
+
+
+//////////////////////////////////////// VIDEO DEVICE ///////////////////////////////////
+
+class videoDevice{
+
+
+ public:
+
+ videoDevice();
+ void setSize(int w, int h);
+ void NukeDownstream(IBaseFilter *pBF);
+ void destroyGraph();
+ ~videoDevice();
+
+ int videoSize;
+ int width;
+ int height;
+ int tryWidth;
+ int tryHeight;
+
+ ICaptureGraphBuilder2 *pCaptureGraph; // Capture graph builder object
+ IGraphBuilder *pGraph; // Graph builder object
+ IMediaControl *pControl; // Media control object
+ IBaseFilter *pVideoInputFilter; // Video Capture filter
+ IBaseFilter *pGrabberF;
+ IBaseFilter * pDestFilter;
+ IAMStreamConfig *streamConf;
+ ISampleGrabber * pGrabber; // Grabs frame
+ AM_MEDIA_TYPE * pAmMediaType;
+
+ IMediaEventEx * pMediaEvent;
+
+ GUID videoType;
+ long formatType;
+
+ SampleGrabberCallback * sgCallback;
+
+ bool tryDiffSize;
+ bool useCrossbar;
+ bool readyToCapture;
+ bool sizeSet;
+ bool setupStarted;
+ bool specificFormat;
+ bool autoReconnect;
+ int nFramesForReconnect;
+ unsigned long nFramesRunning;
+ int connection;
+ int storeConn;
+ int myID;
+ long requestedFrameTime; //ie fps
+
+ char nDeviceName[255];
+ WCHAR wDeviceName[255];
+
+ unsigned char * pixels;
+ char * pBuffer;
+
+};
+
+
+
+
+////////////////////////////////////// VIDEO INPUT /////////////////////////////////////
+
+
+
+class videoInput{
+
+ public:
+ videoInput();
+ ~videoInput();
+
+ //turns off console messages - default is to print messages
+ static void setVerbose(bool _verbose);
+
+ //Functions in rough order they should be used.
+ static int listDevices(bool silent = false);
+
+ //needs to be called after listDevices - otherwise returns NULL
+ static char * getDeviceName(int deviceID);
+
+ //choose to use callback based capture - or single threaded
+ void setUseCallback(bool useCallback);
+
+ //call before setupDevice
+ //directshow will try and get the closest possible framerate to what is requested
+ void setIdealFramerate(int deviceID, int idealFramerate);
+
+ //some devices will stop delivering frames after a while - this method gives you the option to try and reconnect
+ //to a device if videoInput detects that a device has stopped delivering frames.
+ //you MUST CALL isFrameNew every app loop for this to have any effect
+ void setAutoReconnectOnFreeze(int deviceNumber, bool doReconnect, int numMissedFramesBeforeReconnect);
+
+ //Choose one of these four to setup your device
+ bool setupDevice(int deviceID);
+ bool setupDevice(int deviceID, int w, int h);
+
+ //These two are only for capture cards
+ //USB and Firewire cameras souldn't specify connection
+ bool setupDevice(int deviceID, int connection);
+ bool setupDevice(int deviceID, int w, int h, int connection);
+
+ //If you need to you can set your NTSC/PAL/SECAM
+ //preference here. if it is available it will be used.
+ //see #defines above for available formats - eg VI_NTSC_M or VI_PAL_B
+ //should be called after setupDevice
+ //can be called multiple times
+ bool setFormat(int deviceNumber, int format);
+
+ //Tells you when a new frame has arrived - you should call this if you have specified setAutoReconnectOnFreeze to true
+ bool isFrameNew(int deviceID);
+
+ bool isDeviceSetup(int deviceID);
+
+ //Returns the pixels - flipRedAndBlue toggles RGB/BGR flipping - and you can flip the image too
+ unsigned char * getPixels(int deviceID, bool flipRedAndBlue = true, bool flipImage = false);
+
+ //Or pass in a buffer for getPixels to fill returns true if successful.
+ bool getPixels(int id, unsigned char * pixels, bool flipRedAndBlue = true, bool flipImage = false);
+
+ //Launches a pop up settings window
+ //For some reason in GLUT you have to call it twice each time.
+ void showSettingsWindow(int deviceID);
+
+ //Manual control over settings thanks.....
+ //These are experimental for now.
+ bool setVideoSettingFilter(int deviceID, long Property, long lValue, long Flags = NULL, bool useDefaultValue = false);
+ bool setVideoSettingFilterPct(int deviceID, long Property, float pctValue, long Flags = NULL);
+ bool getVideoSettingFilter(int deviceID, long Property, long &min, long &max, long &SteppingDelta, long &currentValue, long &flags, long &defaultValue);
+
+ bool setVideoSettingCamera(int deviceID, long Property, long lValue, long Flags = NULL, bool useDefaultValue = false);
+ bool setVideoSettingCameraPct(int deviceID, long Property, float pctValue, long Flags = NULL);
+ bool getVideoSettingCamera(int deviceID, long Property, long &min, long &max, long &SteppingDelta, long &currentValue, long &flags, long &defaultValue);
+
+ //bool setVideoSettingCam(int deviceID, long Property, long lValue, long Flags = NULL, bool useDefaultValue = false);
+
+ //get width, height and number of pixels
+ int getWidth(int deviceID);
+ int getHeight(int deviceID);
+ int getSize(int deviceID);
+
+ //completely stops and frees a device
+ void stopDevice(int deviceID);
+
+ //as above but then sets it up with same settings
+ bool restartDevice(int deviceID);
+
+ //number of devices available
+ int devicesFound;
+
+ long propBrightness;
+ long propContrast;
+ long propHue;
+ long propSaturation;
+ long propSharpness;
+ long propGamma;
+ long propColorEnable;
+ long propWhiteBalance;
+ long propBacklightCompensation;
+ long propGain;
+
+ long propPan;
+ long propTilt;
+ long propRoll;
+ long propZoom;
+ long propExposure;
+ long propIris;
+ long propFocus;
+
+
+ private:
+ void setPhyCon(int deviceID, int conn);
+ void setAttemptCaptureSize(int deviceID, int w, int h);
+ bool setup(int deviceID);
+ void processPixels(unsigned char * src, unsigned char * dst, int width, int height, bool bRGB, bool bFlip);
+ int start(int deviceID, videoDevice * VD);
+ int getDeviceCount();
+ void getMediaSubtypeAsString(GUID type, char * typeAsString);
+
+ HRESULT getDevice(IBaseFilter **pSrcFilter, int deviceID, WCHAR * wDeviceName, char * nDeviceName);
+ static HRESULT ShowFilterPropertyPages(IBaseFilter *pFilter);
+ HRESULT SaveGraphFile(IGraphBuilder *pGraph, WCHAR *wszPath);
+ HRESULT routeCrossbar(ICaptureGraphBuilder2 **ppBuild, IBaseFilter **pVidInFilter, int conType, GUID captureMode);
+
+ //don't touch
+ static bool comInit();
+ static bool comUnInit();
+
+ int connection;
+ int callbackSetCount;
+ bool bCallback;
+
+ GUID CAPTURE_MODE;
+
+ //Extra video subtypes
+ GUID MEDIASUBTYPE_Y800;
+ GUID MEDIASUBTYPE_Y8;
+ GUID MEDIASUBTYPE_GREY;
+
+ videoDevice * VDList[VI_MAX_CAMERAS];
+ GUID mediaSubtypes[VI_NUM_TYPES];
+ long formatTypes[VI_NUM_FORMATS];
+
+ static void __cdecl basicThread(void * objPtr);
+
+ static char deviceNames[VI_MAX_CAMERAS][255];
+
+};
+
+ #endif
diff --git a/FTNoIR_Tracker_PT/videoInput/videoInput_vc8.lib b/FTNoIR_Tracker_PT/videoInput/videoInput_vc8.lib
new file mode 100644
index 00000000..15ca9cf3
--- /dev/null
+++ b/FTNoIR_Tracker_PT/videoInput/videoInput_vc8.lib
Binary files differ
diff --git a/FTNoIR_Tracker_PT/videoInput/videoInput_vc9.lib b/FTNoIR_Tracker_PT/videoInput/videoInput_vc9.lib
new file mode 100644
index 00000000..32637cc9
--- /dev/null
+++ b/FTNoIR_Tracker_PT/videoInput/videoInput_vc9.lib
Binary files differ