diff options
Diffstat (limited to 'tracker-pt')
| -rw-r--r-- | tracker-pt/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | tracker-pt/FTNoIR_PT_Controls.ui | 1220 | ||||
| -rw-r--r-- | tracker-pt/ftnoir_tracker_pt.cpp | 68 | ||||
| -rw-r--r-- | tracker-pt/ftnoir_tracker_pt.qrc | 9 | ||||
| -rw-r--r-- | tracker-pt/ftnoir_tracker_pt_dialog.cpp | 182 | ||||
| -rw-r--r-- | tracker-pt/ftnoir_tracker_pt_dialog.h | 51 | ||||
| -rw-r--r-- | tracker-pt/ftnoir_tracker_pt_settings.h | 40 | ||||
| -rw-r--r-- | tracker-pt/point_tracker.h | 32 | ||||
| -rw-r--r-- | tracker-pt/trans_calib.cpp | 41 | ||||
| -rw-r--r-- | tracker-pt/trans_calib.h | 39 | 
10 files changed, 84 insertions, 1600 deletions
diff --git a/tracker-pt/CMakeLists.txt b/tracker-pt/CMakeLists.txt index 94b04437..49943917 100644 --- a/tracker-pt/CMakeLists.txt +++ b/tracker-pt/CMakeLists.txt @@ -1,5 +1,5 @@  find_package(OpenCV 3.0) -opentrack_boilerplate(opentrack-tracker-pt) +opentrack_boilerplate(opentrack-tracker-pt STATIC)  target_link_libraries(opentrack-tracker-pt ${OpenCV_LIBS})  target_include_directories(opentrack-tracker-pt SYSTEM PUBLIC ${OpenCV_INCLUDE_DIRS})  link_with_dinput8(opentrack-tracker-pt) diff --git a/tracker-pt/FTNoIR_PT_Controls.ui b/tracker-pt/FTNoIR_PT_Controls.ui deleted file mode 100644 index 88575644..00000000 --- a/tracker-pt/FTNoIR_PT_Controls.ui +++ /dev/null @@ -1,1220 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>UICPTClientControls</class> - <widget class="QWidget" name="UICPTClientControls"> -  <property name="windowModality"> -   <enum>Qt::NonModal</enum> -  </property> -  <property name="geometry"> -   <rect> -    <x>0</x> -    <y>0</y> -    <width>424</width> -    <height>579</height> -   </rect> -  </property> -  <property name="sizePolicy"> -   <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> -    <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/Logo_IR.png</normaloff>:/Resources/Logo_IR.png</iconset> -  </property> -  <property name="layoutDirection"> -   <enum>Qt::LeftToRight</enum> -  </property> -  <property name="autoFillBackground"> -   <bool>false</bool> -  </property> -  <layout class="QGridLayout" name="gridLayout_9"> -   <property name="sizeConstraint"> -    <enum>QLayout::SetFixedSize</enum> -   </property> -   <item row="0" column="0"> -    <widget class="QTabWidget" name="tabWidget"> -     <property name="sizePolicy"> -      <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding"> -       <horstretch>0</horstretch> -       <verstretch>0</verstretch> -      </sizepolicy> -     </property> -     <property name="minimumSize"> -      <size> -       <width>0</width> -       <height>0</height> -      </size> -     </property> -     <property name="locale"> -      <locale language="English" country="UnitedStates"/> -     </property> -     <property name="currentIndex"> -      <number>0</number> -     </property> -     <widget class="QWidget" name="tab_2"> -      <attribute name="title"> -       <string>Camera</string> -      </attribute> -      <layout class="QVBoxLayout" name="verticalLayout"> -       <item> -        <widget class="QGroupBox" name="groupBox"> -         <property name="title"> -          <string>Camera settings</string> -         </property> -         <layout class="QGridLayout" name="gridLayout_2"> -          <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="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>Desired capture height</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="4" column="0"> -           <widget class="QLabel" name="label_4"> -            <property name="sizePolicy"> -             <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> -              <horstretch>0</horstretch> -              <verstretch>0</verstretch> -             </sizepolicy> -            </property> -            <property name="text"> -             <string>Diagonal field of view</string> -            </property> -           </widget> -          </item> -          <item row="1" column="0"> -           <widget class="QLabel" name="label_36"> -            <property name="sizePolicy"> -             <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> -              <horstretch>0</horstretch> -              <verstretch>0</verstretch> -             </sizepolicy> -            </property> -            <property name="text"> -             <string>Width</string> -            </property> -           </widget> -          </item> -          <item row="4" column="1"> -           <widget class="QSpinBox" name="fov"> -            <property name="suffix"> -             <string>°</string> -            </property> -            <property name="prefix"> -             <string/> -            </property> -            <property name="minimum"> -             <number>10</number> -            </property> -            <property name="maximum"> -             <number>90</number> -            </property> -           </widget> -          </item> -          <item row="5" column="1"> -           <widget class="QCheckBox" name="dynamic_pose"> -            <property name="text"> -             <string/> -            </property> -           </widget> -          </item> -          <item row="5" column="0"> -           <widget class="QLabel" name="label_5"> -            <property name="sizePolicy"> -             <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> -              <horstretch>0</horstretch> -              <verstretch>0</verstretch> -             </sizepolicy> -            </property> -            <property name="text"> -             <string>Dynamic pose resolution</string> -            </property> -           </widget> -          </item> -          <item row="6" column="0"> -           <widget class="QLabel" name="label_6"> -            <property name="text"> -             <string>Dynamic pose timeout</string> -            </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> -          <item row="6" column="1"> -           <widget class="QSpinBox" name="init_phase_timeout"> -            <property name="suffix"> -             <string> ms</string> -            </property> -            <property name="minimum"> -             <number>1</number> -            </property> -            <property name="maximum"> -             <number>10000</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="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="0" column="1"> -           <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="0" column="0"> -           <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>Device</string> -            </property> -            <property name="buddy"> -             <cstring>camdevice_combo</cstring> -            </property> -           </widget> -          </item> -          <item row="7" column="0"> -           <widget class="QLabel" name="label_9"> -            <property name="text"> -             <string>Camera settings dialog</string> -            </property> -           </widget> -          </item> -          <item row="7" column="1"> -           <widget class="QPushButton" name="camera_settings"> -            <property name="sizePolicy"> -             <sizepolicy hsizetype="Minimum" vsizetype="Maximum"> -              <horstretch>0</horstretch> -              <verstretch>0</verstretch> -             </sizepolicy> -            </property> -            <property name="text"> -             <string>Open</string> -            </property> -           </widget> -          </item> -         </layout> -        </widget> -       </item> -       <item> -        <widget class="QGroupBox" name="groupBox_2"> -         <property name="title"> -          <string>Point extraction</string> -         </property> -         <layout class="QGridLayout" name="gridLayout_7"> -          <item row="3" column="0"> -           <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="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="2" column="0"> -           <widget class="QLabel" name="label_7"> -            <property name="text"> -             <string>Min size</string> -            </property> -            <property name="buddy"> -             <cstring>mindiam_spin</cstring> -            </property> -           </widget> -          </item> -          <item row="1" 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="0" column="0"> -           <widget class="QLabel" name="label_11"> -            <property name="text"> -             <string>Automatic threshold</string> -            </property> -           </widget> -          </item> -          <item row="0" column="1"> -           <widget class="QCheckBox" name="auto_threshold"> -            <property name="text"> -             <string>Enable, slider sets point size</string> -            </property> -           </widget> -          </item> -          <item row="3" column="1"> -           <widget class="QDoubleSpinBox" name="maxdiam_spin"> -            <property name="toolTip"> -             <string>Maximum point diameter</string> -            </property> -            <property name="suffix"> -             <string> px</string> -            </property> -            <property name="decimals"> -             <number>1</number> -            </property> -            <property name="singleStep"> -             <double>0.100000000000000</double> -            </property> -           </widget> -          </item> -          <item row="2" column="1"> -           <widget class="QDoubleSpinBox" name="mindiam_spin"> -            <property name="toolTip"> -             <string>Minimum point diameter</string> -            </property> -            <property name="suffix"> -             <string> px</string> -            </property> -            <property name="decimals"> -             <number>1</number> -            </property> -            <property name="singleStep"> -             <double>0.100000000000000</double> -            </property> -           </widget> -          </item> -         </layout> -        </widget> -       </item> -      </layout> -     </widget> -     <widget class="QWidget" name="tab_4"> -      <attribute name="title"> -       <string>Model</string> -      </attribute> -      <layout class="QGridLayout" name="gridLayout_3"> -       <item row="0" column="0"> -        <widget class="QTabWidget" name="model_tabs"> -         <property name="sizePolicy"> -          <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> -           <horstretch>0</horstretch> -           <verstretch>0</verstretch> -          </sizepolicy> -         </property> -         <property name="tabShape"> -          <enum>QTabWidget::Rounded</enum> -         </property> -         <property name="currentIndex"> -          <number>0</number> -         </property> -         <property name="usesScrollButtons"> -          <bool>false</bool> -         </property> -         <property name="documentMode"> -          <bool>false</bool> -         </property> -         <property name="tabsClosable"> -          <bool>false</bool> -         </property> -         <widget class="QWidget" name="tab_5"> -          <attribute name="title"> -           <string>Clip</string> -          </attribute> -          <layout class="QGridLayout" name="gridLayout_6"> -           <item row="0" column="0"> -            <widget class="QGroupBox" name="groupBox_8"> -             <property name="sizePolicy"> -              <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> -               <horstretch>0</horstretch> -               <verstretch>0</verstretch> -              </sizepolicy> -             </property> -             <property name="minimumSize"> -              <size> -               <width>331</width> -               <height>208</height> -              </size> -             </property> -             <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> mm</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>150</x> -                <y>130</y> -                <width>100</width> -                <height>22</height> -               </rect> -              </property> -              <property name="suffix"> -               <string> mm</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>65</x> -                <y>55</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="QLabel" name="label_50"> -              <property name="geometry"> -               <rect> -                <x>20</x> -                <y>40</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>50</x> -                <y>160</y> -                <width>100</width> -                <height>22</height> -               </rect> -              </property> -              <property name="suffix"> -               <string> mm</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>150</x> -                <y>70</y> -                <width>100</width> -                <height>22</height> -               </rect> -              </property> -              <property name="suffix"> -               <string> mm</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>290</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>300</x> -                <y>70</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="minimumSize"> -              <size> -               <width>331</width> -               <height>208</height> -              </size> -             </property> -             <property name="title"> -              <string>Model Dimensions</string> -             </property> -             <widget class="QLabel" name="label_46"> -              <property name="geometry"> -               <rect> -                <x>100</x> -                <y>60</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>40</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>90</x> -                <y>40</y> -                <width>101</width> -                <height>22</height> -               </rect> -              </property> -              <property name="suffix"> -               <string> mm</string> -              </property> -              <property name="minimum"> -               <number>-65535</number> -              </property> -              <property name="maximum"> -               <number>65535</number> -              </property> -             </widget> -             <widget class="QLabel" name="label_47"> -              <property name="geometry"> -               <rect> -                <x>220</x> -                <y>100</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>240</x> -                <y>70</y> -                <width>81</width> -                <height>22</height> -               </rect> -              </property> -              <property name="suffix"> -               <string> mm</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>240</x> -                <y>40</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>20</x> -                <y>90</y> -                <width>81</width> -                <height>22</height> -               </rect> -              </property> -              <property name="suffix"> -               <string> mm</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>z:</string> -                </property> -               </widget> -              </item> -              <item row="2" column="5"> -               <widget class="QSpinBox" name="m2y_spin"> -                <property name="suffix"> -                 <string> mm</string> -                </property> -                <property name="minimum"> -                 <number>-65535</number> -                </property> -                <property name="maximum"> -                 <number>65535</number> -                </property> -               </widget> -              </item> -              <item row="1" column="1"> -               <widget class="QLabel" name="label_63"> -                <property name="sizePolicy"> -                 <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> -                  <horstretch>0</horstretch> -                  <verstretch>0</verstretch> -                 </sizepolicy> -                </property> -                <property name="text"> -                 <string>x:</string> -                </property> -               </widget> -              </item> -              <item row="1" column="2"> -               <widget class="QSpinBox" name="m1x_spin"> -                <property name="suffix"> -                 <string> mm</string> -                </property> -                <property name="minimum"> -                 <number>-65535</number> -                </property> -                <property name="maximum"> -                 <number>65535</number> -                </property> -               </widget> -              </item> -              <item row="2" column="2"> -               <widget class="QSpinBox" name="m1y_spin"> -                <property name="suffix"> -                 <string> mm</string> -                </property> -                <property name="minimum"> -                 <number>-65535</number> -                </property> -                <property name="maximum"> -                 <number>65535</number> -                </property> -               </widget> -              </item> -              <item row="3" column="5"> -               <widget class="QSpinBox" name="m2z_spin"> -                <property name="suffix"> -                 <string> mm</string> -                </property> -                <property name="minimum"> -                 <number>-65535</number> -                </property> -                <property name="maximum"> -                 <number>65535</number> -                </property> -               </widget> -              </item> -              <item row="1" column="5"> -               <widget class="QSpinBox" name="m2x_spin"> -                <property name="suffix"> -                 <string> mm</string> -                </property> -                <property name="minimum"> -                 <number>-65535</number> -                </property> -                <property name="maximum"> -                 <number>65535</number> -                </property> -               </widget> -              </item> -              <item row="0" column="0" colspan="6"> -               <widget class="QLabel" name="label_56"> -                <property name="sizePolicy"> -                 <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> -                  <horstretch>0</horstretch> -                  <verstretch>0</verstretch> -                 </sizepolicy> -                </property> -                <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><p>Use any units you want, not necessarily centimeters.</p></body></html></string> -                </property> -               </widget> -              </item> -              <item row="3" column="2"> -               <widget class="QSpinBox" name="m1z_spin"> -                <property name="suffix"> -                 <string> mm</string> -                </property> -                <property name="minimum"> -                 <number>-65535</number> -                </property> -                <property name="maximum"> -                 <number>65535</number> -                </property> -               </widget> -              </item> -              <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> -                <property name="text"> -                 <string>y:</string> -                </property> -               </widget> -              </item> -              <item row="1" column="4"> -               <widget class="QLabel" name="label_67"> -                <property name="sizePolicy"> -                 <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> -                  <horstretch>0</horstretch> -                  <verstretch>0</verstretch> -                 </sizepolicy> -                </property> -                <property name="text"> -                 <string>x:</string> -                </property> -               </widget> -              </item> -              <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> -                <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> -              </item> -              <item row="1" column="0"> -               <widget class="QLabel" name="label_60"> -                <property name="sizePolicy"> -                 <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> -                  <horstretch>0</horstretch> -                  <verstretch>0</verstretch> -                 </sizepolicy> -                </property> -                <property name="text"> -                 <string><html><head/><body><p><span style=" font-size:16pt;">P</span><span style=" font-size:16pt; vertical-align:sub;">2</span></p></body></html></string> -                </property> -               </widget> -              </item> -              <item row="3" column="4"> -               <widget class="QLabel" name="label_69"> -                <property name="sizePolicy"> -                 <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> -                  <horstretch>0</horstretch> -                  <verstretch>0</verstretch> -                 </sizepolicy> -                </property> -                <property name="text"> -                 <string>z:</string> -                </property> -               </widget> -              </item> -              <item row="2" column="1"> -               <widget class="QLabel" name="label_58"> -                <property name="sizePolicy"> -                 <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> -                  <horstretch>0</horstretch> -                  <verstretch>0</verstretch> -                 </sizepolicy> -                </property> -                <property name="text"> -                 <string>y:</string> -                </property> -               </widget> -              </item> -             </layout> -            </widget> -           </item> -          </layout> -         </widget> -        </widget> -       </item> -       <item row="1" column="0"> -        <widget class="QGroupBox" name="groupBox_10"> -         <property name="sizePolicy"> -          <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> -           <horstretch>0</horstretch> -           <verstretch>0</verstretch> -          </sizepolicy> -         </property> -         <property name="title"> -          <string>Model position</string> -         </property> -         <layout class="QGridLayout" name="gridLayout_4"> -          <item row="0" column="0"> -           <widget class="QFrame" name="frame_2"> -            <property name="frameShape"> -             <enum>QFrame::NoFrame</enum> -            </property> -            <property name="frameShadow"> -             <enum>QFrame::Raised</enum> -            </property> -            <layout class="QGridLayout" name="gridLayout_11"> -             <item row="0" column="0"> -              <widget class="QLabel" name="label_61"> -               <property name="sizePolicy"> -                <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> -                 <horstretch>0</horstretch> -                 <verstretch>0</verstretch> -                </sizepolicy> -               </property> -               <property name="text"> -                <string>x:</string> -               </property> -              </widget> -             </item> -             <item row="0" column="1"> -              <widget class="QSpinBox" name="tx_spin"> -               <property name="suffix"> -                <string> mm</string> -               </property> -               <property name="minimum"> -                <number>-65535</number> -               </property> -               <property name="maximum"> -                <number>65536</number> -               </property> -              </widget> -             </item> -             <item row="1" column="0"> -              <widget class="QLabel" name="label_62"> -               <property name="sizePolicy"> -                <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> -                 <horstretch>0</horstretch> -                 <verstretch>0</verstretch> -                </sizepolicy> -               </property> -               <property name="text"> -                <string>y:</string> -               </property> -              </widget> -             </item> -             <item row="1" column="1"> -              <widget class="QSpinBox" name="ty_spin"> -               <property name="suffix"> -                <string> mm</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_66"> -               <property name="sizePolicy"> -                <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> -                 <horstretch>0</horstretch> -                 <verstretch>0</verstretch> -                </sizepolicy> -               </property> -               <property name="text"> -                <string>z:</string> -               </property> -              </widget> -             </item> -             <item row="2" column="1"> -              <widget class="QSpinBox" name="tz_spin"> -               <property name="suffix"> -                <string> mm</string> -               </property> -               <property name="minimum"> -                <number>-65535</number> -               </property> -               <property name="maximum"> -                <number>65536</number> -               </property> -              </widget> -             </item> -            </layout> -           </widget> -          </item> -          <item row="0" column="1"> -           <widget class="QFrame" name="frame"> -            <property name="frameShape"> -             <enum>QFrame::NoFrame</enum> -            </property> -            <property name="frameShadow"> -             <enum>QFrame::Raised</enum> -            </property> -            <layout class="QVBoxLayout" name="verticalLayout_2"> -             <item> -              <widget class="QLabel" name="label_59"> -               <property name="text"> -                <string><html><head/><body><p><a href="https://github.com/opentrack/opentrack/wiki/model-calibration-for-PT-and-Aruco-trackers"><span style=" text-decoration: underline; color:#0000ff;">Instructions on the opentrack wiki</span></a></p></body></html></string> -               </property> -               <property name="openExternalLinks"> -                <bool>true</bool> -               </property> -              </widget> -             </item> -             <item> -              <widget class="QPushButton" name="tcalib_button"> -               <property name="enabled"> -                <bool>false</bool> -               </property> -               <property name="text"> -                <string>Toggle calibration</string> -               </property> -               <property name="checkable"> -                <bool>true</bool> -               </property> -              </widget> -             </item> -            </layout> -           </widget> -          </item> -         </layout> -        </widget> -       </item> -      </layout> -     </widget> -     <widget class="QWidget" name="tab_3"> -      <attribute name="title"> -       <string>About</string> -      </attribute> -      <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 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="1" column="0"> -       <widget class="QLabel" name="label_3"> -        <property name="text"> -         <string>Extracted Points:</string> -        </property> -       </widget> -      </item> -      <item row="2" column="1"> -       <widget class="QDialogButtonBox" name="buttonBox"> -        <property name="standardButtons"> -         <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> -        </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="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="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> -    </widget> -   </item> -  </layout> - </widget> - <tabstops> -  <tabstop>tabWidget</tabstop> -  <tabstop>camdevice_combo</tabstop> -  <tabstop>res_x_spin</tabstop> -  <tabstop>res_y_spin</tabstop> -  <tabstop>fps_spin</tabstop> -  <tabstop>fov</tabstop> -  <tabstop>threshold_slider</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_width_spin</tabstop> -  <tabstop>cap_height_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/tracker-pt/ftnoir_tracker_pt.cpp b/tracker-pt/ftnoir_tracker_pt.cpp index 15a60962..956f639e 100644 --- a/tracker-pt/ftnoir_tracker_pt.cpp +++ b/tracker-pt/ftnoir_tracker_pt.cpp @@ -51,15 +51,27 @@ void Tracker_PT::reset_command(Command command)  bool Tracker_PT::get_focal_length(float& ret)  { +    static constexpr float pi = 3.1415926; +    float fov_; +    switch (s.fov) +    { +    default: +    case 0: +        fov_ = 56; +        break; +    case 1: +        fov_ = 75; +        break; +    } + +    const double diag_fov = static_cast<int>(fov_) * pi / 180.f;      QMutexLocker l(&camera_mtx);      CamInfo info;      const bool res = camera.get_info(info);      if (res)      { -        static constexpr double pi = 3.14159265359;          const int w = info.res_x, h = info.res_y;          const double diag = sqrt(1. + h/(double)w * h/(double)w); -        const double diag_fov = static_cast<int>(s.fov) * pi / 180.;          const double fov = 2.*atan(tan(diag_fov/2.0)/diag);          ret = .5 / tan(.5 * fov);          return true; @@ -116,6 +128,20 @@ void Tracker_PT::run()              {                  Affine X_MH(cv::Matx33f::eye(), cv::Vec3f(s.t_MH_x, s.t_MH_y, s.t_MH_z)); // just copy pasted these lines from below +                if (X_MH.t[0] == 0 && X_MH.t[1] == 0 && X_MH.t[2] == 0) +                { +                    int m = s.model_used; +                    switch (m) +                    { +                    default: +                    // cap +                    case 0: X_MH.t[0] = 0; X_MH.t[1] = 0; X_MH.t[2] = 0; break; +                    // clip +                    case 1: X_MH.t[0] = 135; X_MH.t[1] = 0; X_MH.t[2] = 0; break; +                    // left clip +                    case 2: X_MH.t[0] = -135; X_MH.t[1] = 0; X_MH.t[2] = 0; break; +                    } +                }                  Affine X_GH = X_CM * X_MH;                  cv::Vec3f p = X_GH.t; // head (center?) position in global space                  cv::Vec2f p_(p[0] / p[2] * fx, p[1] / p[2] * fx);  // projected to screen @@ -156,10 +182,36 @@ void Tracker_PT::apply_settings()  {      qDebug()<<"Tracker:: Applying settings";      QMutexLocker l(&camera_mtx); -    camera.stop(); -    camera.set_device_index(camera_name_to_index(s.camera_name)); -    camera.set_res(s.cam_res_x, s.cam_res_y); -    camera.set_fps(s.cam_fps); +    camera.set_device_index(camera_name_to_index("PS3Eye Camera")); +    int res_x, res_y, cam_fps; +    switch (s.camera_mode) +    { +    default: +    case 0: +        res_x = 640; +        res_y = 480; +        cam_fps = 75; +        break; +    case 1: +        res_x = 640; +        res_y = 480; +        cam_fps = 60; +        break; +    case 2: +        res_x = 320; +        res_y = 240; +        cam_fps = 189; +        break; +    case 3: +        res_x = 320; +        res_y = 240; +        cam_fps = 120; +        break; +    } + +    camera.set_res(res_x, res_y); +    camera.set_fps(cam_fps); +    qDebug() << "camera start";      camera.start();      qDebug()<<"Tracker::apply ends";  } @@ -213,7 +265,3 @@ void Tracker_PT::data(double *data)          data[TZ] = t[2] / 10.0;      }  } - -#include "ftnoir_tracker_pt_dialog.h" -OPENTRACK_DECLARE_TRACKER(Tracker_PT, TrackerDialog_PT, TrackerDll) - diff --git a/tracker-pt/ftnoir_tracker_pt.qrc b/tracker-pt/ftnoir_tracker_pt.qrc deleted file mode 100644 index a8f9a1af..00000000 --- a/tracker-pt/ftnoir_tracker_pt.qrc +++ /dev/null @@ -1,9 +0,0 @@ -<RCC> -    <qresource prefix="/"> -        <file>Resources/cap_front.png</file> -        <file>Resources/cap_side.png</file> -        <file>Resources/clip_front.png</file> -        <file>Resources/clip_side.png</file> -        <file>Resources/Logo_IR.png</file> -    </qresource> -</RCC> diff --git a/tracker-pt/ftnoir_tracker_pt_dialog.cpp b/tracker-pt/ftnoir_tracker_pt_dialog.cpp deleted file mode 100644 index b1ae2238..00000000 --- a/tracker-pt/ftnoir_tracker_pt_dialog.cpp +++ /dev/null @@ -1,182 +0,0 @@ -/* Copyright (c) 2012 Patrick Ruoff - * Copyright (c) 2014-2015 Stanislaw Halik <sthalik@misaki.pl> - * - * 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> -#include <opencv2/core/core.hpp> -#include <memory> -#include "opentrack/camera-names.hpp" -#include <vector> - -//----------------------------------------------------------------------------- -TrackerDialog_PT::TrackerDialog_PT() -    : tracker(NULL), -      timer(this), -      trans_calib_running(false) -{ -    ui.setupUi( this ); - -    ui.camdevice_combo->addItems(get_camera_names()); - -    tie_setting(s.camera_name, ui.camdevice_combo); -    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); - -    tie_setting(s.threshold, ui.threshold_slider); - -    tie_setting(s.min_point_size, ui.mindiam_spin); -    tie_setting(s.max_point_size, ui.maxdiam_spin); - -    tie_setting(s.clip_by, ui.clip_bheight_spin); -    tie_setting(s.clip_bz, ui.clip_blength_spin); -    tie_setting(s.clip_ty, ui.clip_theight_spin); -    tie_setting(s.clip_tz, ui.clip_tlength_spin); - -    tie_setting(s.cap_x, ui.cap_width_spin); -    tie_setting(s.cap_y, ui.cap_height_spin); -    tie_setting(s.cap_z, ui.cap_length_spin); - -    tie_setting(s.m01_x, ui.m1x_spin); -    tie_setting(s.m01_y, ui.m1y_spin); -    tie_setting(s.m01_z, ui.m1z_spin); - -    tie_setting(s.m02_x, ui.m2x_spin); -    tie_setting(s.m02_y, ui.m2y_spin); -    tie_setting(s.m02_z, ui.m2z_spin); - -    tie_setting(s.t_MH_x, ui.tx_spin); -    tie_setting(s.t_MH_y, ui.ty_spin); -    tie_setting(s.t_MH_z, ui.tz_spin); -     -    tie_setting(s.fov, ui.fov); -     -    tie_setting(s.active_model_panel, ui.model_tabs); -     -    tie_setting(s.dynamic_pose, ui.dynamic_pose); -	tie_setting(s.init_phase_timeout, ui.init_phase_timeout); - -    tie_setting(s.auto_threshold, ui.auto_threshold); - -    connect( ui.tcalib_button,SIGNAL(toggled(bool)), this,SLOT(startstop_trans_calib(bool)) ); - -    connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); -    connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); - -    connect(&timer,SIGNAL(timeout()), this,SLOT(poll_tracker_info())); -    connect(ui.camera_settings, SIGNAL(pressed()), this, SLOT(camera_settings())); -    timer.start(100); -} - -void TrackerDialog_PT::camera_settings() -{ -    if (tracker) -        open_camera_settings(static_cast<cv::VideoCapture*>(tracker->camera), s.camera_name, &tracker->camera_mtx); -    else -        open_camera_settings(nullptr, s.camera_name, nullptr); -} - -void TrackerDialog_PT::startstop_trans_calib(bool start) -{ -    if (start) -    { -        qDebug()<<"TrackerDialog:: Starting translation calibration"; -        trans_calib.reset(); -        trans_calib_running = true; -        s.t_MH_x = 0; -        s.t_MH_y = 0; -        s.t_MH_z = 0; -    } -    else -    { -        qDebug()<<"TrackerDialog:: Stopping translation calibration"; -        trans_calib_running = false; -        { -            auto tmp = trans_calib.get_estimate(); -            s.t_MH_x = tmp[0]; -            s.t_MH_y = tmp[1]; -            s.t_MH_z = tmp[2]; -        } -    } -} - -void TrackerDialog_PT::poll_tracker_info() -{ -    CamInfo info; -    if (tracker && tracker->get_cam_info(&info)) -    { -        QString to_print; -        { -            // display caminfo -            to_print = QString::number(info.res_x)+"x"+QString::number(info.res_y)+" @ "+QString::number(info.fps)+" FPS"; -        } -        ui.caminfo_label->setText(to_print); - -        // display pointinfo -        int n_points = tracker->get_n_points(); -        to_print = QString::number(n_points); -        if (n_points == 3) -            to_print += " OK!"; -        else -            to_print += " BAD!"; -        ui.pointinfo_label->setText(to_print); - -        // update calibration -        if (trans_calib_running) trans_calib_step(); -    } -    else -    { -        ui.caminfo_label->setText("Tracker offline"); -        ui.pointinfo_label->setText(""); -    } -} - -void TrackerDialog_PT::trans_calib_step() -{ -    if (tracker) -    { -        Affine X_CM = tracker->pose(); -        trans_calib.update(X_CM.R, X_CM.t); -    } -} - -void TrackerDialog_PT::save() -{ -    s.b->save(); -} - -void TrackerDialog_PT::doOK() -{ -    save(); -    close(); -} - -void TrackerDialog_PT::doCancel() -{ -    s.b->reload(); -    close(); -} - -void TrackerDialog_PT::register_tracker(ITracker *t) -{ -    qDebug()<<"TrackerDialog:: Tracker registered"; -    tracker = static_cast<Tracker_PT*>(t); -    ui.tcalib_button->setEnabled(true); -    //ui.center_button->setEnabled(true); -} - -void TrackerDialog_PT::unregister_tracker() -{ -    qDebug()<<"TrackerDialog:: Tracker un-registered"; -    tracker = NULL; -    ui.tcalib_button->setEnabled(false); -    //ui.center_button->setEnabled(false); -} - diff --git a/tracker-pt/ftnoir_tracker_pt_dialog.h b/tracker-pt/ftnoir_tracker_pt_dialog.h deleted file mode 100644 index 3502e227..00000000 --- a/tracker-pt/ftnoir_tracker_pt_dialog.h +++ /dev/null @@ -1,51 +0,0 @@ -/* 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 "opentrack/plugin-api.hpp" -#include "ftnoir_tracker_pt_settings.h" -#include "ftnoir_tracker_pt.h" -#include "trans_calib.h" -#include "pt_video_widget.h" -#include "ui_FTNoIR_PT_Controls.h" -#include "opentrack/opencv-camera-dialog.hpp" - -#include <QTimer> - -//----------------------------------------------------------------------------- -// The dialog that shows up when the user presses "Settings" -class TrackerDialog_PT : public ITrackerDialog, protected camera_dialog<Tracker_PT> -{ -    Q_OBJECT -public: -    TrackerDialog_PT(); -    void register_tracker(ITracker *tracker) override; -    void unregister_tracker() override; -    void save(); -    void trans_calib_step(); - -public slots: -    void doOK(); -    void doCancel(); - -    void startstop_trans_calib(bool start); -    void poll_tracker_info(); -    void camera_settings(); -private: -    settings_pt s; -    Tracker_PT* tracker; -    QTimer timer; - -    TranslationCalibrator trans_calib; -    bool trans_calib_running; - -    Ui::UICPTClientControls ui; -}; - -#endif //FTNOIR_TRACKER_PT_DIALOG_H diff --git a/tracker-pt/ftnoir_tracker_pt_settings.h b/tracker-pt/ftnoir_tracker_pt_settings.h index 85eec8f9..78626468 100644 --- a/tracker-pt/ftnoir_tracker_pt_settings.h +++ b/tracker-pt/ftnoir_tracker_pt_settings.h @@ -14,54 +14,28 @@ using namespace options;  struct settings_pt : opts  { -    value<QString> camera_name; -    value<int> cam_res_x, -               cam_res_y, -               cam_fps, -               threshold; +    value<int> threshold;      value<double> min_point_size, max_point_size; -    value<int> m01_x, m01_y, m01_z; -    value<int> m02_x, m02_y, m02_z; -      value<int> t_MH_x, t_MH_y, t_MH_z; +    value<int> fov, camera_mode; +    value<int> model_used; -    value<int> clip_ty, clip_tz, clip_by, clip_bz; -    value<int> active_model_panel, cap_x, cap_y, cap_z; -     -    value<int> fov; -          value<bool> dynamic_pose;      value<int> init_phase_timeout;      value<bool> auto_threshold;      settings_pt() :          opts("tracker-pt"), -        camera_name(b, "camera-name", ""), -        cam_res_x(b, "camera-res-width", 640), -        cam_res_y(b, "camera-res-height", 480), -        cam_fps(b, "camera-fps", 30),          threshold(b, "threshold-primary", 128), -        min_point_size(b, "min-point-size", 1), +        min_point_size(b, "min-point-size", 0),          max_point_size(b, "max-point-size", 50), -        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),          t_MH_x(b, "model-centroid-x", 0),          t_MH_y(b, "model-centroid-y", 0),          t_MH_z(b, "model-centroid-z", 0), -        clip_ty(b, "clip-ty", 40), -        clip_tz(b, "clip-tz", 30), -        clip_by(b, "clip-by", 70), -        clip_bz(b, "clip-bz", 80), -        active_model_panel(b, "active-model-panel", 0), -        cap_x(b, "cap-x", 40), -        cap_y(b, "cap-y", 60), -        cap_z(b, "cap-z", 100), -        fov(b, "camera-fov", 56), +        fov(b, "camera-fov", 0), +        camera_mode(b, "camera-mode", 0), +        model_used(b, "model-used", 0),          dynamic_pose(b, "dynamic-pose-resolution", true),          init_phase_timeout(b, "init-phase-timeout", 500),          auto_threshold(b, "automatic-threshold", false) diff --git a/tracker-pt/point_tracker.h b/tracker-pt/point_tracker.h index fd002948..f4268486 100644 --- a/tracker-pt/point_tracker.h +++ b/tracker-pt/point_tracker.h @@ -65,8 +65,6 @@ public:      cv::Vec3f u;        // unit vector perpendicular to M01,M02-plane      cv::Matx22f P; -     -    enum Model { Clip = 0, Cap = 1, Custom = 2 };      PointModel(settings_pt& s)      { @@ -81,26 +79,32 @@ public:          float s22 = M02.dot(M02);          P = 1.0/(s11*s22-s12*s12) * cv::Matx22f(s22, -s12, -s12,  s11);      } -     +      void set_model(settings_pt& s)      { -        switch (s.active_model_panel) +        enum { Cap = 0, ClipRight = 1, ClipLeft = 2 }; + +        switch (s.model_used)          { -        case Clip: -            M01 = cv::Vec3f(0, static_cast<double>(s.clip_ty), -static_cast<double>(s.clip_tz)); -            M02 = cv::Vec3f(0, -static_cast<double>(s.clip_by), -static_cast<double>(s.clip_bz)); -            break; +        default:          case Cap: -            M01 = cv::Vec3f(-static_cast<double>(s.cap_x), -static_cast<double>(s.cap_y), -static_cast<double>(s.cap_z)); -            M02 = cv::Vec3f(static_cast<double>(s.cap_x), -static_cast<double>(s.cap_y), -static_cast<double>(s.cap_z)); +        { +            const double x = 60, y = 100, z = 120; +            M01 = cv::Vec3f(-x, -y, -z); +            M02 = cv::Vec3f(x, -y, -z);              break; -        case Custom: -            M01 = cv::Vec3f(s.m01_x, s.m01_y, s.m01_z); -            M02 = cv::Vec3f(s.m02_x, s.m02_y, s.m02_z); +        } +        case ClipLeft: +        case ClipRight: +        { +            const double a = 27, b = 43, c = 62, d = 74; +            M01 = cv::Vec3f(0, b, -a); +            M02 = cv::Vec3f(0, -c, -d);              break;          } +        }      } -     +      void get_d_order(const std::vector<cv::Vec2f>& points, int* d_order, cv::Vec2f d) const;  }; diff --git a/tracker-pt/trans_calib.cpp b/tracker-pt/trans_calib.cpp deleted file mode 100644 index a1a4b641..00000000 --- a/tracker-pt/trans_calib.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* 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" - -TranslationCalibrator::TranslationCalibrator() -{ -	reset(); -} - -void TranslationCalibrator::reset() -{ -    P = cv::Matx66f::zeros(); -    y = cv::Vec6f(0,0,0, 0,0,0); -} - -void TranslationCalibrator::update(const cv::Matx33f& R_CM_k, const cv::Vec3f& t_CM_k) -{ -    cv::Matx<float, 6,3> H_k_T = cv::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; -} - -cv::Vec3f TranslationCalibrator::get_estimate() -{ -    cv::Vec6f x = P.inv() * y; -    return cv::Vec3f(-x[0], -x[1], -x[2]); -} diff --git a/tracker-pt/trans_calib.h b/tracker-pt/trans_calib.h deleted file mode 100644 index e20fc767..00000000 --- a/tracker-pt/trans_calib.h +++ /dev/null @@ -1,39 +0,0 @@ -/* 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/core/core.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(); - -private: -    cv::Matx66f P;      // normalized precision matrix = inverse covariance -    cv::Vec6f y;        // P*(-t_MH, t_CH) -}; - -#endif //TRANSCALIB_H  | 
