summaryrefslogtreecommitdiffhomepage
path: root/FTNoIR_Tracker_PT
diff options
context:
space:
mode:
authorPatrick Ruoff <c14-radioactive@19e81ba0-9b1a-49c3-bd6c-561e1906d5fb>2012-09-17 16:32:04 +0000
committerPatrick Ruoff <c14-radioactive@19e81ba0-9b1a-49c3-bd6c-561e1906d5fb>2012-09-17 16:32:04 +0000
commitcc3bc1c6d14de535f87e6601ed562b505d902fce (patch)
tree215fff88ae282a197b80b9db926430380c36c946 /FTNoIR_Tracker_PT
parentf5df7884cf82b87fce50d3ff68c6a4bfa85064e9 (diff)
added pointtracker
created VC9 solution and project files for available projects git-svn-id: svn+ssh://svn.code.sf.net/p/facetracknoir/code@143 19e81ba0-9b1a-49c3-bd6c-561e1906d5fb
Diffstat (limited to 'FTNoIR_Tracker_PT')
-rw-r--r--FTNoIR_Tracker_PT/FTNoIR_PT_Controls.ui823
-rw-r--r--FTNoIR_Tracker_PT/FTNoIR_Tracker_PT.rc61
-rw-r--r--FTNoIR_Tracker_PT/FTNoIR_Tracker_PT_vc9.vcproj552
-rw-r--r--FTNoIR_Tracker_PT/Resources/Logo_IR.pngbin0 -> 10386 bytes
-rw-r--r--FTNoIR_Tracker_PT/Resources/icon.icobin0 -> 4286 bytes
-rw-r--r--FTNoIR_Tracker_PT/camera.cpp62
-rw-r--r--FTNoIR_Tracker_PT/camera.h46
-rw-r--r--FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp184
-rw-r--r--FTNoIR_Tracker_PT/ftnoir_tracker_pt.h81
-rw-r--r--FTNoIR_Tracker_PT/ftnoir_tracker_pt.qrc6
-rw-r--r--FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.cpp208
-rw-r--r--FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.h72
-rw-r--r--FTNoIR_Tracker_PT/ftnoir_tracker_pt_dll.cpp40
-rw-r--r--FTNoIR_Tracker_PT/ftnoir_tracker_pt_dll.h8
-rw-r--r--FTNoIR_Tracker_PT/ftnoir_tracker_pt_settings.cpp71
-rw-r--r--FTNoIR_Tracker_PT/ftnoir_tracker_pt_settings.h40
-rw-r--r--FTNoIR_Tracker_PT/point_extractor.cpp57
-rw-r--r--FTNoIR_Tracker_PT/point_extractor.h31
-rw-r--r--FTNoIR_Tracker_PT/point_tracker.cpp231
-rw-r--r--FTNoIR_Tracker_PT/point_tracker.h91
-rw-r--r--FTNoIR_Tracker_PT/resource.h14
-rw-r--r--FTNoIR_Tracker_PT/trans_calib.cpp44
-rw-r--r--FTNoIR_Tracker_PT/trans_calib.h39
-rw-r--r--FTNoIR_Tracker_PT/video_widget.cpp89
-rw-r--r--FTNoIR_Tracker_PT/video_widget.h40
25 files changed, 2890 insertions, 0 deletions
diff --git a/FTNoIR_Tracker_PT/FTNoIR_PT_Controls.ui b/FTNoIR_Tracker_PT/FTNoIR_PT_Controls.ui
new file mode 100644
index 00000000..ca2d9898
--- /dev/null
+++ b/FTNoIR_Tracker_PT/FTNoIR_PT_Controls.ui
@@ -0,0 +1,823 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>UICPTClientControls</class>
+ <widget class="QWidget" name="UICPTClientControls">
+ <property name="windowModality">
+ <enum>Qt::ApplicationModal</enum>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>395</width>
+ <height>450</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="windowTitle">
+ <string>PointTracker Settings</string>
+ </property>
+ <property name="windowIcon">
+ <iconset resource="ftnoir_tracker_pt.qrc">
+ <normaloff>:/Resources/icon.ico</normaloff>:/Resources/icon.ico</iconset>
+ </property>
+ <property name="layoutDirection">
+ <enum>Qt::LeftToRight</enum>
+ </property>
+ <property name="autoFillBackground">
+ <bool>false</bool>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <property name="sizeConstraint">
+ <enum>QLayout::SetFixedSize</enum>
+ </property>
+ <item>
+ <widget class="QTabWidget" name="tabWidget">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="currentIndex">
+ <number>0</number>
+ </property>
+ <widget class="QWidget" name="tab">
+ <attribute name="title">
+ <string>General</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
+ <widget class="QGroupBox" name="groupBox_6">
+ <property name="title">
+ <string>TrackerThread</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_6">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_8">
+ <item>
+ <widget class="QCheckBox" name="videowidget_check">
+ <property name="text">
+ <string>Show VideoWidget</string>
+ </property>
+ </widget>
+ </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>
+ <widget class="QLabel" name="label_39">
+ <property name="text">
+ <string>Sleep time</string>
+ </property>
+ <property name="buddy">
+ <cstring>sleep_spin</cstring>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="sleep_spin">
+ <property name="maximum">
+ <number>999</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_40">
+ <property name="text">
+ <string>ms</string>
+ </property>
+ </widget>
+ </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">
+ <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_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>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="groupBox_2">
+ <property name="title">
+ <string>Point Extraction</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_4">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Threshold</string>
+ </property>
+ <property name="buddy">
+ <cstring>threshold_slider</cstring>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSlider" name="threshold_slider">
+ <property name="maximum">
+ <number>255</number>
+ </property>
+ <property name="value">
+ <number>127</number>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QLabel" name="label_7">
+ <property name="text">
+ <string>Min Diameter</string>
+ </property>
+ <property name="buddy">
+ <cstring>mindiam_spin</cstring>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="mindiam_spin"/>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_12">
+ <property name="text">
+ <string>px</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <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_8">
+ <property name="text">
+ <string>Max Diameter</string>
+ </property>
+ <property name="buddy">
+ <cstring>maxdiam_spin</cstring>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="maxdiam_spin"/>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_13">
+ <property name="text">
+ <string>px</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="groupBox_5">
+ <property name="title">
+ <string>Status</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_5">
+ <item>
+ <layout class="QFormLayout" name="formLayout">
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>Extracted Points:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLabel" name="pointinfo_label">
+ <property name="minimumSize">
+ <size>
+ <width>50</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_38">
+ <property name="text">
+ <string>Camera Info:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLabel" name="caminfo_label">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>120</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ <zorder></zorder>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="tab_2">
+ <attribute name="title">
+ <string>Model</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_7">
+ <item>
+ <widget class="QGroupBox" name="groupBox_3">
+ <property name="title">
+ <string>Model Dimensions</string>
+ </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>
+ <property name="maximum">
+ <number>999</number>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="3">
+ <widget class="QLabel" name="label_18">
+ <property name="text">
+ <string>mm</string>
+ </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>
+ </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>
+ </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>
+ <item row="3" column="3">
+ <widget class="QLabel" name="label_15">
+ <property name="text">
+ <string>mm</string>
+ </property>
+ </widget>
+ </item>
+ <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="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>
+ <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_23">
+ <property name="text">
+ <string>y:</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="groupBox_4">
+ <property name="title">
+ <string>Model Translation</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_9">
+ <item>
+ <widget class="QLabel" name="label_32">
+ <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">
+ <item>
+ <layout class="QGridLayout" name="gridLayout_3">
+ <item row="3" column="2">
+ <widget class="QSpinBox" name="tz_spin">
+ <property name="suffix">
+ <string/>
+ </property>
+ <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_28">
+ <property name="text">
+ <string>x:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QLabel" name="label_31">
+ <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">
+ <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">
+ <number>-999</number>
+ </property>
+ <property name="maximum">
+ <number>999</number>
+ </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">
+ <number>-999</number>
+ </property>
+ <property name="maximum">
+ <number>999</number>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_25">
+ <property name="text">
+ <string>T:</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_3">
+ <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="QPushButton" name="tcalib_button">
+ <property name="text">
+ <string>Calibrate</string>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </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">
+ <attribute name="title">
+ <string>About</string>
+ </attribute>
+ <widget class="QLabel" name="label_10">
+ <property name="geometry">
+ <rect>
+ <x>30</x>
+ <y>30</y>
+ <width>131</width>
+ <height>81</height>
+ </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;PointTracker Plugin &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Version 0.1&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;/body&gt;&lt;/html&gt;</string>
+ </property>
+ </widget>
+ <widget class="QLabel" name="label_35">
+ <property name="geometry">
+ <rect>
+ <x>170</x>
+ <y>30</y>
+ <width>141</width>
+ <height>141</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="pixmap">
+ <pixmap resource="ftnoir_tracker_pt.qrc">:/Resources/Logo_IR.png</pixmap>
+ </property>
+ </widget>
+ </widget>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_4">
+ <item>
+ <spacer name="horizontalSpacer_6">
+ <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="QPushButton" name="ok_button">
+ <property name="text">
+ <string>Ok</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="cancel_button">
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <tabstops>
+ <tabstop>tabWidget</tabstop>
+ <tabstop>ok_button</tabstop>
+ <tabstop>cancel_button</tabstop>
+ <tabstop>videowidget_check</tabstop>
+ <tabstop>sleep_spin</tabstop>
+ <tabstop>camindex_spin</tabstop>
+ <tabstop>f_dspin</tabstop>
+ <tabstop>threshold_slider</tabstop>
+ <tabstop>mindiam_spin</tabstop>
+ <tabstop>maxdiam_spin</tabstop>
+ <tabstop>m1x_spin</tabstop>
+ <tabstop>m1y_spin</tabstop>
+ <tabstop>m1z_spin</tabstop>
+ <tabstop>m2x_spin</tabstop>
+ <tabstop>m2y_spin</tabstop>
+ <tabstop>m2z_spin</tabstop>
+ <tabstop>tx_spin</tabstop>
+ <tabstop>ty_spin</tabstop>
+ <tabstop>tz_spin</tabstop>
+ </tabstops>
+ <resources>
+ <include location="ftnoir_tracker_pt.qrc"/>
+ </resources>
+ <connections/>
+ <slots>
+ <slot>startEngineClicked()</slot>
+ <slot>stopEngineClicked()</slot>
+ <slot>cameraSettingsClicked()</slot>
+ </slots>
+</ui>
diff --git a/FTNoIR_Tracker_PT/FTNoIR_Tracker_PT.rc b/FTNoIR_Tracker_PT/FTNoIR_Tracker_PT.rc
new file mode 100644
index 00000000..11c5d52f
--- /dev/null
+++ b/FTNoIR_Tracker_PT/FTNoIR_Tracker_PT.rc
@@ -0,0 +1,61 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+LANGUAGE 9, 1
+#pragma code_page(1252)
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/FTNoIR_Tracker_PT/FTNoIR_Tracker_PT_vc9.vcproj b/FTNoIR_Tracker_PT/FTNoIR_Tracker_PT_vc9.vcproj
new file mode 100644
index 00000000..a7989a5e
--- /dev/null
+++ b/FTNoIR_Tracker_PT/FTNoIR_Tracker_PT_vc9.vcproj
@@ -0,0 +1,552 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9,00"
+ Name="FTNoIR_Tracker_PT"
+ ProjectGUID="{7A2A2560-9253-4CC8-A9D5-4B9D9C224D9D}"
+ Keyword="Qt4VSv1.0"
+ TargetFrameworkVersion="0"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)\bin"
+ IntermediateDirectory="$(SolutionDir)\$(ConfigurationName)"
+ ConfigurationType="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ 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"
+ TreatWChar_tAsBuiltInType="false"
+ DebugInformationFormat="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <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"
+ OutputFile="$(OutDir)\$(ProjectName).dll"
+ AdditionalLibraryDirectories="&quot;$(QTDIR)\lib&quot;;&quot;$(OPENCV_DIR)\x86\vc9\lib&quot;"
+ GenerateDebugInformation="false"
+ SubSystem="2"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)\bin"
+ IntermediateDirectory="$(SolutionDir)\$(ConfigurationName)"
+ ConfigurationType="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ 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_CORE_LIB;QT_GUI_LIB;FTNOIR_TRACKER_BASE_LIB;QT_OPENGL_LIB"
+ RuntimeLibrary="3"
+ TreatWChar_tAsBuiltInType="false"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <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).dll"
+ AdditionalLibraryDirectories="&quot;$(QTDIR)\lib&quot;;&quot;$(OPENCV_DIR)\x86\vc9\lib&quot;"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;cxx;c;def"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath=".\camera.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\ftnoir_tracker_pt.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\ftnoir_tracker_pt_dialog.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\ftnoir_tracker_pt_dll.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\ftnoir_tracker_pt_settings.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\point_extractor.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\point_tracker.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\trans_calib.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\video_widget.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ <File
+ RelativePath=".\camera.h"
+ >
+ </File>
+ <File
+ RelativePath="..\FTNoIR_Tracker_Base\ftnoir_tracker_base.h"
+ >
+ </File>
+ <File
+ RelativePath="..\FTNoIR_Tracker_Base\ftnoir_tracker_base_global.h"
+ >
+ </File>
+ <File
+ RelativePath=".\ftnoir_tracker_pt.h"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ Description=""
+ CommandLine=""
+ AdditionalDependencies=""
+ Outputs=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ Description=""
+ CommandLine=""
+ AdditionalDependencies=""
+ Outputs=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\ftnoir_tracker_pt_dialog.h"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Moc&apos;ing ftnoir_tracker_pt_dialog.h..."
+ CommandLine="&quot;$(QTDIR)\bin\moc.exe&quot; &quot;$(InputPath)&quot; -o &quot;.\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp&quot; -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DFTNOIR_TRACKER_BASE_LIB -DQT_OPENGL_LIB -D_WINDLL &quot;-I.&quot; &quot;-I.\GeneratedFiles&quot; &quot;-I.\GeneratedFiles\$(ConfigurationName)\.&quot; &quot;-I$(QTDIR)\include&quot; &quot;-I$(QTDIR)\include\QtCore&quot; &quot;-I$(QTDIR)\include\QtGui&quot; &quot;-I$(OPENCV_DIR)\include&quot; &quot;-I$(BOOST_DIR)\.&quot; &quot;-I$(QTDIR)\include\QtOpenGL&quot;&#x0D;&#x0A;"
+ AdditionalDependencies="&quot;$(QTDIR)\bin\moc.exe&quot;;$(InputPath)"
+ Outputs="&quot;.\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp&quot;"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Moc&apos;ing ftnoir_tracker_pt_dialog.h..."
+ CommandLine="&quot;$(QTDIR)\bin\moc.exe&quot; &quot;$(InputPath)&quot; -o &quot;.\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp&quot; -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_CORE_LIB -DQT_GUI_LIB -DFTNOIR_TRACKER_BASE_LIB -DQT_OPENGL_LIB -D_WINDLL &quot;-I.&quot; &quot;-I.\GeneratedFiles&quot; &quot;-I.\GeneratedFiles\$(ConfigurationName)\.&quot; &quot;-I$(QTDIR)\include&quot; &quot;-I$(QTDIR)\include\QtCore&quot; &quot;-I$(QTDIR)\include\QtGui&quot; &quot;-I$(OPENCV_DIR)\include&quot; &quot;-I$(BOOST_DIR)\.&quot; &quot;-I$(QTDIR)\include\QtOpenGL&quot;&#x0D;&#x0A;"
+ AdditionalDependencies="&quot;$(QTDIR)\bin\moc.exe&quot;;$(InputPath)"
+ Outputs="&quot;.\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp&quot;"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\ftnoir_tracker_pt_settings.h"
+ >
+ </File>
+ <File
+ RelativePath=".\point_extractor.h"
+ >
+ </File>
+ <File
+ RelativePath=".\point_tracker.h"
+ >
+ </File>
+ <File
+ RelativePath=".\resource.h"
+ >
+ </File>
+ <File
+ RelativePath=".\trans_calib.h"
+ >
+ </File>
+ <File
+ RelativePath=".\video_widget.h"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Moc&apos;ing video_widget.h..."
+ CommandLine="&quot;$(QTDIR)\bin\moc.exe&quot; &quot;$(InputPath)&quot; -o &quot;.\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp&quot; -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DFTNOIR_TRACKER_BASE_LIB -DQT_OPENGL_LIB -D_WINDLL &quot;-I.&quot; &quot;-I.\GeneratedFiles&quot; &quot;-I.\GeneratedFiles\$(ConfigurationName)\.&quot; &quot;-I$(QTDIR)\include&quot; &quot;-I$(QTDIR)\include\QtCore&quot; &quot;-I$(QTDIR)\include\QtGui&quot; &quot;-I$(OPENCV_DIR)\include&quot; &quot;-I$(BOOST_DIR)\.&quot; &quot;-I$(QTDIR)\include\QtOpenGL&quot;&#x0D;&#x0A;"
+ AdditionalDependencies="&quot;$(QTDIR)\bin\moc.exe&quot;;$(InputPath)"
+ Outputs="&quot;.\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp&quot;"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Moc&apos;ing video_widget.h..."
+ CommandLine="&quot;$(QTDIR)\bin\moc.exe&quot; &quot;$(InputPath)&quot; -o &quot;.\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp&quot; -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_CORE_LIB -DQT_GUI_LIB -DFTNOIR_TRACKER_BASE_LIB -DQT_OPENGL_LIB -D_WINDLL &quot;-I.&quot; &quot;-I.\GeneratedFiles&quot; &quot;-I.\GeneratedFiles\$(ConfigurationName)\.&quot; &quot;-I$(QTDIR)\include&quot; &quot;-I$(QTDIR)\include\QtCore&quot; &quot;-I$(QTDIR)\include\QtGui&quot; &quot;-I$(OPENCV_DIR)\include&quot; &quot;-I$(BOOST_DIR)\.&quot; &quot;-I$(QTDIR)\include\QtOpenGL&quot;&#x0D;&#x0A;"
+ AdditionalDependencies="&quot;$(QTDIR)\bin\moc.exe&quot;;$(InputPath)"
+ Outputs="&quot;.\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp&quot;"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Form Files"
+ Filter="ui"
+ UniqueIdentifier="{99349809-55BA-4b9d-BF79-8FDBB0286EB3}"
+ >
+ <File
+ RelativePath=".\FTNoIR_PT_Controls.ui"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Uic&apos;ing $(InputFileName)..."
+ CommandLine="&quot;$(QTDIR)\bin\uic.exe&quot; -o &quot;.\GeneratedFiles\ui_$(InputName).h&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+ AdditionalDependencies="$(QTDIR)\bin\uic.exe"
+ Outputs="&quot;.\GeneratedFiles\ui_$(InputName).h&quot;"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Uic&apos;ing $(InputFileName)..."
+ CommandLine="&quot;$(QTDIR)\bin\uic.exe&quot; -o &quot;.\GeneratedFiles\ui_$(InputName).h&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+ AdditionalDependencies="$(QTDIR)\bin\uic.exe"
+ Outputs="&quot;.\GeneratedFiles\ui_$(InputName).h&quot;"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="qrc;*"
+ UniqueIdentifier="{D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E}"
+ ParseFiles="false"
+ >
+ <File
+ RelativePath=".\ftnoir_tracker_pt.qrc"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Rcc&apos;ing $(InputFileName)..."
+ CommandLine="&quot;$(QTDIR)\bin\rcc.exe&quot; -name &quot;$(InputName)&quot; -no-compress &quot;$(InputPath)&quot; -o .\GeneratedFiles\qrc_$(InputName).cpp&#x0D;&#x0A;"
+ AdditionalDependencies="$(InputPath);.\Resources\icon.ico;.\Resources\Logo_IR.png"
+ Outputs=".\GeneratedFiles\qrc_$(InputName).cpp"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Rcc&apos;ing $(InputFileName)..."
+ CommandLine="&quot;$(QTDIR)\bin\rcc.exe&quot; -name &quot;$(InputName)&quot; -no-compress &quot;$(InputPath)&quot; -o .\GeneratedFiles\qrc_$(InputName).cpp&#x0D;&#x0A;"
+ AdditionalDependencies="$(InputPath);.\Resources\icon.ico;.\Resources\Logo_IR.png"
+ Outputs=".\GeneratedFiles\qrc_$(InputName).cpp"
+ />
+ </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"
+ Filter="moc;h;cpp"
+ UniqueIdentifier="{71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11}"
+ SourceControlFiles="false"
+ >
+ <File
+ RelativePath=".\GeneratedFiles\qrc_ftnoir_tracker_pt.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\GeneratedFiles\ui_FTNoIR_PT_Controls.h"
+ >
+ </File>
+ <Filter
+ Name="Release"
+ Filter="cpp;moc"
+ SourceControlFiles="false"
+ >
+ <File
+ RelativePath=".\GeneratedFiles\Release\moc_ftnoir_tracker_pt_dialog.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\GeneratedFiles\Release\moc_video_widget.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Debug"
+ Filter="cpp;moc"
+ SourceControlFiles="false"
+ >
+ <File
+ RelativePath=".\GeneratedFiles\Debug\moc_ftnoir_tracker_pt_dialog.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\GeneratedFiles\Debug\moc_video_widget.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Filter>
+ <File
+ RelativePath=".\FTNoIR_Tracker_PT.rc"
+ >
+ </File>
+ </Files>
+ <Globals>
+ <Global
+ Name="lreleaseOptions"
+ Value=""
+ />
+ <Global
+ Name="lupdateOnBuild"
+ Value="0"
+ />
+ <Global
+ Name="lupdateOptions"
+ Value=""
+ />
+ <Global
+ Name="MocDir"
+ Value=".\GeneratedFiles\$(ConfigurationName)"
+ />
+ <Global
+ Name="MocOptions"
+ Value=""
+ />
+ <Global
+ Name="QtVersion Win32"
+ Value="4.8.2"
+ />
+ <Global
+ Name="RccDir"
+ Value=".\GeneratedFiles"
+ />
+ <Global
+ Name="UicDir"
+ Value=".\GeneratedFiles"
+ />
+ </Globals>
+</VisualStudioProject>
diff --git a/FTNoIR_Tracker_PT/Resources/Logo_IR.png b/FTNoIR_Tracker_PT/Resources/Logo_IR.png
new file mode 100644
index 00000000..95032a25
--- /dev/null
+++ b/FTNoIR_Tracker_PT/Resources/Logo_IR.png
Binary files differ
diff --git a/FTNoIR_Tracker_PT/Resources/icon.ico b/FTNoIR_Tracker_PT/Resources/icon.ico
new file mode 100644
index 00000000..c4b2aedc
--- /dev/null
+++ b/FTNoIR_Tracker_PT/Resources/icon.ico
Binary files differ
diff --git a/FTNoIR_Tracker_PT/camera.cpp b/FTNoIR_Tracker_PT/camera.cpp
new file mode 100644
index 00000000..a0bae694
--- /dev/null
+++ b/FTNoIR_Tracker_PT/camera.cpp
@@ -0,0 +1,62 @@
+#include "camera.h"
+
+using namespace cv;
+
+// ----------------------------------------------------------------------------
+Camera::Camera()
+ : dt_valid(0), dt_mean(0), cap(NULL)
+{}
+
+Camera::~Camera()
+{
+ if (cap) cvReleaseCapture(&cap);
+}
+
+void Camera::set_index(int index)
+{
+ if (cap) cvReleaseCapture(&cap);
+
+ cap = cvCreateCameraCapture(index);
+
+ // extract camera info
+ if (cap)
+ {
+ cam_info.res_x = cvGetCaptureProperty(cap, CV_CAP_PROP_FRAME_WIDTH);
+ cam_info.res_y = cvGetCaptureProperty(cap, CV_CAP_PROP_FRAME_HEIGHT);
+ }
+
+ // reset fps calculation
+ dt_mean = 0;
+}
+
+cv::Mat Camera::get_frame(float dt)
+{
+ cv::Mat frame;
+ if (cap && cvGrabFrame(cap) != 0)
+ {
+ // retrieve frame
+ IplImage* _img = cvRetrieveFrame(cap, 0);
+ if(_img)
+ {
+ if(_img->origin == IPL_ORIGIN_TL)
+ frame = Mat(_img);
+ else
+ {
+ Mat temp(_img);
+ flip(temp, frame, 0);
+ }
+ }
+ }
+
+ // measure fps of valid frames
+ const float dt_smoothing_const = 0.9;
+ dt_valid += dt;
+ if (!frame.empty())
+ {
+ 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 frame;
+} \ No newline at end of file
diff --git a/FTNoIR_Tracker_PT/camera.h b/FTNoIR_Tracker_PT/camera.h
new file mode 100644
index 00000000..69719fcc
--- /dev/null
+++ b/FTNoIR_Tracker_PT/camera.h
@@ -0,0 +1,46 @@
+/* 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 CAMERA_H
+#define CAMERA_H
+
+#include <opencv2/opencv.hpp>
+
+// ----------------------------------------------------------------------------
+struct CamInfo
+{
+ int res_x;
+ int res_y;
+ int fps;
+ float f; // (focal length) / (sensor width)
+};
+
+// ----------------------------------------------------------------------------
+class Camera
+{
+public:
+
+ Camera();
+ ~Camera();
+
+ void set_index(int index);
+ void set_f(float f) { cam_info.f = f; }
+
+ // gets a frame from the camera, dt: time since last call in seconds
+ cv::Mat get_frame(float dt);
+
+ // WARNING: returned reference is valid as long as object
+ const CamInfo& get_info() const { return cam_info; }
+
+protected:
+ CvCapture* cap;
+ CamInfo cam_info;
+ float dt_valid;
+ float dt_mean;
+};
+
+#endif //CAMERA_H
diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp b/FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp
new file mode 100644
index 00000000..2e8430bc
--- /dev/null
+++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp
@@ -0,0 +1,184 @@
+/* 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 "ftnoir_tracker_pt.h"
+#include <QHBoxLayout>
+#include <cmath>
+#include <QDebug>
+
+using namespace std;
+using namespace cv;
+using namespace boost;
+
+//-----------------------------------------------------------------------------
+Tracker::Tracker()
+ : frame_count(0), commands(0), video_widget(NULL)
+{
+ qDebug()<<"Tracker Const";
+ TrackerSettings settings;
+ settings.load_ini();
+ apply(settings);
+ qDebug()<<"Tracker Starting";
+ start();
+}
+
+Tracker::~Tracker()
+{
+ set_command(ABORT);
+ wait();
+ if (video_widget) delete video_widget;
+}
+
+void Tracker::set_command(Command command)
+{
+ QMutexLocker lock(&mutex);
+ commands |= command;
+}
+
+void Tracker::reset_command(Command command)
+{
+ QMutexLocker lock(&mutex);
+ commands &= ~command;
+}
+
+void Tracker::run()
+{
+ qDebug()<<"Tracker Thread started";
+ time.start();
+ forever
+ {
+ {
+ QMutexLocker lock(&mutex);
+
+ if (commands & ABORT) break;
+ if (commands & PAUSE) continue;
+ commands = 0;
+
+ float dt = time.elapsed() / 1000.0;
+ time.restart();
+
+ frame = camera.get_frame(dt);
+ if (!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++;
+ }
+ }
+ msleep(sleep_time);
+ }
+ qDebug()<<"Tracker Thread stopping";
+}
+
+void Tracker::apply(const TrackerSettings& settings)
+{
+ apply_without_camindex(settings);
+ QMutexLocker lock(&mutex);
+ qDebug()<<"Tracker: setting cam index "<<settings.cam_index;
+ camera.set_index(settings.cam_index);
+ qDebug()<<"Tracker: done setting cam index";
+}
+
+void Tracker::apply_without_camindex(const TrackerSettings& settings)
+{
+ qDebug()<<"Tracker::apply_without_camindex";
+ QMutexLocker lock(&mutex);
+ 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;
+ draw_frame = settings.video_widget;
+ t_MH = settings.t_MH;
+}
+
+//-----------------------------------------------------------------------------
+// ITracker interface
+void Tracker::Initialize(QFrame *videoframe)
+{
+ const int VIDEO_FRAME_WIDTH = 252;
+ const int VIDEO_FRAME_HEIGHT = 189;
+
+ qDebug("Tracker::Initialize()");
+ // setup video frame
+ videoframe->setAttribute(Qt::WA_NativeWindow);
+ videoframe->show();
+ video_widget = new VideoWidget(videoframe);
+ QHBoxLayout* layout = new QHBoxLayout();
+ layout->setContentsMargins(0, 0, 0, 0);
+ layout->addWidget(video_widget);
+ if (videoframe->layout()) delete videoframe->layout();
+ videoframe->setLayout(layout);
+ video_widget->resize(VIDEO_FRAME_WIDTH, VIDEO_FRAME_HEIGHT);
+}
+
+void Tracker::refreshVideo()
+{
+ if (video_widget)
+ {
+ Mat frame_copy;
+ shared_ptr< vector<Vec2f> > points;
+ //qDebug("Tracker::refreshVideo()");
+ {
+ QMutexLocker lock(&mutex);
+ if (!draw_frame || frame.empty()) return;
+
+ // copy the frame and points from the tracker thread
+ frame_copy = frame.clone();
+ points = shared_ptr< vector<Vec2f> >(new vector<Vec2f>(point_extractor.get_points()));
+ }
+
+ video_widget->update(frame_copy, points);
+ }
+}
+
+void Tracker::StartTracker(HWND parent_window)
+{
+ reset_command(PAUSE);
+}
+
+void Tracker::StopTracker(bool exit)
+{
+ set_command(PAUSE);
+}
+
+bool Tracker::GiveHeadPoseData(THeadPoseData *data)
+{
+ const float rad2deg = 180.0/3.14159265;
+ {
+ QMutexLocker lock(&mutex);
+ FrameTrafo pose = point_tracker.get_pose();
+
+ // get translation
+ Vec3f p = pose.R * t_MH + pose.t;
+ data->x = p[0] / 10.0; // convert to cm
+ data->y = p[1] / 10.0;
+ data->z = p[2] / 10.0;
+
+ // extract rotation angles from rotation matrix
+ const Matx33f& R = pose.R;
+ data->yaw = atan2( -R(2,0), sqrt(R(0,0)*R(0,0) + R(1,0)*R(1,0)) );
+ float cos_beta = cos(data->yaw);
+ if (cos_beta != 0)
+ {
+ data->pitch = rad2deg * atan2( R(2,1)/cos_beta, R(2,2)/cos_beta);
+ data->roll = rad2deg * atan2( R(1,0)/cos_beta, R(0,0)/cos_beta);
+ }
+ data->yaw *= rad2deg;
+ }
+ refreshVideo();
+ return true;
+}
+
+//-----------------------------------------------------------------------------
+#pragma comment(linker, "/export:GetTracker=_GetTracker@0")
+
+FTNOIR_TRACKER_BASE_EXPORT TRACKERHANDLE __stdcall GetTracker()
+{
+ return new Tracker;
+} \ No newline at end of file
diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt.h b/FTNoIR_Tracker_PT/ftnoir_tracker_pt.h
new file mode 100644
index 00000000..a3390cbf
--- /dev/null
+++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt.h
@@ -0,0 +1,81 @@
+/* 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 FTNOIR_TRACKER_PT_H
+#define FTNOIR_TRACKER_PT_H
+
+#include "..\ftnoir_tracker_base\ftnoir_tracker_base.h"
+#include "ftnoir_tracker_pt_settings.h"
+#include "camera.h"
+#include "point_extractor.h"
+#include "point_tracker.h"
+#include "video_widget.h"
+
+#include <QThread>
+#include <QMutex>
+#include <QTime>
+#include <opencv2/opencv.hpp>
+
+//-----------------------------------------------------------------------------
+class Tracker : public ITracker, QThread
+{
+public:
+ Tracker();
+ ~Tracker();
+
+ // ITracker interface
+ void Initialize(QFrame *videoframe);
+ void StartTracker(HWND parent_window);
+ void StopTracker(bool exit);
+ bool GiveHeadPoseData(THeadPoseData *data);
+ void refreshVideo();
+
+ void apply(const TrackerSettings& settings);
+ void apply_without_camindex(const TrackerSettings& settings); // changing the camindex is expensive and not suitable for realtime editing
+ void run();
+
+ void get_pose(FrameTrafo* X_CM) { QMutexLocker lock(&mutex); *X_CM = point_tracker.get_pose(); }
+ int get_n_points() { QMutexLocker lock(&mutex); return point_extractor.get_points().size(); }
+ void get_cam_info(CamInfo* info) { QMutexLocker lock(&mutex); *info = camera.get_info(); }
+
+protected:
+ QMutex mutex;
+ cv::Mat frame; // the output frame for display
+
+ enum Command {
+ ABORT = 1<<0,
+ PAUSE = 1<<1
+ };
+ void set_command(Command command);
+ void reset_command(Command command);
+ int commands;
+
+ Camera camera;
+ PointExtractor point_extractor;
+ PointTracker point_tracker;
+ cv::Vec3f t_MH;
+ bool draw_frame;
+ int sleep_time;
+
+ long frame_count;
+
+ VideoWidget* video_widget;
+ QTime time;
+};
+
+//-----------------------------------------------------------------------------
+class TrackerDll : public ITrackerDll
+{
+ // ITrackerDll interface
+ void Initialize() {}
+ void getFullName(QString *strToBeFilled);
+ void getShortName(QString *strToBeFilled);
+ void getDescription(QString *strToBeFilled);
+ void getIcon(QIcon *icon);
+};
+
+#endif // FTNOIR_TRACKER_PT_H
diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt.qrc b/FTNoIR_Tracker_PT/ftnoir_tracker_pt.qrc
new file mode 100644
index 00000000..d1dab18a
--- /dev/null
+++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt.qrc
@@ -0,0 +1,6 @@
+<RCC>
+ <qresource prefix="/">
+ <file>Resources/icon.ico</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
new file mode 100644
index 00000000..4b79b892
--- /dev/null
+++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.cpp
@@ -0,0 +1,208 @@
+/* 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 "ftnoir_tracker_pt_dialog.h"
+
+#include <QMessageBox>
+#include <QDebug>
+
+//-----------------------------------------------------------------------------
+TrackerDialog::TrackerDialog()
+ : settings_dirty(false), tracker(NULL), timer(this), trans_calib_running(false)
+{
+ ui.setupUi( this );
+
+ settings.load_ini();
+
+ // initialize ui values
+ ui.videowidget_check->setChecked(settings.video_widget);
+ ui.sleep_spin->setValue(settings.sleep_time);
+ ui.camindex_spin->setValue(settings.cam_index);
+ ui.f_dspin->setValue(settings.cam_f);
+ 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.tx_spin->setValue(settings.t_MH[0]);
+ ui.ty_spin->setValue(settings.t_MH[1]);
+ ui.tz_spin->setValue(settings.t_MH[2]);
+
+ ui.tcalib_button->setEnabled(false);
+
+ // 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.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.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.tcalib_button,SIGNAL(toggled(bool)), this,SLOT(startstop_trans_calib(bool)) );
+
+ connect(ui.ok_button, SIGNAL(clicked()), this, SLOT(doOK()));
+ connect(ui.cancel_button, SIGNAL(clicked()), this, SLOT(doCancel()));
+
+ connect(&timer,SIGNAL(timeout()), this,SLOT(poll_tracker_info()));
+ timer.start(100);
+}
+
+void TrackerDialog::startstop_trans_calib(bool start)
+{
+ if (start)
+ {
+ qDebug()<<"TrackerDialog:: starting translation calibration";
+ trans_calib.reset();
+ trans_calib_running = true;
+ }
+ else
+ {
+ qDebug()<<"TrackerDialog:: stoppping translation calibration";
+ trans_calib_running = false;
+ settings.t_MH = trans_calib.get_estimate();
+ settings_changed();
+ }
+}
+
+void TrackerDialog::trans_calib_step()
+{
+ if (tracker)
+ {
+ FrameTrafo X_CM;
+ tracker->get_pose(&X_CM);
+ trans_calib.update(X_CM.R, X_CM.t);
+ cv::Vec3f t_MH = trans_calib.get_estimate();
+ qDebug()<<"TrackerDialog:: current translation estimate: "<<t_MH[0]<<t_MH[1]<<t_MH[2];
+ ui.tx_spin->setValue(t_MH[0]);
+ ui.ty_spin->setValue(t_MH[1]);
+ ui.tz_spin->setValue(t_MH[2]);
+ }
+}
+
+void TrackerDialog::set_cam_index(int val)
+{
+ settings.cam_index = val;
+ settings_dirty = true;
+ if (tracker)
+ tracker->apply(settings);
+}
+
+void TrackerDialog::settings_changed()
+{
+ settings_dirty = true;
+ if (tracker)
+ tracker->apply_without_camindex(settings);
+}
+
+void TrackerDialog::doOK()
+{
+ settings.save_ini();
+ close();
+}
+
+void TrackerDialog::doCancel()
+{
+ if (settings_dirty) {
+ int ret = QMessageBox::question ( this, "Settings have changed", "Do you want to save the settings?",
+ QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Discard );
+ switch (ret) {
+ case QMessageBox::Save:
+ settings.save_ini();
+ close();
+ break;
+ case QMessageBox::Discard:
+ close();
+ break;
+ case QMessageBox::Cancel:
+ // Cancel was clicked
+ break;
+ default:
+ // should never be reached
+ break;
+ }
+ }
+ else {
+ close();
+ }
+}
+
+void TrackerDialog::poll_tracker_info()
+{
+ if (tracker)
+ {
+ CamInfo info;
+ tracker->get_cam_info(&info);
+ ui.caminfo_label->setText(QString::number(info.res_x)+"x"+QString::number(info.res_y)+" @ "+QString::number(info.fps)+" FPS");
+
+ int n_points = tracker->get_n_points();
+ QString to_print = QString::number(n_points);
+ if (n_points == 3)
+ to_print += " OK!";
+ else
+ to_print += " BAD!";
+ ui.pointinfo_label->setText(to_print);
+
+ if (trans_calib_running) trans_calib_step();
+ }
+ else
+ {
+ ui.caminfo_label->setText("Tracker offline");
+ ui.pointinfo_label->setText("Tracker offline");
+ }
+}
+
+
+//-----------------------------------------------------------------------------
+// ITrackerDialog interface
+void TrackerDialog::Initialize(QWidget *parent)
+{
+ QPoint offsetpos(200, 200);
+ if (parent) {
+ this->move(parent->pos() + offsetpos);
+ }
+ show();
+}
+
+void TrackerDialog::registerTracker(ITracker *t)
+{
+ qDebug()<<"tracker registerd";
+ tracker = static_cast<Tracker*>(t);
+ if (isVisible() && settings_dirty)
+ tracker->apply(settings);
+ ui.tcalib_button->setEnabled(true);
+}
+
+void TrackerDialog::unRegisterTracker()
+{
+ qDebug()<<"tracker un-registerd";
+ tracker = NULL;
+ ui.tcalib_button->setEnabled(true);
+}
+
+//-----------------------------------------------------------------------------
+#pragma comment(linker, "/export:GetTrackerDialog=_GetTrackerDialog@0")
+
+FTNOIR_TRACKER_BASE_EXPORT TRACKERDIALOGHANDLE __stdcall GetTrackerDialog( )
+{
+ return new TrackerDialog;
+} \ No newline at end of file
diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.h b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.h
new file mode 100644
index 00000000..95736a8d
--- /dev/null
+++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.h
@@ -0,0 +1,72 @@
+/* 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 FTNOIR_TRACKER_PT_DIALOG_H
+#define FTNOIR_TRACKER_PT_DIALOG_H
+
+#include "..\ftnoir_tracker_base\ftnoir_tracker_base.h"
+#include "ftnoir_tracker_pt_settings.h"
+#include "ftnoir_tracker_pt.h"
+#include "ui_FTNoIR_PT_Controls.h"
+#include "trans_calib.h"
+
+#include <QTimer>
+
+//-----------------------------------------------------------------------------
+class TrackerDialog : public QWidget, Ui::UICPTClientControls, public ITrackerDialog
+{
+ Q_OBJECT
+public:
+ TrackerDialog();
+
+ // ITrackerDialog interface
+ void Initialize(QWidget *parent);
+ void registerTracker(ITracker *tracker);
+ void unRegisterTracker();
+
+ void trans_calib_step();
+
+protected slots:
+ void doOK();
+ void doCancel();
+
+ // ugly qt stuff
+ void set_video_widget(bool val) { settings.video_widget = val; settings_changed(); }
+ void set_sleep_time(int val) { settings.sleep_time = val; settings_changed(); }
+ void set_cam_index(int val);
+ void set_cam_f(double val) { settings.cam_f = val; settings_changed(); }
+ void set_min_point_size(int val) { settings.min_point_size = val; settings_changed(); }
+ void set_max_point_size(int val) { settings.max_point_size = val; settings_changed(); }
+ void set_threshold(int val) { settings.threshold = val; settings_changed(); }
+ 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 startstop_trans_calib(bool start);
+
+ void poll_tracker_info();
+
+protected:
+ void settings_changed();
+
+ TrackerSettings settings;
+ bool settings_dirty;
+
+ Tracker* tracker;
+ TranslationCalibrator trans_calib;
+ bool trans_calib_running;
+ QTimer timer;
+ Ui::UICPTClientControls ui;
+};
+
+#endif //FTNOIR_TRACKER_PT_DIALOG_H \ No newline at end of file
diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dll.cpp b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dll.cpp
new file mode 100644
index 00000000..a9df65ac
--- /dev/null
+++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dll.cpp
@@ -0,0 +1,40 @@
+/* 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 "ftnoir_tracker_pt.h"
+
+#include <QIcon>
+
+//-----------------------------------------------------------------------------
+void TrackerDll::getFullName(QString *strToBeFilled)
+{
+ *strToBeFilled = "PointTracker 0.1";
+}
+
+void TrackerDll::getShortName(QString *strToBeFilled)
+{
+ *strToBeFilled = "PointTracker";
+}
+
+void TrackerDll::getDescription(QString *strToBeFilled)
+{
+ *strToBeFilled = "Tracks a 3-point model with know geometry like Freetrack / TrackIR";
+}
+
+void TrackerDll::getIcon(QIcon *icon)
+{
+ *icon = QIcon(":/Resources/icon.ico");
+}
+
+
+//-----------------------------------------------------------------------------
+#pragma comment(linker, "/export:GetTrackerDll=_GetTrackerDll@0")
+
+FTNOIR_TRACKER_BASE_EXPORT TRACKERDLLHANDLE __stdcall GetTrackerDll()
+{
+ return new TrackerDll;
+}
diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dll.h b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dll.h
new file mode 100644
index 00000000..34f6801e
--- /dev/null
+++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dll.h
@@ -0,0 +1,8 @@
+/* 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 "..\ftnoir_tracker_base\ftnoir_tracker_base.h" \ No newline at end of file
diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_settings.cpp b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_settings.cpp
new file mode 100644
index 00000000..e540d78f
--- /dev/null
+++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_settings.cpp
@@ -0,0 +1,71 @@
+/* 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 "ftnoir_tracker_pt.h"
+#include <QCoreApplication>
+#include <QSettings>
+
+//-----------------------------------------------------------------------------
+void TrackerSettings::load_ini()
+{
+ qDebug("TrackerSettings::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( "PointTracker" );
+
+ cam_index = iniFile.value("CameraId", 0).toInt();
+ cam_f = iniFile.value("CameraF", 1).toFloat();
+ threshold = iniFile.value("PointExtractThreshold", 128).toInt();
+ min_point_size = iniFile.value("PointExtractMinSize", 2).toInt();
+ max_point_size = iniFile.value("PointExtractMaxSize", 50).toInt();
+ M01[0] = iniFile.value("PointModelM01x", 0).toFloat();
+ M01[1] = iniFile.value("PointModelM01y", 40).toFloat();
+ M01[2] = iniFile.value("PointModelM01z", -30).toFloat();
+ M02[0] = iniFile.value("PointModelM02x", 0).toFloat();
+ M02[1] = iniFile.value("PointModelM02y", -70).toFloat();
+ M02[2] = iniFile.value("PointModelM02z", -80).toFloat();
+ t_MH[0] = iniFile.value("tMHx", 0).toFloat();
+ t_MH[1] = iniFile.value("tMHy", 0).toFloat();
+ t_MH[2] = iniFile.value("tMHz", 0).toFloat();
+ video_widget = iniFile.value("VideoWidget", true).toBool();
+ sleep_time = iniFile.value("SleepTime", 10).toInt();
+
+ iniFile.endGroup();
+}
+
+void TrackerSettings::save_ini() const
+{
+ qDebug("TrackerSettings::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 ( "PointTracker" );
+
+ iniFile.setValue("CameraId", cam_index);
+ iniFile.setValue("CameraF", cam_f);
+ iniFile.setValue("PointExtractThreshold", threshold);
+ iniFile.setValue("PointExtractMinSize", min_point_size);
+ iniFile.setValue("PointExtractMaxSize", max_point_size);
+ iniFile.setValue("PointModelM01x", M01[0]);
+ iniFile.setValue("PointModelM01y", M01[1]);
+ iniFile.setValue("PointModelM01z", M01[2]);
+ iniFile.setValue("PointModelM02x", M02[0]);
+ iniFile.setValue("PointModelM02y", M02[1]);
+ iniFile.setValue("PointModelM02z", M02[2]);
+ iniFile.setValue("tMHx", t_MH[0]);
+ iniFile.setValue("tMHy", t_MH[1]);
+ iniFile.setValue("tMHz", t_MH[2]);
+ iniFile.setValue("VideoWidget", video_widget);
+ iniFile.setValue("SleepTime", sleep_time);
+
+ iniFile.endGroup();
+} \ 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
new file mode 100644
index 00000000..de0366e9
--- /dev/null
+++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_settings.h
@@ -0,0 +1,40 @@
+/* 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 FTNOIR_TRACKER_PT_SETTINGS_H
+#define FTNOIR_TRACKER_PT_SETTINGS_H
+
+#include <opencv2/opencv.hpp>
+#include "point_tracker.h"
+
+//-----------------------------------------------------------------------------
+struct TrackerSettings
+{
+ // camera
+ int cam_index;
+ float cam_f;
+
+ // point extraction
+ int threshold;
+ int min_point_size;
+ int max_point_size;
+
+ // point tracking
+ cv::Vec3f M01;
+ cv::Vec3f M02;
+
+ // head to model translation
+ cv::Vec3f t_MH;
+
+ int sleep_time;
+ bool video_widget;
+
+ 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
new file mode 100644
index 00000000..956a2834
--- /dev/null
+++ b/FTNoIR_Tracker_PT/point_extractor.cpp
@@ -0,0 +1,57 @@
+/* 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 "point_extractor.h"
+
+#include <QDebug>
+
+using namespace cv;
+using namespace std;
+
+// ----------------------------------------------------------------------------
+const vector<Vec2f>& PointExtractor::extract_points(Mat frame, float dt, bool draw_output)
+{
+ // convert to grayscale
+ Mat frame_bw;
+ cvtColor(frame, frame_bw, CV_RGB2GRAY);
+
+ // convert to binary
+ threshold(frame_bw, frame_bw, threshold_val, 255, THRESH_BINARY);
+ erode(frame_bw, frame_bw, Mat(), Point(-1,-1), min_size);
+
+ // 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 - min_size) break;
+ Moments m = moments(*iter);
+ if (m.m00 == 0) break;
+ // 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);
+ }
+
+ // draw output image
+ if (draw_output)
+ {
+ frame.setTo(Scalar(255,0,0), frame_bw);
+ }
+
+ return points;
+}
diff --git a/FTNoIR_Tracker_PT/point_extractor.h b/FTNoIR_Tracker_PT/point_extractor.h
new file mode 100644
index 00000000..b142d2bb
--- /dev/null
+++ b/FTNoIR_Tracker_PT/point_extractor.h
@@ -0,0 +1,31 @@
+/* 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 POINTEXTRACTOR_H
+#define POINTEXTRACTOR_H
+
+#include <opencv2/opencv.hpp>
+
+// ----------------------------------------------------------------------------
+// Extracts points from an opencv image
+class PointExtractor
+{
+public:
+ // extracts points from frame and draws some processing info into frame, if draw_output is set
+ // dt: time since last call in seconds
+ // WARNING: returned reference is valid as long as object
+ const std::vector<cv::Vec2f>& extract_points(cv::Mat frame, float dt, bool draw_output);
+ const std::vector<cv::Vec2f>& get_points() { return points; }
+
+ int threshold_val;
+ int min_size, max_size;
+
+protected:
+ std::vector<cv::Vec2f> points;
+};
+
+#endif //POINTEXTRACTOR_H
diff --git a/FTNoIR_Tracker_PT/point_tracker.cpp b/FTNoIR_Tracker_PT/point_tracker.cpp
new file mode 100644
index 00000000..8a32326d
--- /dev/null
+++ b/FTNoIR_Tracker_PT/point_tracker.cpp
@@ -0,0 +1,231 @@
+/* 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 "point_tracker.h"
+
+#include <vector>
+#include <algorithm>
+#include <cmath>
+
+#include <QDebug>
+
+using namespace cv;
+using namespace boost;
+using namespace std;
+
+const float PI = 3.14159265358979323846f;
+
+// ----------------------------------------------------------------------------
+static void get_row(const Matx33f& m, int i, Vec3f& v)
+{
+ v[0] = m(i,0);
+ v[1] = m(i,1);
+ v[2] = m(i,2);
+}
+
+static void set_row(Matx33f& m, int i, const Vec3f& v)
+{
+ m(i,0) = v[0];
+ m(i,1) = v[1];
+ m(i,2) = v[2];
+}
+
+// ----------------------------------------------------------------------------
+PointModel::PointModel(Vec3f M01, Vec3f M02)
+ : M01(M01), M02(M02)
+{
+ // calculate u
+ u = M01.cross(M02);
+ u /= norm(u);
+
+ // calculate projection matrix on M01,M02 plane
+ float s11 = M01.dot(M01);
+ float s12 = M01.dot(M02);
+ float s22 = M02.dot(M02);
+ P = 1.0/(s11*s22-s12*s12) * Matx22f(s22, -s12,
+ -s12, s11);
+
+ // calculate d and d_order for simple freetrack-like point correspondence
+ vector<Vec2f> points;
+ points.push_back(Vec2f(0,0));
+ points.push_back(Vec2f(M01[0], M01[1]));
+ points.push_back(Vec2f(M02[0], M02[1]));
+ // fit line to orthographically projected points
+ // ERROR: yields wrong results with colinear points?!
+ /*
+ Vec4f line;
+ fitLine(points, line, CV_DIST_L2, 0, 0.01, 0.01);
+ d[0] = line[0]; d[1] = line[1];
+ */
+ // TODO: fix this
+ d = Vec2f(M01[0]-M02[0], M01[1]-M02[1]);
+
+ // sort model points
+ get_d_order(points, d_order);
+}
+
+void PointModel::get_d_order(const std::vector<cv::Vec2f>& points, int d_order[]) const
+{
+ // get sort indices with respect to d scalar product
+ vector< pair<float,int> > d_vals;
+ for (int i = 0; i<points.size(); ++i)
+ d_vals.push_back(pair<float, int>(d.dot(points[i]), i));
+
+ struct
+ {
+ bool operator()(const pair<float, int>& a, const pair<float, int>& b) { return a.first < b.first; }
+ } comp;
+ sort(d_vals.begin(), d_vals.end(), comp);
+
+ for (int i = 0; i<points.size(); ++i)
+ d_order[i] = d_vals[i].second;
+}
+
+
+// ----------------------------------------------------------------------------
+PointTracker::PointTracker()
+{
+ X_CM.t[2] = 1000; // default position: 1 m away from cam
+}
+
+bool PointTracker::track(const vector<Vec2f>& points, float f, float dt)
+{
+ if (!point_model) return false;
+ if (!find_correspondences(points)) return false;
+ POSIT(f);
+ return true;
+}
+
+bool PointTracker::find_correspondences(const vector<Vec2f>& points)
+{
+ if (points.size() != PointModel::N_POINTS) return false;
+
+ // 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]];
+ }
+ return true;
+}
+
+void PointTracker::POSIT(float f)
+{
+ float old_epsilon_1 = 0;
+ float old_epsilon_2 = 0;
+ float epsilon_1 = 1;
+ float epsilon_2 = 1;
+
+ Vec3f I0, J0;
+ Vec2f I0_coeff, J0_coeff;
+
+ Vec3f I_1, J_1, I_2, J_2;
+ 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-3;
+
+ int i=1;
+ for (; i<MAX_ITER; ++i)
+ {
+ epsilon_1 = k.dot(point_model->M01)/Z0;
+ epsilon_2 = k.dot(point_model->M02)/Z0;
+
+ // vector of scalar products <I0, M0i> and <J0, M0i>
+ Vec2f I0_M0i(p[1][0]*(1.0 + epsilon_1) - p[0][0],
+ p[2][0]*(1.0 + epsilon_2) - p[0][0]);
+ Vec2f J0_M0i(p[1][1]*(1.0 + epsilon_1) - p[0][1],
+ p[2][1]*(1.0 + epsilon_2) - p[0][1]);
+
+ // construct projection of I, J onto M0i plane: I0 and J0
+ I0_coeff = point_model->P * I0_M0i;
+ J0_coeff = point_model->P * J0_M0i;
+ I0 = I0_coeff[0]*point_model->M01 + I0_coeff[1]*point_model->M02;
+ J0 = J0_coeff[0]*point_model->M01 + J0_coeff[1]*point_model->M02;
+
+ // calculate u component of I, J
+ float II0 = I0.dot(I0);
+ float IJ0 = I0.dot(J0);
+ float JJ0 = J0.dot(J0);
+ float rho, theta;
+ if (JJ0 == II0) {
+ rho = sqrt(abs(2*IJ0));
+ theta = -PI/4;
+ if (IJ0<0) theta *= -1;
+ }
+ else {
+ rho = sqrt(sqrt( (JJ0-II0)*(JJ0-II0) + 4*IJ0*IJ0 ));
+ theta = atan( -2*IJ0 / (JJ0-II0) );
+ if (JJ0 - II0 < 0) theta += PI;
+ theta /= 2;
+ }
+
+ // construct the two solutions
+ I_1 = I0 + rho*cos(theta)*point_model->u;
+ I_2 = I0 - rho*cos(theta)*point_model->u;
+
+ J_1 = J0 + rho*sin(theta)*point_model->u;
+ J_2 = J0 - rho*sin(theta)*point_model->u;
+
+ float norm_const = 1.0/norm(I_1); // all have the same norm
+
+ // create rotation matrices
+ I_1 *= norm_const; J_1 *= norm_const;
+ I_2 *= norm_const; J_2 *= norm_const;
+
+ set_row(R_1, 0, I_1);
+ set_row(R_1, 1, J_1);
+ set_row(R_1, 2, I_1.cross(J_1));
+
+ set_row(R_2, 0, I_2);
+ set_row(R_2, 1, J_2);
+ set_row(R_2, 2, I_2.cross(J_2));
+
+ // the single translation solution
+ Z0 = norm_const * f;
+
+ // pick the rotation solution closer to the expected one
+ // in simple metric d(A,B) = || I - A * B^T ||
+ float R_1_deviation = norm(Matx33f::eye() - R_expected * R_1.t());
+ float R_2_deviation = norm(Matx33f::eye() - R_expected * R_2.t());
+
+ if (R_1_deviation < R_2_deviation)
+ R_current = &R_1;
+ else
+ R_current = &R_2;
+
+ get_row(*R_current, 2, k);
+
+ // check for convergence condition
+ if (abs(epsilon_1 - old_epsilon_1) + abs(epsilon_2 - old_epsilon_2) < EPS_THRESHOLD)
+ break;
+ old_epsilon_1 = epsilon_1;
+ old_epsilon_2 = epsilon_2;
+ }
+
+ 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;
+
+ //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
new file mode 100644
index 00000000..ca222a3b
--- /dev/null
+++ b/FTNoIR_Tracker_PT/point_tracker.h
@@ -0,0 +1,91 @@
+/* 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 POINTTRACKER_H
+#define POINTTRACKER_H
+
+#include <opencv2/opencv.hpp>
+#include <boost/shared_ptr.hpp>
+#include <list>
+
+// ----------------------------------------------------------------------------
+// Afine frame trafo
+class FrameTrafo
+{
+public:
+ FrameTrafo() : R(cv::Matx33f::eye()), t(0,0,0) {}
+ FrameTrafo(const cv::Matx33f& R, const cv::Vec3f& t) : R(R),t(t) {}
+
+ cv::Matx33f R;
+ cv::Vec3f t;
+};
+
+inline FrameTrafo operator*(const FrameTrafo& X, const FrameTrafo& Y)
+{
+ return FrameTrafo(X.R*Y.R, X.R*Y.t + X.t);
+}
+
+inline cv::Vec3f operator*(const FrameTrafo& X, const cv::Vec3f& v)
+{
+ return X.R*v + X.t;
+}
+
+// ----------------------------------------------------------------------------
+// Describes a 3-point model
+// nomenclature as in
+// [Denis Oberkampf, Daniel F. DeMenthon, Larry S. Davis: "Iterative Pose Estimation Using Coplanar Feature Points"]
+class PointModel
+{
+ friend class PointTracker;
+public:
+ static const int N_POINTS = 3;
+
+ PointModel(cv::Vec3f M01, cv::Vec3f M02);
+
+ const cv::Vec3f& get_M01() const { return M01; };
+ const cv::Vec3f& get_M02() const { return M02; };
+
+protected:
+ cv::Vec3f M01; // M01 in model frame
+ cv::Vec3f M02; // M02 in model frame
+
+ cv::Vec3f u; // unit vector perpendicular to M01,M02-plane
+
+ cv::Matx22f P;
+
+ cv::Vec2f d; // discrimant vector for point correspondence
+ int d_order[3]; // sorting of projected model points with respect to d scalar product
+
+ void get_d_order(const std::vector<cv::Vec2f>& points, int d_order[]) const;
+};
+
+// ----------------------------------------------------------------------------
+// Tracks a 3-point model
+// implementing the POSIT algorithm for coplanar points as presented in
+// [Denis Oberkampf, Daniel F. DeMenthon, Larry S. Davis: "Iterative Pose Estimation Using Coplanar Feature Points"]
+class PointTracker
+{
+public:
+ PointTracker();
+
+ // track the pose using the set of normalized point coordinates (x pos in range -0.5:0.5)
+ // f : (focal length)/(sensor width)
+ bool track(const std::vector<cv::Vec2f>& points, float f, float dt);
+ boost::shared_ptr<PointModel> point_model;
+
+ FrameTrafo get_pose() const { return X_CM; }
+
+protected:
+ bool find_correspondences(const std::vector<cv::Vec2f>& points);
+ cv::Vec2f p[PointModel::N_POINTS]; // the points in model order
+
+ void POSIT(float f);
+
+ FrameTrafo X_CM; // trafo from model to camera
+};
+
+#endif //POINTTRACKER_H
diff --git a/FTNoIR_Tracker_PT/resource.h b/FTNoIR_Tracker_PT/resource.h
new file mode 100644
index 00000000..c14e94ad
--- /dev/null
+++ b/FTNoIR_Tracker_PT/resource.h
@@ -0,0 +1,14 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by FTNoIR_Tracker_PT.rc
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 101
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1001
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/FTNoIR_Tracker_PT/trans_calib.cpp b/FTNoIR_Tracker_PT/trans_calib.cpp
new file mode 100644
index 00000000..260d24b1
--- /dev/null
+++ b/FTNoIR_Tracker_PT/trans_calib.cpp
@@ -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.
+ */
+
+#include "trans_calib.h"
+
+using namespace cv;
+
+//-----------------------------------------------------------------------------
+TranslationCalibrator::TranslationCalibrator()
+{
+ reset();
+}
+
+void TranslationCalibrator::reset()
+{
+ P = Matx66f::zeros();
+ y = Vec6f(0,0,0, 0,0,0);
+}
+
+void TranslationCalibrator::update(const Matx33f& R_CM_k, const Vec3f& t_CM_k)
+{
+ Matx<float, 6,3> H_k_T = Matx<float, 6,3>::zeros();
+ for (int i=0; i<3; ++i) {
+ for (int j=0; j<3; ++j) {
+ H_k_T(i,j) = R_CM_k(j,i);
+ }
+ }
+ for (int i=0; i<3; ++i)
+ {
+ H_k_T(3+i,i) = 1.0;
+ }
+ P += H_k_T * H_k_T.t();
+ y += H_k_T * t_CM_k;
+}
+
+Vec3f TranslationCalibrator::get_estimate()
+{
+ Vec6f x = P.inv() * y;
+ return Vec3f(x[0], x[1], x[2]);
+} \ No newline at end of file
diff --git a/FTNoIR_Tracker_PT/trans_calib.h b/FTNoIR_Tracker_PT/trans_calib.h
new file mode 100644
index 00000000..57b9496c
--- /dev/null
+++ b/FTNoIR_Tracker_PT/trans_calib.h
@@ -0,0 +1,39 @@
+/* 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 TRANSCALIB_H
+#define TRANSCALIB_H
+
+#include <opencv2/opencv.hpp>
+
+//-----------------------------------------------------------------------------
+// calibrates the translation from head to model = t_MH
+// by recursive least squares /
+// kalman filter in information form with identity noise covariance
+// measurement equation when head position = t_CH is fixed:
+// (R_CM_k , Id)*(t_MH, -t_CH) = t_CM_k
+
+class TranslationCalibrator
+{
+public:
+ TranslationCalibrator();
+
+ // reset the calibration process
+ void reset();
+
+ // update the current estimate
+ void update(const cv::Matx33f& R_CM_k, const cv::Vec3f& t_CM_k);
+
+ // get the current estimate for t_MH
+ cv::Vec3f get_estimate();
+
+protected:
+ cv::Matx66f P; // normalized precision matrix = inverse covariance
+ cv::Vec6f y; // P*(t_MH, -c)
+};
+
+#endif //TRANSCALIB_H \ No newline at end of file
diff --git a/FTNoIR_Tracker_PT/video_widget.cpp b/FTNoIR_Tracker_PT/video_widget.cpp
new file mode 100644
index 00000000..598766b4
--- /dev/null
+++ b/FTNoIR_Tracker_PT/video_widget.cpp
@@ -0,0 +1,89 @@
+/* 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 "video_widget.h"
+
+#include <QDebug>
+
+using namespace cv;
+using namespace std;
+using namespace boost;
+
+// ----------------------------------------------------------------------------
+void VideoWidget::initializeGL()
+{
+ glClearColor(0.0, 0.0, 0.0, 0.0);
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
+}
+
+void VideoWidget::resizeGL(int w, int h)
+{
+ // setup 1 to 1 projection
+ glViewport(0, 0, w, h);
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ glOrtho(0, w, 0, h, -1, 1);
+ resize_frame();
+}
+
+void VideoWidget::paintGL()
+{
+ glClear(GL_COLOR_BUFFER_BIT);
+ if (!resized_qframe.isNull())
+ {
+ glDrawPixels(resized_qframe.width(), resized_qframe.height(), GL_RGBA, GL_UNSIGNED_BYTE, resized_qframe.bits());
+
+ const int crosshair_radius = 10;
+ const int crosshair_thickness = 1;
+
+ glColor3f(1.0, 0.0, 0.0);
+ glLineWidth(crosshair_thickness);
+ int x,y;
+ for (vector<Vec2f>::iterator iter = points->begin();
+ iter != points->end();
+ ++iter)
+ {
+ x = (*iter)[0] * resized_qframe.width() + resized_qframe.width()/2.0 + 0.5;
+ y = (*iter)[1] * resized_qframe.width() + resized_qframe.height()/2.0 + 0.5;
+
+ glBegin(GL_LINES);
+ glVertex2i(x-crosshair_radius, y);
+ glVertex2i(x+crosshair_radius, y);
+ glEnd();
+ glBegin(GL_LINES);
+ glVertex2i(x, y-crosshair_radius);
+ glVertex2i(x, y+crosshair_radius);
+ glEnd();
+ }
+ }
+ glFlush();
+}
+
+
+void VideoWidget::resize_frame()
+{
+ if (!qframe.isNull())
+ resized_qframe = qframe.scaled(this->size(), Qt::KeepAspectRatio);
+}
+
+
+void VideoWidget::update(Mat frame, shared_ptr< vector<Vec2f> > points)
+{
+ this->frame = frame;
+ this->points = points;
+
+ // convert to QImage
+ if (frame.channels() == 3)
+ qframe = QImage((const unsigned char*)(frame.data), frame.cols, frame.rows, frame.step, QImage::Format_RGB888).rgbSwapped();
+ else if (frame.channels() == 1)
+ qframe = QImage((const unsigned char*)(frame.data), frame.cols, frame.rows, frame.step, QImage::Format_Indexed8);
+ qframe = QGLWidget::convertToGLFormat(qframe);
+
+ resize_frame();
+ updateGL();
+}
diff --git a/FTNoIR_Tracker_PT/video_widget.h b/FTNoIR_Tracker_PT/video_widget.h
new file mode 100644
index 00000000..f49fef18
--- /dev/null
+++ b/FTNoIR_Tracker_PT/video_widget.h
@@ -0,0 +1,40 @@
+/* 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 VIDEOWIDGET_H
+#define VIDEOWIDGET_H
+
+#include <QGLWidget>
+#include <QTime>
+#include <opencv2/opencv.hpp>
+#include <boost/shared_ptr.hpp>
+
+// ----------------------------------------------------------------------------
+class VideoWidget : public QGLWidget
+{
+ Q_OBJECT
+
+public:
+ VideoWidget(QWidget *parent) : QGLWidget(parent) {}
+
+ void initializeGL();
+ void resizeGL(int w, int h);
+ void paintGL();
+
+ void update(cv::Mat frame, boost::shared_ptr< std::vector<cv::Vec2f> > points);
+
+private:
+ void resize_frame();
+
+ cv::Mat frame;
+ QImage qframe;
+ QImage resized_qframe;
+
+ boost::shared_ptr< std::vector<cv::Vec2f> > points;
+};
+
+#endif // VIDEOWIDGET_H