diff options
Diffstat (limited to 'ftnoir_tracker_pt')
-rw-r--r-- | ftnoir_tracker_pt/FTNoIR_PT_Controls.ui | 2204 | ||||
-rw-r--r-- | ftnoir_tracker_pt/ftnoir_tracker_pt.cpp | 21 | ||||
-rw-r--r-- | ftnoir_tracker_pt/ftnoir_tracker_pt.h | 4 | ||||
-rw-r--r-- | ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp | 28 | ||||
-rw-r--r-- | ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.h | 6 | ||||
-rw-r--r-- | ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h | 10 | ||||
-rw-r--r-- | ftnoir_tracker_pt/point_tracker.cpp | 179 | ||||
-rw-r--r-- | ftnoir_tracker_pt/point_tracker.h | 26 |
8 files changed, 997 insertions, 1481 deletions
diff --git a/ftnoir_tracker_pt/FTNoIR_PT_Controls.ui b/ftnoir_tracker_pt/FTNoIR_PT_Controls.ui index a2d5c47c..73b1f767 100644 --- a/ftnoir_tracker_pt/FTNoIR_PT_Controls.ui +++ b/ftnoir_tracker_pt/FTNoIR_PT_Controls.ui @@ -9,7 +9,7 @@ <rect> <x>0</x> <y>0</y> - <width>459</width> + <width>453</width> <height>621</height> </rect> </property> @@ -32,11 +32,83 @@ <property name="autoFillBackground"> <bool>false</bool> </property> - <layout class="QVBoxLayout" name="verticalLayout_2"> + <layout class="QGridLayout" name="gridLayout_9"> <property name="sizeConstraint"> <enum>QLayout::SetFixedSize</enum> </property> - <item> + <item row="1" column="0"> + <widget class="QGroupBox" name="groupBox_5"> + <property name="title"> + <string>Status</string> + </property> + <layout class="QGridLayout" name="gridLayout_10"> + <item row="2" column="2"> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_3"> + <property name="text"> + <string>Extracted Points:</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="2" column="1"> + <widget class="QDialogButtonBox" name="buttonBox_2"> + <property name="standardButtons"> + <set>QDialogButtonBox::Apply</set> + </property> + <property name="centerButtons"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="0" column="2"> + <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> + <item row="1" column="2"> + <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> + </layout> + </widget> + </item> + <item row="0" column="0"> <widget class="QTabWidget" name="tabWidget"> <property name="sizePolicy"> <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> @@ -56,73 +128,261 @@ <property name="currentIndex"> <number>0</number> </property> - <widget class="QWidget" name="tab"> + <widget class="QWidget" name="tab_2"> <attribute name="title"> - <string>General</string> + <string>Camera</string> </attribute> - <layout class="QVBoxLayout" name="verticalLayout_3"> + <layout class="QVBoxLayout" name="verticalLayout"> <item> - <widget class="QGroupBox" name="groupBox_6"> + <widget class="QGroupBox" name="groupBox"> <property name="title"> - <string>Tracker Thread</string> + <string>Camera settings</string> </property> - <layout class="QGridLayout" name="gridLayout"> + <layout class="QGridLayout" name="gridLayout_2"> <item row="0" column="0"> - <widget class="QLabel" name="label_43"> + <widget class="QLabel" name="label_2"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> <property name="text"> - <string>Auto-reset time</string> + <string>Device</string> </property> <property name="buddy"> - <cstring>reset_spin</cstring> + <cstring>camdevice_combo</cstring> </property> </widget> </item> <item row="0" column="1"> - <widget class="QSpinBox" name="reset_spin"> + <widget class="QComboBox" name="camdevice_combo"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumContentsLength"> + <number>10</number> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_36"> <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Minimum"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Width</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QSpinBox" name="res_x_spin"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="toolTip"> + <string>Desired capture width</string> + </property> + <property name="suffix"> + <string> px</string> + </property> + <property name="maximum"> + <number>2000</number> + </property> + <property name="singleStep"> + <number>10</number> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label_41"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Height</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QSpinBox" name="res_y_spin"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="toolTip"> - <string>Time until automatic reset of tracker's internal state when no valid tracking result is found</string> + <string>Desired capture height</string> </property> <property name="suffix"> - <string>ms</string> + <string> px</string> </property> <property name="maximum"> - <number>9999</number> + <number>2000</number> + </property> + <property name="singleStep"> + <number>10</number> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="label_37"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>FPS</string> + </property> + <property name="buddy"> + <cstring>fps_spin</cstring> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QSpinBox" name="fps_spin"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="toolTip"> + <string>Desired capture framerate</string> + </property> + <property name="suffix"> + <string> Hz</string> + </property> + <property name="maximum"> + <number>2000</number> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupBox_4"> + <property name="title"> + <string>Camera orientation</string> + </property> + <layout class="QGridLayout" name="gridLayout_3"> + <item row="0" column="0"> + <widget class="QLabel" name="label_18"> + <property name="text"> + <string>Roll</string> + </property> + <property name="buddy"> + <cstring>camroll_combo</cstring> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QComboBox" name="camroll_combo"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="toolTip"> + <string>Rotation of the camera image</string> </property> </widget> </item> <item row="1" column="0"> - <widget class="QLabel" name="label_17"> + <widget class="QLabel" name="label_4"> <property name="text"> - <string>Dynamic Pose Resolution</string> + <string>Pitch</string> + </property> + <property name="buddy"> + <cstring>campitch_spin</cstring> </property> </widget> </item> <item row="1" column="1"> - <widget class="QCheckBox" name="dynpose_check"> + <widget class="QSpinBox" name="campitch_spin"> + <property name="contextMenuPolicy"> + <enum>Qt::DefaultContextMenu</enum> + </property> <property name="toolTip"> - <string/> + <string>The angle the camera is facing upwards</string> + </property> + <property name="suffix"> + <string> deg</string> + </property> + <property name="minimum"> + <number>-180</number> + </property> + <property name="maximum"> + <number>180</number> </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QLabel" name="label_5"> <property name="text"> - <string/> + <string>positive = upwards</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label_20"> + <property name="text"> + <string>Yaw</string> + </property> + <property name="buddy"> + <cstring>camyaw_spin</cstring> </property> </widget> </item> <item row="2" column="1"> - <widget class="QPushButton" name="reset_button"> - <property name="enabled"> - <bool>false</bool> + <widget class="QSpinBox" name="camyaw_spin"> + <property name="contextMenuPolicy"> + <enum>Qt::DefaultContextMenu</enum> </property> <property name="toolTip"> - <string>Reset the tracker's internal state</string> + <string>The angle the camera is facing leftwards</string> </property> + <property name="suffix"> + <string> deg</string> + </property> + <property name="prefix"> + <string/> + </property> + <property name="minimum"> + <number>-180</number> + </property> + <property name="maximum"> + <number>180</number> + </property> + </widget> + </item> + <item row="2" column="2"> + <widget class="QLabel" name="label_21"> <property name="text"> - <string>Reset</string> + <string>positve = left</string> </property> </widget> </item> @@ -130,1071 +390,657 @@ </widget> </item> <item> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>20</height> - </size> + <widget class="QGroupBox" name="groupBox_2"> + <property name="title"> + <string>Point extraction</string> </property> - </spacer> + <layout class="QGridLayout" name="gridLayout_7"> + <item row="0" column="4"> + <widget class="QSpinBox" name="mindiam_spin"> + <property name="toolTip"> + <string>Minimum point diameter</string> + </property> + <property name="suffix"> + <string> px</string> + </property> + <property name="maximum"> + <number>1024</number> + </property> + </widget> + </item> + <item row="0" column="1" colspan="2"> + <widget class="QSlider" name="threshold_slider"> + <property name="toolTip"> + <string>Intensity threshold for point extraction</string> + </property> + <property name="maximum"> + <number>255</number> + </property> + <property name="pageStep"> + <number>1</number> + </property> + <property name="value"> + <number>127</number> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="tickPosition"> + <enum>QSlider::TicksBothSides</enum> + </property> + <property name="tickInterval"> + <number>25</number> + </property> + </widget> + </item> + <item row="1" column="4"> + <widget class="QSpinBox" name="maxdiam_spin"> + <property name="toolTip"> + <string>Maximum point diameter</string> + </property> + <property name="suffix"> + <string> px</string> + </property> + <property name="maximum"> + <number>1024</number> + </property> + </widget> + </item> + <item row="1" column="3"> + <widget class="QLabel" name="label_8"> + <property name="text"> + <string>Max size</string> + </property> + <property name="buddy"> + <cstring>maxdiam_spin</cstring> + </property> + </widget> + </item> + <item row="1" column="1" colspan="2"> + <widget class="QSlider" name="threshold_secondary_slider"> + <property name="toolTip"> + <string>Per pixel hysteresis width (leave left if there is little difference between dot and non-dot, move right for increased stability against pixel noise)</string> + </property> + <property name="maximum"> + <number>255</number> + </property> + <property name="pageStep"> + <number>1</number> + </property> + <property name="value"> + <number>100</number> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="tickPosition"> + <enum>QSlider::TicksBothSides</enum> + </property> + <property name="tickInterval"> + <number>25</number> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Threshold</string> + </property> + <property name="buddy"> + <cstring>threshold_slider</cstring> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_secondary"> + <property name="text"> + <string>Hysteresis</string> + </property> + <property name="buddy"> + <cstring>threshold_secondary_slider</cstring> + </property> + </widget> + </item> + <item row="0" column="3"> + <widget class="QLabel" name="label_7"> + <property name="text"> + <string>Min size</string> + </property> + <property name="buddy"> + <cstring>mindiam_spin</cstring> + </property> + </widget> + </item> + </layout> + </widget> </item> </layout> </widget> - <widget class="QWidget" name="tab_2"> + <widget class="QWidget" name="tab_4"> <attribute name="title"> - <string>Camera</string> + <string>Model</string> </attribute> - <layout class="QVBoxLayout" name="verticalLayout_7"> + <layout class="QVBoxLayout" name="verticalLayout_16"> <item> - <widget class="QGroupBox" name="groupBox"> - <property name="toolTip"> - <string>The camera device used as input</string> + <widget class="QTabWidget" name="model_tabs"> + <property name="tabShape"> + <enum>QTabWidget::Rounded</enum> </property> - <property name="title"> - <string>Camera Settings</string> + <property name="currentIndex"> + <number>1</number> + </property> + <property name="usesScrollButtons"> + <bool>false</bool> </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_3"> - <item> - <widget class="QLabel" name="label_2"> - <property name="minimumSize"> - <size> - <width>55</width> - <height>0</height> - </size> + <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="QGridLayout" name="gridLayout_6"> + <item row="0" column="0"> + <widget class="QGroupBox" name="groupBox_8"> + <property name="title"> + <string>Model Dimensions</string> + </property> + <widget class="QSpinBox" name="clip_tlength_spin"> + <property name="geometry"> + <rect> + <x>70</x> + <y>35</y> + <width>100</width> + <height>22</height> + </rect> + </property> + <property name="suffix"> + <string> units</string> + </property> + <property name="minimum"> + <number>-65535</number> + </property> + <property name="maximum"> + <number>65535</number> + </property> + </widget> + <widget class="QSpinBox" name="clip_bheight_spin"> + <property name="geometry"> + <rect> + <x>110</x> + <y>115</y> + <width>100</width> + <height>22</height> + </rect> + </property> + <property name="suffix"> + <string> units</string> + </property> + <property name="minimum"> + <number>-65535</number> + </property> + <property name="maximum"> + <number>65535</number> + </property> + </widget> + <widget class="QLabel" name="label_44"> + <property name="geometry"> + <rect> + <x>40</x> + <y>55</y> + <width>71</width> + <height>111</height> + </rect> </property> <property name="text"> - <string>Device</string> + <string/> </property> - <property name="buddy"> - <cstring>camdevice_combo</cstring> + <property name="pixmap"> + <pixmap resource="ftnoir_tracker_pt.qrc">:/Resources/clip_side.png</pixmap> </property> </widget> - </item> - <item> - <widget class="QComboBox" name="camdevice_combo"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> + <widget class="QLabel" name="label_50"> + <property name="geometry"> + <rect> + <x>10</x> + <y>35</y> + <width>46</width> + <height>13</height> + </rect> </property> - <property name="toolTip"> - <string>Camera device used as input</string> + <property name="text"> + <string>Side</string> </property> </widget> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_8"> - <item> - <layout class="QGridLayout" name="gridLayout_8"> - <item row="0" column="0"> - <widget class="QLabel" name="label_36"> - <property name="minimumSize"> - <size> - <width>55</width> - <height>0</height> - </size> + <widget class="QSpinBox" name="clip_blength_spin"> + <property name="geometry"> + <rect> + <x>50</x> + <y>165</y> + <width>100</width> + <height>22</height> + </rect> + </property> + <property name="suffix"> + <string> units</string> + </property> + <property name="minimum"> + <number>-65535</number> + </property> + <property name="maximum"> + <number>65535</number> + </property> + </widget> + <widget class="QSpinBox" name="clip_theight_spin"> + <property name="geometry"> + <rect> + <x>110</x> + <y>75</y> + <width>100</width> + <height>22</height> + </rect> + </property> + <property name="suffix"> + <string> units</string> + </property> + <property name="minimum"> + <number>-65535</number> + </property> + <property name="maximum"> + <number>65535</number> + </property> + </widget> + <widget class="QLabel" name="label_51"> + <property name="geometry"> + <rect> + <x>255</x> + <y>40</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>265</x> + <y>60</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> + </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</string> + </property> + <widget class="QLabel" name="label_46"> + <property name="geometry"> + <rect> + <x>30</x> + <y>90</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="QLabel" name="label_48"> + <property name="geometry"> + <rect> + <x>20</x> + <y>35</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>20</x> + <y>70</y> + <width>101</width> + <height>22</height> + </rect> + </property> + <property name="suffix"> + <string> units</string> + </property> + <property name="minimum"> + <number>-65535</number> + </property> + <property name="maximum"> + <number>65535</number> + </property> + </widget> + <widget class="QLabel" name="label_54"> + <property name="geometry"> + <rect> + <x>140</x> + <y>90</y> + <width>16</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>R</string> + </property> + </widget> + <widget class="QLabel" name="label_55"> + <property name="geometry"> + <rect> + <x>290</x> + <y>85</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>270</x> + <y>85</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>255</x> + <y>55</y> + <width>100</width> + <height>22</height> + </rect> + </property> + <property name="suffix"> + <string> units</string> + </property> + <property name="minimum"> + <number>-65535</number> + </property> + <property name="maximum"> + <number>65535</number> + </property> + </widget> + <widget class="QLabel" name="label_49"> + <property name="geometry"> + <rect> + <x>290</x> + <y>35</y> + <width>46</width> + <height>13</height> + </rect> + </property> + <property name="text"> + <string>Front</string> + </property> + </widget> + <widget class="QSpinBox" name="cap_height_spin"> + <property name="geometry"> + <rect> + <x>60</x> + <y>120</y> + <width>116</width> + <height>22</height> + </rect> + </property> + <property name="suffix"> + <string> units</string> + </property> + <property name="minimum"> + <number>-65535</number> + </property> + <property name="maximum"> + <number>65535</number> + </property> + </widget> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="tab_7"> + <attribute name="title"> + <string>Custom</string> + </attribute> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QGroupBox" name="groupBox_7"> + <property name="title"> + <string>Model Dimensions</string> + </property> + <layout class="QGridLayout" name="gridLayout_5"> + <item row="3" column="1"> + <widget class="QLabel" name="label_57"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> <property name="text"> - <string>Resolution</string> + <string>z:</string> </property> </widget> </item> - <item row="0" column="5"> - <widget class="QLabel" name="label_37"> - <property name="text"> - <string>FPS</string> + <item row="2" column="5"> + <widget class="QSpinBox" name="m2y_spin"> + <property name="suffix"> + <string> units</string> </property> - <property name="buddy"> - <cstring>fps_spin</cstring> + <property name="minimum"> + <number>-65535</number> + </property> + <property name="maximum"> + <number>65535</number> </property> </widget> </item> - <item row="0" column="6"> - <widget class="QSpinBox" name="fps_spin"> + <item row="1" column="1"> + <widget class="QLabel" name="label_63"> <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="toolTip"> - <string>Desired capture framerate</string> - </property> - <property name="maximum"> - <number>999</number> - </property> - </widget> - </item> - <item row="0" column="2"> - <widget class="QLabel" name="label_41"> <property name="text"> - <string>x</string> + <string>x:</string> </property> </widget> </item> - <item row="0" column="1"> - <widget class="QSpinBox" name="res_x_spin"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> + <item row="1" column="2"> + <widget class="QSpinBox" name="m1x_spin"> + <property name="suffix"> + <string> units</string> </property> - <property name="toolTip"> - <string>Desired capture width</string> + <property name="minimum"> + <number>-65535</number> </property> <property name="maximum"> - <number>2000</number> - </property> - <property name="singleStep"> - <number>10</number> + <number>65535</number> </property> </widget> </item> - <item row="0" column="3"> - <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> + <item row="2" column="2"> + <widget class="QSpinBox" name="m1y_spin"> + <property name="suffix"> + <string> units</string> </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_34"> - <property name="text"> - <string>F/W</string> + <property name="minimum"> + <number>-65535</number> </property> - <property name="buddy"> - <cstring>f_dspin</cstring> + <property name="maximum"> + <number>65535</number> </property> </widget> </item> - <item row="1" column="1"> - <widget class="QDoubleSpinBox" name="f_dspin"> - <property name="toolTip"> - <string>The camera's focal length devided by its sensor width</string> + <item row="3" column="5"> + <widget class="QSpinBox" name="m2z_spin"> + <property name="suffix"> + <string> units</string> </property> - <property name="decimals"> - <number>2</number> + <property name="minimum"> + <number>-65535</number> </property> - <property name="singleStep"> - <double>0.100000000000000</double> + <property name="maximum"> + <number>65535</number> </property> </widget> </item> - <item row="0" column="4"> - <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> + <item row="1" column="5"> + <widget class="QSpinBox" name="m2x_spin"> + <property name="suffix"> + <string> units</string> </property> - </spacer> - </item> - <item row="0" column="7"> - <spacer name="horizontalSpacer_9"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> + <property name="minimum"> + <number>-65535</number> </property> - <property name="sizeHint" stdset="0"> - <size> - <width>0</width> - <height>20</height> - </size> + <property name="maximum"> + <number>65535</number> </property> - </spacer> + </widget> </item> - </layout> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_7"/> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="groupBox_4"> - <property name="title"> - <string>Camera Orientation</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_8"> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_6"> - <item> - <layout class="QGridLayout" name="gridLayout_3"> - <item row="1" column="0"> - <widget class="QLabel" name="label_4"> + <item row="0" column="0" colspan="6"> + <widget class="QLabel" name="label_56"> <property name="text"> - <string>Pitch</string> - </property> - <property name="buddy"> - <cstring>campitch_spin</cstring> + <string><html><head/><body><p>Location of the two remaining model points<br/>with respect to the reference point in default pose</p><p>Use any units you want, e.g. millimeters, inches, parsecs...</p></body></html></string> </property> </widget> </item> - <item row="1" column="1"> - <widget class="QSpinBox" name="campitch_spin"> - <property name="contextMenuPolicy"> - <enum>Qt::DefaultContextMenu</enum> - </property> - <property name="toolTip"> - <string>The angle the camera is facing upwards</string> + <item row="3" column="2"> + <widget class="QSpinBox" name="m1z_spin"> + <property name="suffix"> + <string> units</string> </property> <property name="minimum"> - <number>-99</number> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_20"> - <property name="text"> - <string>Yaw</string> + <number>-65535</number> </property> - <property name="buddy"> - <cstring>camyaw_spin</cstring> + <property name="maximum"> + <number>65535</number> </property> </widget> </item> - <item row="2" column="1"> - <widget class="QSpinBox" name="camyaw_spin"> - <property name="contextMenuPolicy"> - <enum>Qt::DefaultContextMenu</enum> - </property> - <property name="toolTip"> - <string>The angle the camera is facing leftwards</string> - </property> - <property name="minimum"> - <number>-99</number> + <item row="2" column="4"> + <widget class="QLabel" name="label_70"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> - </widget> - </item> - <item row="2" column="2"> - <widget class="QLabel" name="label_21"> <property name="text"> - <string>deg (positve = leftwards)</string> + <string>y:</string> </property> </widget> </item> - <item row="0" column="1"> - <widget class="QComboBox" name="camroll_combo"> + <item row="1" column="4"> + <widget class="QLabel" name="label_67"> <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="toolTip"> - <string>Rotation of the camera image</string> - </property> - </widget> - </item> - <item row="1" column="2"> - <widget class="QLabel" name="label_5"> <property name="text"> - <string>deg (positive = upwards)</string> + <string>x:</string> </property> </widget> </item> - <item row="0" column="2"> - <widget class="QLabel" name="label_19"> - <property name="text"> - <string>deg</string> + <item row="1" column="3"> + <widget class="QLabel" name="label_64"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> - </widget> - </item> - <item row="0" column="0"> - <widget class="QLabel" name="label_18"> <property name="text"> - <string>Roll</string> - </property> - <property name="buddy"> - <cstring>camroll_combo</cstring> + <string><html><head/><body><p><span style=" font-size:16pt;">P</span><span style=" font-size:16pt; vertical-align:sub;">3</span></p></body></html></string> </property> </widget> </item> - </layout> - </item> - <item> - <spacer name="horizontalSpacer_10"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>0</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - </layout> - </widget> - </item> - <item> - <spacer name="verticalSpacer_2"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>0</height> - </size> - </property> - </spacer> - </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="toolTip"> - <string>Intensity threshold for point extraction</string> - </property> - <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_secondary"> - <item> - <widget class="QLabel" name="label_secondary"> - <property name="text"> - <string>Hysteresis</string> - </property> - <property name="buddy"> - <cstring>threshold_secondary_slider</cstring> - </property> - </widget> - </item> - <item> - <widget class="QSlider" name="threshold_secondary_slider"> - <property name="toolTip"> - <string>Per pixel hysteresis width (leave left if there is little difference between dot and non-dot, move right for increased stability against pixel noise)</string> - </property> - <property name="maximum"> - <number>255</number> - </property> - <property name="pageStep"> - <number>1</number> - </property> - <property name="value"> - <number>100</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"> - <property name="toolTip"> - <string>Minimum point diameter</string> - </property> - </widget> - </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"> - <property name="toolTip"> - <string>Maximum point diameter</string> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="label_13"> - <property name="text"> - <string>px</string> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="tab_4"> - <attribute name="title"> - <string>Model</string> - </attribute> - <layout class="QVBoxLayout" name="verticalLayout_16"> - <item> - <widget class="QTabWidget" name="model_tabs"> - <property name="tabShape"> - <enum>QTabWidget::Rounded</enum> - </property> - <property name="currentIndex"> - <number>2</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"> + <item row="1" column="0"> + <widget class="QLabel" name="label_60"> <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="minimumSize"> - <size> - <width>150</width> - <height>160</height> - </size> + <property name="text"> + <string><html><head/><body><p><span style=" font-size:16pt;">P</span><span style=" font-size:16pt; vertical-align:sub;">3</span></p></body></html></string> </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> - <widget class="QWidget" name="widget_3" native="true"> + <item row="3" column="4"> + <widget class="QLabel" name="label_69"> <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <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> - </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 name="text"> + <string>z:</string> </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> - <widget class="QWidget" name="widget_2" native="true"> + <item row="2" column="1"> + <widget class="QLabel" name="label_58"> <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <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> - </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><html><head/><body><p>Location of the two remaining model points<br/>with respect to the reference point in default pose</p></body></html></string> + <string>y:</string> </property> </widget> </item> - <item> - <spacer name="verticalSpacer_4"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>0</height> - </size> - </property> - </spacer> - </item> - <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>10</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>10</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item> - <spacer name="verticalSpacer_3"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>0</height> - </size> - </property> - </spacer> - </item> </layout> </widget> </item> @@ -1205,129 +1051,88 @@ <item> <widget class="QGroupBox" name="groupBox_10"> <property name="title"> - <string>Model Position (mm)</string> + <string>Model position</string> </property> - <layout class="QVBoxLayout" name="verticalLayout_11"> - <item> + <layout class="QGridLayout" name="gridLayout_4"> + <item row="1" column="1"> + <widget class="QSpinBox" name="tx_spin"> + <property name="suffix"> + <string> units</string> + </property> + <property name="minimum"> + <number>-65535</number> + </property> + <property name="maximum"> + <number>65536</number> + </property> + </widget> + </item> + <item row="0" column="0" colspan="3"> <widget class="QLabel" name="label_59"> <property name="text"> <string><html><head/><body><p>Translation from head center to model reference point<br/> in default pose</p></body></html></string> </property> </widget> </item> - <item> - <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>10</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <layout class="QGridLayout" name="gridLayout_6"> - <item row="3" column="1"> - <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="0"> - <widget class="QLabel" name="label_61"> - <property name="text"> - <string>x:</string> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_62"> - <property name="text"> - <string>y:</string> - </property> - </widget> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="label_66"> - <property name="text"> - <string>z:</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <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="1"> - <widget class="QSpinBox" name="tx_spin"> - <property name="minimum"> - <number>-999</number> - </property> - <property name="maximum"> - <number>999</number> - </property> - </widget> - </item> - </layout> - </item> - <item> - <spacer name="horizontalSpacer_18"> - <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="QPushButton" name="tcalib_button"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="text"> - <string>Calibrate</string> - </property> - <property name="checkable"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_19"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>10</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> + <item row="2" column="1"> + <widget class="QSpinBox" name="ty_spin"> + <property name="suffix"> + <string> units</string> + </property> + <property name="minimum"> + <number>-65535</number> + </property> + <property name="maximum"> + <number>65536</number> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label_62"> + <property name="text"> + <string>y:</string> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="label_66"> + <property name="text"> + <string>z:</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_61"> + <property name="text"> + <string>x:</string> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QSpinBox" name="tz_spin"> + <property name="suffix"> + <string> units</string> + </property> + <property name="minimum"> + <number>-65535</number> + </property> + <property name="maximum"> + <number>65536</number> + </property> + </widget> + </item> + <item row="4" column="2"> + <widget class="QPushButton" name="tcalib_button"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Calibrate</string> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + </widget> </item> </layout> </widget> @@ -1338,171 +1143,48 @@ <attribute name="title"> <string>About</string> </attribute> - <widget class="QLabel" name="label_10"> - <property name="geometry"> - <rect> - <x>30</x> - <y>30</y> - <width>161</width> - <height>111</height> - </rect> - </property> - <property name="text"> - <string><html><head/><body><p><span style=" font-weight:600;">FTNoIR PointTracker Plugin<br/>Version 1.1</span></p><p><span style=" font-weight:600;">by Patrick Ruoff</span></p><p><a href="http://ftnoirpt.sourceforge.net/"><span style=" font-weight:600; text-decoration: underline; color:#0000ff;">Manual (external)</span></a></p></body></html></string> - </property> - <property name="openExternalLinks"> - <bool>true</bool> - </property> - </widget> - <widget class="QLabel" name="label_35"> - <property name="geometry"> - <rect> - <x>200</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> + <layout class="QGridLayout" name="gridLayout_8"> + <item row="0" column="0"> + <widget class="QLabel" name="label_10"> + <property name="text"> + <string><html><head/><body><p><span style=" font-weight:600;">FTNoIR PointTracker Plugin<br/>Version 1.1</span></p><p><span style=" font-weight:600;">by Patrick Ruoff</span></p><p><a href="http://ftnoirpt.sourceforge.net/"><span style=" font-weight:600; text-decoration: underline; color:#0000ff;">Manual (external)</span></a></p></body></html></string> + </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> + </property> + <property name="openExternalLinks"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLabel" name="label_35"> + <property name="text"> + <string/> + </property> + <property name="pixmap"> + <pixmap resource="ftnoir_tracker_pt.qrc">:/Resources/Logo_IR.png</pixmap> + </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> + </property> + </widget> + </item> + </layout> </widget> </widget> </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"> - <property name="fieldGrowthPolicy"> - <enum>QFormLayout::AllNonFixedFieldsGrow</enum> - </property> - <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> - <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> - </layout> - </item> - </layout> - </widget> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_4"> - <item> - <widget class="QPushButton" name="btnApply"> - <property name="text"> - <string>Save</string> - </property> - </widget> - </item> - <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="locale"> - <locale language="English" country="UnitedStates"/> - </property> - <property name="text"> - <string>Ok</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="cancel_button"> - <property name="locale"> - <locale language="English" country="UnitedStates"/> - </property> - <property name="text"> - <string>Cancel</string> - </property> - </widget> - </item> - </layout> - </item> </layout> </widget> <tabstops> <tabstop>tabWidget</tabstop> - <tabstop>reset_spin</tabstop> <tabstop>camdevice_combo</tabstop> <tabstop>res_x_spin</tabstop> - <tabstop>res_y_spin</tabstop> - <tabstop>fps_spin</tabstop> - <tabstop>f_dspin</tabstop> <tabstop>camroll_combo</tabstop> <tabstop>campitch_spin</tabstop> <tabstop>camyaw_spin</tabstop> <tabstop>threshold_slider</tabstop> - <tabstop>mindiam_spin</tabstop> - <tabstop>maxdiam_spin</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> @@ -1512,31 +1194,11 @@ <tabstop>tx_spin</tabstop> <tabstop>ty_spin</tabstop> <tabstop>tz_spin</tabstop> - <tabstop>tcalib_button</tabstop> - <tabstop>ok_button</tabstop> - <tabstop>cancel_button</tabstop> </tabstops> <resources> <include location="ftnoir_tracker_pt.qrc"/> </resources> - <connections> - <connection> - <sender>dynpose_check</sender> - <signal>toggled(bool)</signal> - <receiver>reset_spin</receiver> - <slot>setEnabled(bool)</slot> - <hints> - <hint type="sourcelabel"> - <x>172</x> - <y>110</y> - </hint> - <hint type="destinationlabel"> - <x>351</x> - <y>112</y> - </hint> - </hints> - </connection> - </connections> + <connections/> <slots> <slot>startEngineClicked()</slot> <slot>stopEngineClicked()</slot> diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp index 3fa6910d..768a3a71 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp @@ -26,7 +26,6 @@ Tracker::Tracker() commands(0), video_widget(NULL), video_frame(NULL), - tracking_valid(false), new_settings(nullptr) { @@ -68,16 +67,13 @@ void Tracker::run() #endif time.start(); - double dt; bool new_frame; forever { if (commands & ABORT) break; - if (commands & PAUSE) continue; commands = 0; - apply_inner(); - dt = time.start() / 1000000000.; - + apply_inner(); + const double dt = time.start() * 1e-9; new_frame = camera.get_frame(dt, &frame); if (new_frame && !frame.empty()) @@ -101,7 +97,7 @@ void Tracker::run() color, 4); } - tracking_valid = point_tracker.track(points, camera.get_info().f, dt); + point_tracker.track(points, camera.get_info().f); video_widget->update_image(frame); } #ifdef PT_PERF_LOG @@ -124,12 +120,13 @@ void Tracker::apply_inner() settings* tmp = new_settings.exchange(nullptr); if (tmp == nullptr) return; + reset(); auto& s = *tmp; qDebug()<<"Tracker:: Applying settings"; camera.set_device_index(s.cam_index); camera.set_res(s.cam_res_x, s.cam_res_y); camera.set_fps(s.cam_fps); - camera.set_f(s.cam_f); + camera.set_f(1); frame_rotation.rotation = static_cast<RotationType>(static_cast<int>(s.cam_roll)); point_extractor.threshold_val = s.threshold; point_extractor.threshold_secondary_val = s.threshold_secondary; @@ -140,8 +137,6 @@ void Tracker::apply_inner() cv::Vec3f M02(s.m02_x, s.m02_y, s.m02_z); point_tracker.point_model = std::shared_ptr<PointModel>(new PointModel(M01, M02)); } - point_tracker.dynamic_pose_resolution = s.dyn_pose_res; - point_tracker.dt_reset = s.reset_time / 1000.0; t_MH = cv::Vec3f(s.t_MH_x, s.t_MH_y, s.t_MH_z); R_GC = Matx33f( cos(deg2rad*s.cam_yaw), 0, sin(deg2rad*s.cam_yaw), 0, 1, 0, @@ -152,7 +147,6 @@ void Tracker::apply_inner() FrameTrafo X_MH(Matx33f::eye(), t_MH); X_GH_0 = R_GC * X_MH; - qDebug()<<"Tracker::apply ends"; } @@ -201,7 +195,6 @@ void Tracker::StartTracker(QFrame *parent_window) camera.start(); apply(s); start(); - reset_command(PAUSE); } #ifndef OPENTRACK_API @@ -220,9 +213,7 @@ void Tracker::GetHeadPoseData(THeadPoseData *data) { QMutexLocker lock(&mutex); - if (!tracking_valid) return; - - FrameTrafo X_CM = point_tracker.get_pose(); + FrameTrafo X_CM = point_tracker.get_pose(); FrameTrafo X_MH(Matx33f::eye(), t_MH); FrameTrafo X_GH = R_GC * X_CM * X_MH; Matx33f R = X_GH.R * X_GH_0.R.t(); diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt.h b/ftnoir_tracker_pt/ftnoir_tracker_pt.h index 3d9a83fd..238dcd8f 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt.h +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt.h @@ -61,8 +61,7 @@ protected: QMutex mutex; // thread commands enum Command { - ABORT = 1<<0, - PAUSE = 1<<1 + ABORT = 1<<0 }; void set_command(Command command); void reset_command(Command command); @@ -82,7 +81,6 @@ protected: PTVideoWidget* video_widget; QFrame* video_frame; - bool tracking_valid; settings s; std::atomic<settings*> new_settings; diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp b/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp index e037a099..0e58a2e4 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp @@ -42,11 +42,7 @@ TrackerDialog::TrackerDialog() ui.camroll_combo->addItem("0"); ui.camroll_combo->addItem("90"); - tie_setting(s.dyn_pose_res, ui.dynpose_check); - tie_setting(s.reset_time, ui.reset_spin); - tie_setting(s.cam_index, ui.camdevice_combo); - tie_setting(s.cam_f, ui.f_dspin); tie_setting(s.cam_res_x, ui.res_x_spin); tie_setting(s.cam_res_y, ui.res_y_spin); tie_setting(s.cam_fps, ui.fps_spin); @@ -82,11 +78,9 @@ TrackerDialog::TrackerDialog() tie_setting(s.t_MH_z, ui.tz_spin); connect( ui.tcalib_button,SIGNAL(toggled(bool)), this,SLOT(startstop_trans_calib(bool)) ); - connect(ui.reset_button, SIGNAL(clicked()), this, SLOT(doReset())); - connect(ui.ok_button, SIGNAL(clicked()), this, SLOT(doOK())); - connect(ui.cancel_button, SIGNAL(clicked()), this, SLOT(doCancel())); - connect(ui.btnApply, SIGNAL(clicked()), this, SLOT(doApply())); + connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); + connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); ui.model_tabs->setCurrentIndex(s.active_model_panel); @@ -94,7 +88,7 @@ TrackerDialog::TrackerDialog() connect(&timer,SIGNAL(timeout()), this,SLOT(poll_tracker_info())); timer.start(100); - connect(s.b.get(), SIGNAL(bundleChanged()), this, SLOT(do_apply_without_saving())); + connect(ui.buttonBox_2, SIGNAL(clicked(QAbstractButton*)), this, SLOT(do_apply_without_saving(QAbstractButton*))); } void TrackerDialog::set_model_clip() @@ -172,19 +166,9 @@ void TrackerDialog::settings_changed() if (tracker) tracker->apply(s); } -void TrackerDialog::doCenter() -{ - if (tracker) tracker->center(); -} - -void TrackerDialog::doReset() -{ - if (tracker) tracker->reset(); -} - void TrackerDialog::save() { - do_apply_without_saving(); + do_apply_without_saving(nullptr); s.b->save(); } @@ -194,7 +178,7 @@ void TrackerDialog::doOK() close(); } -void TrackerDialog::do_apply_without_saving() +void TrackerDialog::do_apply_without_saving(QAbstractButton*) { switch (s.active_model_panel) { default: @@ -295,7 +279,6 @@ void TrackerDialog::registerTracker(ITracker *t) tracker->apply(s); ui.tcalib_button->setEnabled(true); //ui.center_button->setEnabled(true); - ui.reset_button->setEnabled(true); } void TrackerDialog::unRegisterTracker() @@ -305,7 +288,6 @@ void TrackerDialog::unRegisterTracker() destroy_video_widget(); ui.tcalib_button->setEnabled(false); //ui.center_button->setEnabled(false); - ui.reset_button->setEnabled(false); } extern "C" OPENTRACK_EXPORT ITrackerDialog* CALLING_CONVENTION GetDialog( ) diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.h b/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.h index a4d9c4b5..dbb93f30 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.h +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.h @@ -34,12 +34,10 @@ public: void trans_calib_step(); public slots: - void doCenter(); - void doReset(); void doOK(); - void doApply(); void doCancel(); - void do_apply_without_saving(); + void doApply(); + void do_apply_without_saving(QAbstractButton *); void startstop_trans_calib(bool start); void widget_destroyed(QObject* obj); diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h b/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h index e4cb9ad3..7faad9ed 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h @@ -28,18 +28,17 @@ struct settings threshold_secondary, min_point_size, max_point_size; - value<double> cam_f; value<int> m01_x, m01_y, m01_z; value<int> m02_x, m02_y, m02_z; - value<bool> dyn_pose_res, video_widget; + value<bool> video_widget; value<int> t_MH_x, t_MH_y, t_MH_z; - value<int> reset_time; - value<int> clip_ty, clip_tz, clip_by, clip_bz; value<int> active_model_panel, cap_x, cap_y, cap_z; + + // XXX todo red channel only, good for crapola CCD sensors -sh 20140922 settings() : b(bundle("tracker-pt")), @@ -54,19 +53,16 @@ struct settings threshold_secondary(b, "threshold-secondary", 128), min_point_size(b, "min-point-size", 10), max_point_size(b, "max-point-size", 50), - cam_f(b, "camera-focal-length", 1), m01_x(b, "m_01-x", 0), m01_y(b, "m_01-y", 0), m01_z(b, "m_01-z", 0), m02_x(b, "m_02-x", 0), m02_y(b, "m_02-y", 0), m02_z(b, "m_02-z", 0), - dyn_pose_res(b, "dynamic-pose-resolution", false), video_widget(b, "video-widget", true), t_MH_x(b, "model-centroid-x", 0), t_MH_y(b, "model-centroid-y", 0), t_MH_z(b, "model-centroid-z", 0), - reset_time(b, "reset-time", 2000), clip_ty(b, "clip-ty", 0), clip_tz(b, "clip-tz", 0), clip_by(b, "clip-by", 0), diff --git a/ftnoir_tracker_pt/point_tracker.cpp b/ftnoir_tracker_pt/point_tracker.cpp index e9892d67..5f57baf5 100644 --- a/ftnoir_tracker_pt/point_tracker.cpp +++ b/ftnoir_tracker_pt/point_tracker.cpp @@ -37,7 +37,7 @@ static void set_row(Matx33f& m, int i, const Vec3f& v) PointModel::PointModel(Vec3f M01, Vec3f M02) : M01(M01), M02(M02) -{ +{ // calculate u u = M01.cross(M02); u /= norm(u); @@ -48,7 +48,6 @@ PointModel::PointModel(Vec3f M01, Vec3f 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)); @@ -97,151 +96,58 @@ void PointModel::get_d_order(const std::vector<cv::Vec2f>& points, int d_order[] // ---------------------------------------------------------------------------- -PointTracker::PointTracker() : - dynamic_pose_resolution(true), - dt_reset(1), - init_phase(true), - dt_valid(0), - v_t(0,0,0), - v_r(0,0,0) +PointTracker::PointTracker() { 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); + // enter init phase + X_CM = FrameTrafo(); } - -bool PointTracker::track(const vector<Vec2f>& points, float f, float dt) +void PointTracker::track(const vector<Vec2f>& points, float f) { - if (!dynamic_pose_resolution) init_phase = true; - - dt_valid += dt; - // if there was no valid tracking result for too long, do a reset - if (dt_valid > dt_reset) - { - //qDebug()<<"dt_valid "<<dt_valid<<" > dt_reset "<<dt_reset; - reset(); - } - - bool no_model = -#ifdef OPENTRACK_API - point_model.get() == NULL; -#else - !point_model; -#endif - - // if there is a pointtracking problem, reset the velocities - if (no_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; - } - + find_correspondences(points, f); (void) 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; -} - -void PointTracker::predict(float dt) -{ - // predict with constant velocity - Matx33f R; - Rodrigues(dt*v_r, R); - X_CM.R = R*X_CM.R; - X_CM.t += dt * v_t; -} - -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; } -bool PointTracker::find_correspondences(const vector<Vec2f>& points, float f) +void PointTracker::find_correspondences(const std::vector<cv::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; + // ... otherwise we look at the distance to the projection of the expected model points + // project model points under current pose + Vec2f p_exp[3]; + 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; + + for (int i=0; i<PointModel::N_POINTS; ++i) + { + float min_sdist = 1e4; + int min_idx = 0; + // 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) + { + min_idx = j; + min_sdist = sdist; + } + } + // if one point is closest to more than one model point, abort + if (point_taken[min_idx]) return; + point_taken[min_idx] = true; + p[i] = points[min_idx]; + } } @@ -255,15 +161,12 @@ int PointTracker::POSIT(float f) // 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 + 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(R_expected, 2, k); - float Z0 = init_phase ? 1000 : X_CM.t[2]; + float Z0 = std::abs(X_CM.t[2]) < 1e-3 ? 1e3 : X_CM.t[2]; float old_epsilon_1 = 0; float old_epsilon_2 = 0; diff --git a/ftnoir_tracker_pt/point_tracker.h b/ftnoir_tracker_pt/point_tracker.h index 512681fc..44bad28e 100644 --- a/ftnoir_tracker_pt/point_tracker.h +++ b/ftnoir_tracker_pt/point_tracker.h @@ -57,14 +57,14 @@ class PointModel { friend class PointTracker; public: - static const int N_POINTS = 3; + static constexpr 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; }; + const cv::Vec3f& get_M01() const { return M01; } + const cv::Vec3f& get_M02() const { return M02; } -protected: +private: cv::Vec3f M01; // M01 in model frame cv::Vec3f M02; // M02 in model frame @@ -90,12 +90,9 @@ public: // track the pose using the set of normalized point coordinates (x pos in range -0.5:0.5) // f : (focal length)/(sensor width) // dt : time since last call - bool track(const std::vector<cv::Vec2f>& points, float f, float dt); + void track(const std::vector<cv::Vec2f>& points, float f); std::shared_ptr<PointModel> point_model; - bool dynamic_pose_resolution; - float dt_reset; - FrameTrafo get_pose() const { return X_CM; } void reset(); @@ -106,24 +103,13 @@ protected: 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); + void 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(); - 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 |