diff options
35 files changed, 1401 insertions, 2582 deletions
diff --git a/3rdparty-notices/POINTTRACKER-COPYING.txt b/3rdparty-notices/POINTTRACKER-COPYING.txt new file mode 100644 index 00000000..1edf8a19 --- /dev/null +++ b/3rdparty-notices/POINTTRACKER-COPYING.txt @@ -0,0 +1,8 @@ +PointTracker was released under the following notice: + +/* 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. + */
\ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 7046c549..601f935d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,7 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_AUTOMOC OFF) set(CMAKE_POSITION_INDEPENDENT_CODE ON) -find_package(OpenCV 3.0) +find_package(OpenCV 3.0 REQUIRED) find_package(Qt5 REQUIRED COMPONENTS Core Xml Network Widgets Gui QUIET) find_package(Qt5 COMPONENTS SerialPort QUIET) @@ -99,18 +99,26 @@ function(opentrack_compat target) endfunction() macro(opentrack_library n dir) - cmake_parse_arguments(foolib "" "LINK;COMPILE;GNU-LINK;GNU-COMPILE" "" ${ARGN}) + cmake_parse_arguments(foolib "" "LINK;COMPILE;GNU-LINK;GNU-COMPILE;STATIC" "" ${ARGN}) if(NOT " ${foolib_UNPARSED_ARGUMENTS}" STREQUAL " ") message(FATAL_ERROR "opentrack_library bad formals") endif() opentrack_module(${n} ${dir}) opentrack_qt(${n}) - add_library(${n} SHARED ${${n}-all}) + set(link-mode SHARED) + if (foolib_STATIC) + set(link-mode STATIC) + endif() + add_library(${n} ${link-mode} ${${n}-all}) target_link_libraries(${n} ${MY_QT_LIBS}) if(CMAKE_COMPILER_IS_GNUCXX AND NOT APPLE) + set(visibility "-fvisibility=hidden -fvisibility-inlines-hidden") + if (foolib_STATIC) + set(visibility) + endif() SET_TARGET_PROPERTIES(${n} PROPERTIES LINK_FLAGS "${foolib_LINK} ${foolib_GNU-LINK} -Wl,--version-script=\"${CMAKE_SOURCE_DIR}/opentrack/${version-script}-version-script.txt\"" - COMPILE_FLAGS "${foolib_COMPILE} ${foolib_GNU-COMPILE} -fvisibility=hidden -fvisibility-inlines-hidden" + COMPILE_FLAGS "${foolib_COMPILE} ${foolib_GNU-COMPILE} ${visibility}" ) else() set(link-flags) @@ -119,7 +127,9 @@ macro(opentrack_library n dir) endif() set_target_properties(${n} PROPERTIES LINK_FLAGS "${link-flags} ${foolib_LINK}" COMPILE_FLAGS "${foolib_COMPILE}") endif() - install(TARGETS ${n} RUNTIME DESTINATION . LIBRARY DESTINATION .) + if (NOT foolib_STATIC) + install(TARGETS ${n} RUNTIME DESTINATION . LIBRARY DESTINATION .) + endif() endmacro() function(link_with_dinput8 n) @@ -266,10 +276,9 @@ set_target_properties(opentrack-version PROPERTIES COMPILE_DEFINITIONS "OPENTRACK_VERSION=\"${OPENTRACK__COMMIT}\"") -opentrack_library(opentrack-filter-accela ftnoir_filter_accela) +opentrack_library(opentrack-filter-accela ftnoir_filter_accela STATIC TRUE) target_link_libraries(opentrack-filter-accela opentrack-spline-widget) -opentrack_library(opentrack-filter-kalman ftnoir_filter_kalman) -opentrack_library(opentrack-filter-ewma ftnoir_filter_ewma2) +#opentrack_library(opentrack-filter-ewma ftnoir_filter_ewma2) opentrack_library(opentrack-proto-fgfs ftnoir_protocol_fg) @@ -317,16 +326,16 @@ endif() opentrack_library(opentrack-proto-udp ftnoir_protocol_ftn) if(WIN32) - opentrack_library(opentrack-tracker-joystick ftnoir_tracker_joystick) + #opentrack_library(opentrack-tracker-joystick ftnoir_tracker_joystick) endif() -if(Qt5SerialPort_FOUND) +if(Qt5SerialPort_FOUND AND FALSE) opentrack_library(opentrack-tracker-hatire ftnoir_tracker_hatire) target_link_libraries(opentrack-tracker-hatire ${Qt5SerialPort_LIBRARIES}) target_include_directories(opentrack-tracker-hatire SYSTEM PUBLIC ${Qt5SerialPort_INCLUDE_DIRS}) endif() -if(SDK_WINE_PREFIX) +if(SDK_WINE_PREFIX AND FALSE) opentrack_library(opentrack-proto-wine ftnoir_protocol_wine) target_link_libraries(opentrack-proto-wine opentrack-compat opentrack-csv) if(NOT SDK_WINE_NO_WRAPPER) @@ -350,34 +359,33 @@ if(SDK_WINE_PREFIX) endif() endif() -opentrack_library(opentrack-tracker-udp ftnoir_tracker_udp) -opentrack_library(opentrack-tracker-freepie-udp ftnoir_tracker_freepie-udp) +#opentrack_library(opentrack-tracker-udp ftnoir_tracker_udp) +#opentrack_library(opentrack-tracker-freepie-udp ftnoir_tracker_freepie-udp) if(OpenCV_FOUND) - opentrack_library(opentrack-tracker-pt ftnoir_tracker_pt) + opentrack_library(opentrack-tracker-pt ftnoir_tracker_pt STATIC YES) 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) if(SDK_ARUCO_LIBPATH) - opentrack_library(opentrack-tracker-aruco ftnoir_tracker_aruco) - target_link_libraries(opentrack-tracker-aruco ${SDK_ARUCO_LIBPATH} ${OpenCV_LIBS}) - target_include_directories(opentrack-tracker-aruco SYSTEM PUBLIC ${OpenCV_INCLUDE_DIRS}) + #opentrack_library(opentrack-tracker-aruco ftnoir_tracker_aruco) + #target_link_libraries(opentrack-tracker-aruco ${SDK_ARUCO_LIBPATH} ${OpenCV_LIBS}) + #target_include_directories(opentrack-tracker-aruco SYSTEM PUBLIC ${OpenCV_INCLUDE_DIRS}) endif() - target_link_libraries(opentrack-filter-kalman ${OpenCV_LIBS}) - target_include_directories(opentrack-filter-kalman SYSTEM PUBLIC ${OpenCV_INCLUDE_DIRS}) - - opentrack_library(opentrack-tracker-ht ftnoir_tracker_ht) - target_link_libraries(opentrack-tracker-ht opentrack-compat) - link_with_dinput8(opentrack-tracker-ht) - target_link_libraries(opentrack-tracker-ht ${OpenCV_LIBS}) - target_include_directories(opentrack-tracker-ht SYSTEM PUBLIC ${OpenCV_INCLUDE_DIRS}) + #opentrack_library(opentrack-filter-kalman ftnoir_filter_kalman) + #target_link_libraries(opentrack-filter-kalman ${OpenCV_LIBS}) + #target_include_directories(opentrack-filter-kalman SYSTEM PUBLIC ${OpenCV_INCLUDE_DIRS}) endif() -link_with_dinput8(opentrack-tracker-joystick) +#opentrack_library(opentrack-tracker-ht ftnoir_tracker_ht) +#target_link_libraries(opentrack-tracker-ht opentrack-compat) +#link_with_dinput8(opentrack-tracker-ht) + +#link_with_dinput8(opentrack-tracker-joystick) -if(SDK_RIFT) +if(SDK_RIFT AND FALSE) set(link-flags) set(c-flags) if(APPLE) @@ -408,7 +416,7 @@ if(SDK_RIFT) endif() endif() -if(SDK_HYDRA) +if(SDK_HYDRA AND FALSE) opentrack_library(opentrack-tracker-hydra ftnoir_tracker_hydra) target_include_directories(opentrack-tracker-hydra SYSTEM PUBLIC ${SDK_HYDRA}/include ${SDK_HYDRA}/include/sixense_utils) if(WIN32) @@ -477,18 +485,21 @@ else() endif() opentrack_module(opentrack facetracknoir) + if(UNIX OR APPLE) list(APPEND opentrack-c qxt-mini/qxtglobalshortcut.h) endif() opentrack_qt(opentrack) add_executable(opentrack ${opentrack-win32-executable} ${opentrack-all}) +target_link_libraries(opentrack opentrack-filter-accela opentrack-tracker-pt) opentrack_compat(opentrack) if(NOT WIN32) set_target_properties(opentrack PROPERTIES SUFFIX ".bin") endif() target_link_libraries(opentrack opentrack-api opentrack-version opentrack-pose-widget opentrack-spline-widget) - +target_include_directories(opentrack SYSTEM PUBLIC ${OpenCV_INCLUDE_DIRS}) +target_link_libraries(opentrack ${OpenCV_LIBS}) if(APPLE) SET_TARGET_PROPERTIES(opentrack-qxt-mini PROPERTIES LINK_FLAGS "-framework Carbon -framework CoreFoundation") @@ -517,11 +528,6 @@ if(SDK_XPLANE) install(TARGETS opentrack-xplane-plugin RUNTIME DESTINATION . LIBRARY DESTINATION . ) endif() -if(WIN32) - install(DIRECTORY ${CMAKE_SOURCE_DIR}/bin/tracker-ht DESTINATION .) - #install(TARGETS freetrackclient RUNTIME DESTINATION . LIBRARY DESTINATION . ) -endif() - install(DIRECTORY ${CMAKE_SOURCE_DIR}/3rdparty-notices DESTINATION .) install(FILES "${CMAKE_SOURCE_DIR}/bin/freetrackclient.dll" DESTINATION . ${opentrack-perms}) diff --git a/facetracknoir/images/trackhat-cap.png b/facetracknoir/images/trackhat-cap.png Binary files differnew file mode 100644 index 00000000..7ce4bd1a --- /dev/null +++ b/facetracknoir/images/trackhat-cap.png diff --git a/facetracknoir/images/trackhat-clip.png b/facetracknoir/images/trackhat-clip.png Binary files differnew file mode 100644 index 00000000..3320f831 --- /dev/null +++ b/facetracknoir/images/trackhat-clip.png diff --git a/facetracknoir/main.ui b/facetracknoir/main.ui index 77a3ef3a..b6211698 100644 --- a/facetracknoir/main.ui +++ b/facetracknoir/main.ui @@ -7,8 +7,8 @@ <rect> <x>0</x> <y>0</y> - <width>708</width> - <height>504</height> + <width>750</width> + <height>511</height> </rect> </property> <property name="windowIcon"> @@ -53,94 +53,7 @@ <property name="lineWidth"> <number>0</number> </property> - <layout class="QFormLayout" name="formLayout"> - <property name="horizontalSpacing"> - <number>0</number> - </property> - <property name="verticalSpacing"> - <number>0</number> - </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item row="0" column="0"> - <widget class="QFrame" name="video_feed"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>480</width> - <height>360</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>480</width> - <height>360</height> - </size> - </property> - <widget class="QFrame" name="video_frame"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>480</width> - <height>360</height> - </rect> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <widget class="QLabel" name="video_frame_label"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>480</width> - <height>360</height> - </rect> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>480</width> - <height>360</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>480</width> - <height>360</height> - </size> - </property> - <property name="text"> - <string/> - </property> - </widget> - </widget> - </widget> - </item> + <layout class="QGridLayout" name="gridLayout"> <item row="0" column="1"> <widget class="QFrame" name="top_display"> <property name="frameShape"> @@ -802,8 +715,83 @@ </layout> </widget> </item> + <item row="0" column="0"> + <widget class="QFrame" name="video_feed"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>480</width> + <height>360</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>480</width> + <height>360</height> + </size> + </property> + <widget class="QFrame" name="video_frame"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>480</width> + <height>360</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <widget class="QLabel" name="video_frame_label"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>480</width> + <height>360</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>480</width> + <height>360</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>480</width> + <height>360</height> + </size> + </property> + <property name="text"> + <string/> + </property> + </widget> + </widget> + </widget> + </item> <item row="1" column="0" colspan="2"> - <widget class="QFrame" name="bottom_controls"> + <widget class="QFrame" name="frame_2"> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Plain</enum> + </property> <layout class="QGridLayout" name="gridLayout_2"> <property name="topMargin"> <number>0</number> @@ -811,152 +799,120 @@ <property name="bottomMargin"> <number>0</number> </property> - <property name="horizontalSpacing"> - <number>6</number> - </property> <property name="verticalSpacing"> <number>0</number> </property> - <item row="1" column="1"> - <widget class="QGroupBox" name="groupStartStop"> + <item row="0" column="0"> + <widget class="QGroupBox" name="groupProfile"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> <property name="title"> - <string notr="true">Controls</string> + <string>Profile</string> </property> <property name="flat"> <bool>true</bool> </property> - <layout class="QGridLayout" name="gridLayout_5"> + <layout class="QGridLayout" name="gridLayout_7"> <property name="leftMargin"> <number>4</number> </property> <property name="topMargin"> - <number>12</number> + <number>0</number> </property> <property name="rightMargin"> <number>4</number> </property> <property name="bottomMargin"> - <number>12</number> + <number>4</number> </property> - <item row="0" column="1"> - <widget class="QToolButton" name="btnStopTracker"> + <property name="verticalSpacing"> + <number>2</number> + </property> + <item row="1" column="1"> + <widget class="QToolButton" name="btnSaveAs"> <property name="enabled"> - <bool>false</bool> + <bool>true</bool> </property> <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="text"> - <string>Stop</string> + <string>Save...</string> </property> </widget> </item> - <item row="0" column="0"> - <widget class="QToolButton" name="btnStartTracker"> + <item row="1" column="0"> + <widget class="QToolButton" name="btnLoad"> <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="text"> - <string>Start</string> + <string>Load</string> </property> </widget> </item> - </layout> - </widget> - </item> - <item row="1" column="2"> - <widget class="QGroupBox" name="groupWindows"> - <property name="title"> - <string>Settings</string> - </property> - <property name="flat"> - <bool>true</bool> - </property> - <layout class="QGridLayout" name="gridLayout_6"> - <property name="leftMargin"> - <number>4</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>4</number> - </property> - <property name="bottomMargin"> - <number>4</number> - </property> - <property name="verticalSpacing"> - <number>2</number> - </property> - <item row="1" column="0"> - <widget class="QPushButton" name="btnShortcuts"> + <item row="0" column="0"> + <widget class="QComboBox" name="iconcomboProfile"> <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="text"> - <string>Options</string> - </property> - <property name="icon"> - <iconset resource="ui-res.qrc"> - <normaloff>:/images/tools.png</normaloff>:/images/tools.png</iconset> - </property> - <property name="iconSize"> - <size> - <width>80</width> - <height>24</height> - </size> + <property name="maxVisibleItems"> + <number>10</number> </property> </widget> </item> - <item row="0" column="0"> - <widget class="QPushButton" name="btnEditCurves"> + <item row="0" column="1"> + <widget class="QToolButton" name="btnSave"> + <property name="enabled"> + <bool>true</bool> + </property> <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="text"> - <string>Mapping</string> - </property> - <property name="icon"> - <iconset resource="ui-res.qrc"> - <normaloff>:/images/curves.png</normaloff>:/images/curves.png</iconset> - </property> - <property name="iconSize"> - <size> - <width>80</width> - <height>24</height> - </size> + <string>Save</string> </property> </widget> </item> </layout> </widget> </item> - <item row="0" column="2"> - <widget class="QGroupBox" name="groupFilter"> + <item row="0" column="1"> + <widget class="QGroupBox" name="groupStartStop"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> <property name="title"> - <string>Filter</string> + <string notr="true">Controls</string> </property> <property name="flat"> <bool>true</bool> </property> - <layout class="QGridLayout" name="gridLayout_3"> + <layout class="QGridLayout" name="gridLayout_5"> <property name="leftMargin"> <number>4</number> </property> <property name="topMargin"> - <number>0</number> + <number>12</number> </property> <property name="rightMargin"> <number>4</number> @@ -964,193 +920,142 @@ <property name="bottomMargin"> <number>4</number> </property> - <property name="verticalSpacing"> - <number>2</number> - </property> - <item row="0" column="0"> - <widget class="QComboBox" name="iconcomboFilter"/> - </item> <item row="0" column="1"> - <widget class="QToolButton" name="btnShowFilterControls"> + <widget class="QToolButton" name="btnStopTracker"> <property name="enabled"> - <bool>true</bool> + <bool>false</bool> </property> - <property name="text"> - <string>...</string> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> - <property name="flat" stdset="0"> - <bool>false</bool> + <property name="text"> + <string>Stop</string> </property> </widget> </item> - </layout> - </widget> - </item> - <item row="0" column="0"> - <widget class="QGroupBox" name="groupTrackerSource"> - <property name="title"> - <string>Tracker</string> - </property> - <property name="flat"> - <bool>true</bool> - </property> - <layout class="QGridLayout" name="gridLayout"> - <property name="leftMargin"> - <number>4</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>4</number> - </property> - <property name="bottomMargin"> - <number>4</number> - </property> - <property name="verticalSpacing"> - <number>2</number> - </property> <item row="0" column="0"> - <widget class="QComboBox" name="iconcomboTrackerSource"/> - </item> - <item row="0" column="1"> - <widget class="QToolButton" name="btnShowEngineControls"> - <property name="enabled"> - <bool>true</bool> + <widget class="QToolButton" name="btnStartTracker"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> <property name="text"> - <string>...</string> - </property> - <property name="flat" stdset="0"> - <bool>false</bool> + <string>Start</string> </property> </widget> </item> </layout> </widget> </item> - <item row="0" column="1"> - <widget class="QGroupBox" name="groupGameProtocol"> + <item row="0" column="2"> + <widget class="QGroupBox" name="groupWindows"> + <property name="styleSheet"> + <string notr="true">QGroupBox { border: 0; }</string> + </property> <property name="title"> - <string>Protocol</string> + <string/> </property> <property name="flat"> <bool>true</bool> </property> - <layout class="QGridLayout" name="gridLayout_4"> - <property name="leftMargin"> - <number>4</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>4</number> + <layout class="QVBoxLayout" name="verticalLayout"> + <property name="spacing"> + <number>6</number> </property> <property name="bottomMargin"> <number>4</number> </property> - <property name="verticalSpacing"> - <number>2</number> - </property> - <item row="0" column="1"> - <widget class="QToolButton" name="btnShowServerControls"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="text"> - <string>...</string> + <item> + <widget class="QGroupBox" name="groupGameProtocol"> + <property name="title"> + <string>Protocol</string> </property> - <property name="flat" stdset="0"> + <property name="flat"> <bool>false</bool> </property> + <layout class="QHBoxLayout" name="horizontalLayout"> + <property name="spacing"> + <number>5</number> + </property> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>18</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="QComboBox" name="iconcomboProtocol"/> + </item> + <item> + <widget class="QToolButton" name="btnShowServerControls"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="text"> + <string>...</string> + </property> + <property name="flat" stdset="0"> + <bool>false</bool> + </property> + </widget> + </item> + </layout> </widget> </item> - <item row="0" column="0"> - <widget class="QComboBox" name="iconcomboProtocol"/> - </item> - </layout> - </widget> - </item> - <item row="1" column="0"> - <widget class="QGroupBox" name="groupProfile"> - <property name="title"> - <string>Profile</string> - </property> - <property name="flat"> - <bool>true</bool> - </property> - <layout class="QGridLayout" name="gridLayout_7"> - <property name="leftMargin"> - <number>4</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>4</number> - </property> - <property name="bottomMargin"> - <number>4</number> - </property> - <property name="verticalSpacing"> - <number>2</number> - </property> - <item row="0" column="0"> - <widget class="QComboBox" name="iconcomboProfile"> + <item> + <widget class="QPushButton" name="btnEditCurves"> <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="maxVisibleItems"> - <number>10</number> + <property name="text"> + <string>Mapping</string> </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QToolButton" name="btnLoad"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> + <property name="icon"> + <iconset resource="ui-res.qrc"> + <normaloff>:/images/curves.png</normaloff>:/images/curves.png</iconset> </property> - <property name="text"> - <string>Load</string> + <property name="iconSize"> + <size> + <width>80</width> + <height>24</height> + </size> </property> </widget> </item> - <item row="0" column="1"> - <widget class="QToolButton" name="btnSave"> - <property name="enabled"> - <bool>true</bool> - </property> + <item> + <widget class="QPushButton" name="btnShortcuts"> <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="text"> - <string>Save</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QToolButton" name="btnSaveAs"> - <property name="enabled"> - <bool>true</bool> + <string>Options</string> </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> + <property name="icon"> + <iconset resource="ui-res.qrc"> + <normaloff>:/images/tools.png</normaloff>:/images/tools.png</iconset> </property> - <property name="text"> - <string>Save...</string> + <property name="iconSize"> + <size> + <width>80</width> + <height>24</height> + </size> </property> </widget> </item> @@ -1176,12 +1081,8 @@ <tabstops> <tabstop>btnStartTracker</tabstop> <tabstop>btnStopTracker</tabstop> - <tabstop>iconcomboTrackerSource</tabstop> - <tabstop>btnShowEngineControls</tabstop> <tabstop>iconcomboProtocol</tabstop> <tabstop>btnShowServerControls</tabstop> - <tabstop>iconcomboFilter</tabstop> - <tabstop>btnShowFilterControls</tabstop> <tabstop>iconcomboProfile</tabstop> <tabstop>btnLoad</tabstop> <tabstop>btnSave</tabstop> diff --git a/facetracknoir/options-dialog.cpp b/facetracknoir/options-dialog.cpp index 4489e502..1b64de9e 100644 --- a/facetracknoir/options-dialog.cpp +++ b/facetracknoir/options-dialog.cpp @@ -1,6 +1,7 @@ #include "options-dialog.hpp" +#include "ftnoir_tracker_pt/camera.h" -OptionsDialog::OptionsDialog() +OptionsDialog::OptionsDialog(State& state) : state(state), trans_calib_running(false) { ui.setupUi( this ); @@ -35,13 +36,6 @@ OptionsDialog::OptionsDialog() tie_setting(s.s_main.tcomp_p, ui.tcomp_enable); tie_setting(s.s_main.tcomp_tz, ui.tcomp_rz); - tie_setting(s.s_main.a_x.zero, ui.pos_tx); - tie_setting(s.s_main.a_y.zero, ui.pos_ty); - tie_setting(s.s_main.a_z.zero, ui.pos_tz); - tie_setting(s.s_main.a_yaw.zero, ui.pos_rx); - tie_setting(s.s_main.a_pitch.zero, ui.pos_ry); - tie_setting(s.s_main.a_roll.zero, ui.pos_rz); - tie_setting(s.s_main.a_yaw.invert, ui.invert_yaw); tie_setting(s.s_main.a_pitch.invert, ui.invert_pitch); tie_setting(s.s_main.a_roll.invert, ui.invert_roll); @@ -59,11 +53,54 @@ OptionsDialog::OptionsDialog() tie_setting(s.s_main.camera_yaw, ui.camera_yaw); tie_setting(s.s_main.camera_pitch, ui.camera_pitch); tie_setting(s.s_main.camera_roll, ui.camera_roll); + + tie_setting(pt.camera_mode, ui.camera_mode); + + tie_setting(pt.threshold, ui.threshold_slider); + + tie_setting(pt.min_point_size, ui.mindiam_spin); + tie_setting(pt.max_point_size, ui.maxdiam_spin); + + tie_setting(pt.t_MH_x, ui.tx_spin); + tie_setting(pt.t_MH_y, ui.ty_spin); + tie_setting(pt.t_MH_z, ui.tz_spin); + + tie_setting(pt.fov, ui.camera_fov); + + tie_setting(pt.model_used, ui.model_used); + + connect(ui.ewma_slider, SIGNAL(valueChanged(int)), this, SLOT(update_ewma_display(int))); + connect(ui.rotation_slider, SIGNAL(valueChanged(int)), this, SLOT(update_rot_display(int))); + connect(ui.rot_dz_slider, SIGNAL(valueChanged(int)), this, SLOT(update_rot_dz_display(int))); + connect(ui.translation_slider, SIGNAL(valueChanged(int)), this, SLOT(update_trans_display(int))); + connect(ui.trans_dz_slider, SIGNAL(valueChanged(int)), this, SLOT(update_trans_dz_display(int))); + + tie_setting(acc.rot_threshold, ui.rotation_slider); + tie_setting(acc.trans_threshold, ui.translation_slider); + tie_setting(acc.ewma, ui.ewma_slider); + tie_setting(acc.rot_deadzone, ui.rot_dz_slider); + tie_setting(acc.trans_deadzone, ui.trans_dz_slider); + + update_rot_display(ui.rotation_slider->value()); + update_trans_display(ui.translation_slider->value()); + update_ewma_display(ui.ewma_slider->value()); + update_rot_dz_display(ui.rot_dz_slider->value()); + update_trans_dz_display(ui.trans_dz_slider->value()); + + tie_setting(pt.dynamic_pose, ui.dynamic_pose); + tie_setting(pt.init_phase_timeout, ui.init_phase_timeout); + + connect(&timer,SIGNAL(timeout()), this,SLOT(poll_tracker_info())); + connect( ui.tcalib_button,SIGNAL(toggled(bool)), this,SLOT(startstop_trans_calib(bool)) ); + + timer.start(100); } void OptionsDialog::doOK() { s.b->save(); + pt.b->save(); s.s_main.b->save(); + acc.b->save(); ui.game_detector->save(); this->close(); emit reload(); @@ -71,7 +108,119 @@ void OptionsDialog::doOK() { void OptionsDialog::doCancel() { s.b->reload(); + pt.b->reload(); s.s_main.b->reload(); + acc.b->reload(); ui.game_detector->revert(); close(); } + +void OptionsDialog::startstop_trans_calib(bool start) +{ + auto tracker = get_pt(); + if (!tracker) + { + ui.tcalib_button->setChecked(false); + return; + } + + if (start) + { + qDebug()<<"TrackerDialog:: Starting translation calibration"; + trans_calib.reset(); + trans_calib_running = true; + pt.t_MH_x = 0; + pt.t_MH_y = 0; + pt.t_MH_z = 0; + } + else + { + qDebug()<<"TrackerDialog:: Stopping translation calibration"; + trans_calib_running = false; + { + auto tmp = trans_calib.get_estimate(); + pt.t_MH_x = tmp[0]; + pt.t_MH_y = tmp[1]; + pt.t_MH_z = tmp[2]; + } + } +} + +void OptionsDialog::poll_tracker_info() +{ + auto tracker = get_pt(); + if (tracker) + { + QString to_print; + + // display caminfo + CamInfo info; + tracker->get_cam_info(&info); + 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 + { + QString to_print = "Tracker offline"; + ui.caminfo_label->setText(to_print); + ui.pointinfo_label->setText(to_print); + } +} + +void OptionsDialog::trans_calib_step() +{ + auto tracker = get_pt(); + if (tracker) + { + Affine X_CM = tracker->pose(); + trans_calib.update(X_CM.R, X_CM.t); + } +} + +Tracker_PT* OptionsDialog::get_pt() +{ + auto work = state.work.get(); + if (!work) + return nullptr; + auto ptr = work->libs.pTracker; + if (ptr) + return static_cast<Tracker_PT*>(ptr.get()); + return nullptr; +} + +void OptionsDialog::update_rot_display(int value) +{ + ui.rot_gain->setText(QString::number((value + 1) * 10 / 100.) + "°"); +} + +void OptionsDialog::update_trans_display(int value) +{ + ui.trans_gain->setText(QString::number((value + 1) * 5 / 100.) + "mm"); +} + +void OptionsDialog::update_ewma_display(int value) +{ + ui.ewma_label->setText(QString::number(value * 2) + "ms"); +} + +void OptionsDialog::update_rot_dz_display(int value) +{ + ui.rot_dz->setText(QString::number(value * 2 / 100.) + "°"); +} + +void OptionsDialog::update_trans_dz_display(int value) +{ + ui.trans_dz->setText(QString::number(value * 1 / 100.) + "mm"); +} diff --git a/facetracknoir/options-dialog.hpp b/facetracknoir/options-dialog.hpp index 71a3acda..a2dec093 100644 --- a/facetracknoir/options-dialog.hpp +++ b/facetracknoir/options-dialog.hpp @@ -2,8 +2,14 @@ #include <QObject> #include <QWidget> +#include <QTimer> #include "ui_settings.h" +#include "opentrack/state.hpp" #include "opentrack/shortcuts.h" +#include "ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h" +#include "facetracknoir/trans_calib.h" +#include "ftnoir_tracker_pt/ftnoir_tracker_pt.h" +#include "ftnoir_filter_accela/ftnoir_filter_accela.h" class OptionsDialog: public QWidget { @@ -11,11 +17,28 @@ class OptionsDialog: public QWidget signals: void reload(); public: - OptionsDialog(); + OptionsDialog(State &state); private: Ui::UI_Settings ui; Shortcuts::settings s; + settings_pt pt; + settings_accela acc; + QTimer timer; + State& state; + TranslationCalibrator trans_calib; + bool trans_calib_running; + + Tracker_PT* get_pt(); +private slots: + void update_ewma_display(int value); + void update_rot_display(int value); + void update_trans_display(int value); + void update_rot_dz_display(int value); + void update_trans_dz_display(int value); private slots: void doOK(); void doCancel(); + void startstop_trans_calib(bool start); + void poll_tracker_info(); + void trans_calib_step(); }; diff --git a/facetracknoir/settings.ui b/facetracknoir/settings.ui index 34b15b47..523829f6 100644 --- a/facetracknoir/settings.ui +++ b/facetracknoir/settings.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>348</width> - <height>548</height> + <width>462</width> + <height>657</height> </rect> </property> <property name="windowTitle"> @@ -296,8 +296,240 @@ <attribute name="title"> <string>Camera</string> </attribute> - <layout class="QVBoxLayout" name="verticalLayout_3"> - <item> + <layout class="QGridLayout" name="gridLayout_9"> + <item row="3" column="0"> + <widget class="QGroupBox" name="groupBox_6"> + <property name="title"> + <string>Point extraction</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_3"> + <item> + <widget class="QFrame" name="frame_2"> + <property name="frameShape"> + <enum>QFrame::StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <layout class="QGridLayout" name="gridLayout_10"> + <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="0" column="1"> + <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> + </layout> + </widget> + </item> + <item> + <widget class="QFrame" name="frame"> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <layout class="QGridLayout" name="gridLayout_3"> + <item row="0" column="0"> + <widget class="QLabel" name="label_29"> + <property name="text"> + <string>Min size</string> + </property> + <property name="buddy"> + <cstring>mindiam_spin</cstring> + </property> + </widget> + </item> + <item row="0" column="1"> + <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="2"> + <widget class="QLabel" name="label_22"> + <property name="text"> + <string>Max size</string> + </property> + <property name="buddy"> + <cstring>maxdiam_spin</cstring> + </property> + </widget> + </item> + <item row="0" column="3"> + <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> + </layout> + </widget> + </item> + </layout> + </widget> + </item> + <item row="4" column="0"> + <widget class="QGroupBox" name="groupBox_11"> + <property name="title"> + <string>Status</string> + </property> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QLabel" name="caminfo_label"> + <property name="text"> + <string>Not running</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="pointinfo_label"> + <property name="text"> + <string/> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="1" column="0"> + <widget class="QGroupBox" name="groupBox_9"> + <property name="title"> + <string>Device</string> + </property> + <layout class="QGridLayout" name="gridLayout"> + <item row="2" column="0"> + <widget class="QLabel" name="label_32"> + <property name="text"> + <string>Dynamic pose resolution</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QCheckBox" name="dynamic_pose"> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QComboBox" name="camera_mode"> + <item> + <property name="text"> + <string>640x480, 75 Hz</string> + </property> + </item> + <item> + <property name="text"> + <string>640x480, 60 Hz</string> + </property> + </item> + <item> + <property name="text"> + <string>320x240, 189 Hz</string> + </property> + </item> + <item> + <property name="text"> + <string>320x240, 120 Hz</string> + </property> + </item> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="label_25"> + <property name="text"> + <string>Mode</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QComboBox" name="camera_fov"> + <item> + <property name="text"> + <string>56°</string> + </property> + </item> + <item> + <property name="text"> + <string>75°</string> + </property> + </item> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string>Field of view</string> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="label_33"> + <property name="text"> + <string>Dynamic pose timeout</string> + </property> + </widget> + </item> + <item row="3" 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> + </layout> + </widget> + </item> + <item row="0" column="0"> <widget class="QGroupBox" name="groupBox_5"> <property name="title"> <string>Camera offset</string> @@ -403,202 +635,232 @@ </layout> </widget> </item> + <item row="5" column="0"> + <spacer name="verticalSpacer_2"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + <widget class="QWidget" name="tab_2"> + <attribute name="title"> + <string>Model</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_6"> <item> - <widget class="QGroupBox" name="groupBox_6"> + <widget class="QGroupBox" name="groupBox_7"> + <property name="styleSheet"> + <string notr="true">QGroupBox { border: 0; }</string> + </property> <property name="title"> - <string>Center pose offset</string> + <string/> </property> - <layout class="QVBoxLayout" name="verticalLayout_6"> + <widget class="QLabel" name="label_3"> + <property name="geometry"> + <rect> + <x>40</x> + <y>40</y> + <width>206</width> + <height>156</height> + </rect> + </property> + <property name="text"> + <string/> + </property> + <property name="pixmap"> + <pixmap resource="ui-res.qrc">:/images/trackhat-cap.png</pixmap> + </property> + <property name="scaledContents"> + <bool>true</bool> + </property> + </widget> + <widget class="QLabel" name="label_4"> + <property name="geometry"> + <rect> + <x>135</x> + <y>150</y> + <width>221</width> + <height>191</height> + </rect> + </property> + <property name="text"> + <string/> + </property> + <property name="pixmap"> + <pixmap resource="ui-res.qrc">:/images/trackhat-clip.png</pixmap> + </property> + <property name="scaledContents"> + <bool>true</bool> + </property> + </widget> + <widget class="QLabel" name="label_31"> + <property name="geometry"> + <rect> + <x>10</x> + <y>310</y> + <width>61</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>Model used</string> + </property> + </widget> + <widget class="QComboBox" name="model_used"> + <property name="geometry"> + <rect> + <x>90</x> + <y>305</y> + <width>81</width> + <height>22</height> + </rect> + </property> <item> - <widget class="QLabel" name="label_22"> - <property name="text"> - <string>Alter the centered position sent to games by a fixed amount.</string> - </property> - <property name="wordWrap"> - <bool>true</bool> - </property> - <property name="margin"> - <number>2</number> - </property> - </widget> + <property name="text"> + <string>Cap</string> + </property> </item> <item> - <widget class="QGroupBox" name="groupBox_7"> - <property name="styleSheet"> - <string notr="true">QGroupBox { - border: 0; -}</string> - </property> - <property name="title"> - <string/> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - <property name="flat"> - <bool>false</bool> + <property name="text"> + <string>Clip</string> + </property> + </item> + </widget> + </widget> + </item> + <item> + <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 calibration</string> + </property> + <layout class="QGridLayout" name="gridLayout_11"> + <item row="0" column="0"> + <widget class="QFrame" name="frame_3"> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> </property> - <property name="checkable"> - <bool>false</bool> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> </property> - <layout class="QGridLayout" name="gridLayout_3"> - <item row="2" column="1"> - <widget class="QDoubleSpinBox" name="pos_rz"> - <property name="suffix"> - <string> deg.</string> - </property> - <property name="decimals"> - <number>3</number> - </property> - <property name="minimum"> - <double>-180.000000000000000</double> - </property> - <property name="maximum"> - <double>180.000000000000000</double> - </property> - </widget> - </item> - <item row="2" column="3"> - <widget class="QDoubleSpinBox" name="pos_tz"> - <property name="suffix"> - <string> cm</string> - </property> - <property name="decimals"> - <number>3</number> - </property> - <property name="minimum"> - <double>-100.000000000000000</double> - </property> - <property name="maximum"> - <double>100.000000000000000</double> + <layout class="QGridLayout" name="gridLayout_12"> + <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> - </widget> - </item> - <item row="0" column="2"> - <widget class="QLabel" name="label_4"> <property name="text"> - <string>TX</string> + <string>x:</string> </property> </widget> </item> - <item row="0" column="3"> - <widget class="QDoubleSpinBox" name="pos_tx"> + <item row="0" column="1"> + <widget class="QSpinBox" name="tx_spin"> <property name="suffix"> - <string> cm</string> - </property> - <property name="decimals"> - <number>3</number> + <string> mm</string> </property> <property name="minimum"> - <double>-100.000000000000000</double> + <number>-65535</number> </property> <property name="maximum"> - <double>100.000000000000000</double> + <number>65536</number> </property> </widget> </item> <item row="1" column="0"> - <widget class="QLabel" name="label"> - <property name="text"> - <string>RY</string> + <widget class="QLabel" name="label_62"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> - </widget> - </item> - <item row="1" column="2"> - <widget class="QLabel" name="label_5"> <property name="text"> - <string>TY</string> + <string>y:</string> </property> </widget> </item> <item row="1" column="1"> - <widget class="QDoubleSpinBox" name="pos_ry"> + <widget class="QSpinBox" name="ty_spin"> <property name="suffix"> - <string> deg.</string> - </property> - <property name="decimals"> - <number>3</number> + <string> mm</string> </property> <property name="minimum"> - <double>-180.000000000000000</double> + <number>-65535</number> </property> <property name="maximum"> - <double>180.000000000000000</double> - </property> - </widget> - </item> - <item row="2" column="2"> - <widget class="QLabel" name="label_6"> - <property name="text"> - <string>TZ</string> + <number>65536</number> </property> </widget> </item> <item row="2" column="0"> - <widget class="QLabel" name="label_3"> - <property name="text"> - <string>RZ</string> - </property> - </widget> - </item> - <item row="1" column="3"> - <widget class="QDoubleSpinBox" name="pos_ty"> - <property name="suffix"> - <string> cm</string> - </property> - <property name="decimals"> - <number>3</number> - </property> - <property name="minimum"> - <double>-100.000000000000000</double> - </property> - <property name="maximum"> - <double>100.000000000000000</double> + <widget class="QLabel" name="label_66"> + <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_2"> <property name="text"> - <string>RX</string> + <string>z:</string> </property> </widget> </item> - <item row="0" column="1"> - <widget class="QDoubleSpinBox" name="pos_rx"> + <item row="2" column="1"> + <widget class="QSpinBox" name="tz_spin"> <property name="suffix"> - <string> deg.</string> - </property> - <property name="decimals"> - <number>3</number> + <string> mm</string> </property> <property name="minimum"> - <double>-180.000000000000000</double> + <number>-65535</number> </property> <property name="maximum"> - <double>180.000000000000000</double> + <number>65536</number> </property> </widget> </item> </layout> </widget> </item> + <item row="0" column="1"> + <widget class="QLabel" name="label_59"> + <property name="text"> + <string><html><head/><body><p>Only pitch and yaw during calibration.</p><p>Don't roll and don't translate.</p></body></html></string> + </property> + </widget> + </item> + <item row="2" column="1"> + <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> - <item> - <spacer name="verticalSpacer_2"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> </layout> </widget> <widget class="QWidget" name="tab_4"> @@ -1098,6 +1360,257 @@ </item> </layout> </widget> + <widget class="QWidget" name="tab_6"> + <attribute name="title"> + <string>Filter</string> + </attribute> + <layout class="QGridLayout" name="gridLayout_15"> + <item row="0" column="0"> + <widget class="QFrame" name="frame_4"> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <layout class="QGridLayout" name="gridLayout_14"> + <item row="1" column="3"> + <widget class="QSlider" name="rotation_slider"> + <property name="maximum"> + <number>99</number> + </property> + <property name="pageStep"> + <number>5</number> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="tickPosition"> + <enum>QSlider::TicksAbove</enum> + </property> + <property name="tickInterval"> + <number>25</number> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="lblSensYaw_6"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Rotation sensitivity</string> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="label_6"> + <property name="text"> + <string>Smoothing</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLabel" name="ewma_label"> + <property name="minimumSize"> + <size> + <width>48</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>0 ms</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLabel" name="rot_gain"> + <property name="text"> + <string>0°</string> + </property> + </widget> + </item> + <item row="0" column="3"> + <widget class="QSlider" name="ewma_slider"> + <property name="maximum"> + <number>100</number> + </property> + <property name="singleStep"> + <number>10</number> + </property> + <property name="pageStep"> + <number>25</number> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="tickPosition"> + <enum>QSlider::TicksAbove</enum> + </property> + <property name="tickInterval"> + <number>25</number> + </property> + </widget> + </item> + <item row="6" column="0"> + <widget class="QLabel" name="label_27"> + <property name="text"> + <string>Translation deadzone</string> + </property> + </widget> + </item> + <item row="4" column="0"> + <widget class="QLabel" name="label_28"> + <property name="text"> + <string>Rotation deadzone</string> + </property> + </widget> + </item> + <item row="4" column="3"> + <widget class="QSlider" name="rot_dz_slider"> + <property name="maximum"> + <number>100</number> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item row="4" column="1"> + <widget class="QLabel" name="rot_dz"> + <property name="text"> + <string>0°</string> + </property> + </widget> + </item> + <item row="6" column="3"> + <widget class="QSlider" name="trans_dz_slider"> + <property name="maximum"> + <number>100</number> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item row="6" column="1"> + <widget class="QLabel" name="trans_dz"> + <property name="text"> + <string>0mm</string> + </property> + </widget> + </item> + <item row="5" column="0"> + <widget class="QLabel" name="label_30"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Translation sensitivity</string> + </property> + </widget> + </item> + <item row="5" column="1"> + <widget class="QLabel" name="trans_gain"> + <property name="text"> + <string>0mm</string> + </property> + </widget> + </item> + <item row="5" column="3"> + <widget class="QSlider" name="translation_slider"> + <property name="maximum"> + <number>99</number> + </property> + <property name="pageStep"> + <number>5</number> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="tickPosition"> + <enum>QSlider::TicksAbove</enum> + </property> + <property name="tickInterval"> + <number>25</number> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="1" column="0"> + <widget class="QGroupBox" name="groupBox_12"> + <property name="title"> + <string>GroupBox</string> + </property> + <layout class="QGridLayout" name="gridLayout_13"> + <item row="0" column="1"> + <widget class="QLabel" name="label_26"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="font"> + <font> + <pointsize>7</pointsize> + </font> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="text"> + <string><html><head/><body><p align="justify"><br/><span style=" font-size:10pt;">Accela by </span><a href="https://github.com/sthalik"><span style=" font-size:10pt; text-decoration: underline; color:#0057ae;">Stanisław Halik</span></a><span style=" font-size:10pt;"><br/>Thanks to </span><a href="https://github.com/dbaarda"><span style=" font-size:10pt; text-decoration: underline; color:#0057ae;">Donovan Baarda</span></a></p><p align="right"><span style=" font-size:10pt;">2012-2015</span></p><p align="right"><br/></p></body></html></string> + </property> + <property name="textFormat"> + <enum>Qt::RichText</enum> + </property> + <property name="scaledContents"> + <bool>false</bool> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="indent"> + <number>0</number> + </property> + <property name="openExternalLinks"> + <bool>true</bool> + </property> + <property name="textInteractionFlags"> + <set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="label_5"> + <property name="text"> + <string><html><head/><body><p>Visit <a href="https://github.com/opentrack/opentrack/wiki/Accela-in-opentrack-2.3"><span style=" text-decoration: underline; color:#0000ff;">our wiki</span></a> for description of the settings.</p></body></html></string> + </property> + <property name="openExternalLinks"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + </item> + </layout> + </widget> <widget class="QWidget" name="tab_5"> <attribute name="title"> <string>Game detection</string> @@ -1170,12 +1683,6 @@ <tabstop>camera_yaw</tabstop> <tabstop>camera_pitch</tabstop> <tabstop>camera_roll</tabstop> - <tabstop>pos_rx</tabstop> - <tabstop>pos_ry</tabstop> - <tabstop>pos_rz</tabstop> - <tabstop>pos_tx</tabstop> - <tabstop>pos_ty</tabstop> - <tabstop>pos_tz</tabstop> <tabstop>tcomp_enable</tabstop> <tabstop>tcomp_rz</tabstop> <tabstop>src_yaw</tabstop> @@ -1191,8 +1698,27 @@ <tabstop>src_z</tabstop> <tabstop>invert_z</tabstop> </tabstops> - <resources/> + <resources> + <include location="ui-res.qrc"/> + </resources> <connections/> + <designerdata> + <property name="gridDeltaX"> + <number>5</number> + </property> + <property name="gridDeltaY"> + <number>5</number> + </property> + <property name="gridSnapX"> + <bool>true</bool> + </property> + <property name="gridSnapY"> + <bool>true</bool> + </property> + <property name="gridVisible"> + <bool>true</bool> + </property> + </designerdata> <slots> <slot>startEngineClicked()</slot> <slot>stopEngineClicked()</slot> diff --git a/facetracknoir/trackhat-wizard.ui b/facetracknoir/trackhat-wizard.ui new file mode 100644 index 00000000..7d5febaa --- /dev/null +++ b/facetracknoir/trackhat-wizard.ui @@ -0,0 +1,169 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>Form</class> + <widget class="QWidget" name="Form"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>718</width> + <height>488</height> + </rect> + </property> + <property name="windowTitle"> + <string>New configuration wizard</string> + </property> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QWizard" name="wizard"> + <property name="modal"> + <bool>true</bool> + </property> + <property name="wizardStyle"> + <enum>QWizard::AeroStyle</enum> + </property> + <property name="options"> + <set>QWizard::NoCancelButton</set> + </property> + <widget class="QWizardPage" name="page_intro"> + <property name="title"> + <string>Introduction</string> + </property> + <property name="subTitle"> + <string/> + </property> + <layout class="QGridLayout" name="gridLayout_2"> + <item row="0" column="0"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>This wizard helps you configure TrackHat hardware. Add a logo here. More placeholder text.</string> + </property> + </widget> + </item> + </layout> + </widget> + <widget class="QWizardPage" name="page_camera"> + <property name="title"> + <string>Camera setup</string> + </property> + <layout class="QGridLayout" name="gridLayout_4"> + <item row="0" column="0"> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string>Detected PS3 Eye camera. Setting it up now. A logo and some more placeholder text.</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QFrame" name="frame"> + <property name="frameShape"> + <enum>QFrame::StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <layout class="QGridLayout" name="gridLayout_3"> + <item row="0" column="0"> + <widget class="QLabel" name="label_3"> + <property name="text"> + <string>Resolution and framerate</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QComboBox" name="resolution_select"> + <item> + <property name="text"> + <string>640x480, 75 Hz</string> + </property> + </item> + <item> + <property name="text"> + <string>640x480, 60 Hz</string> + </property> + </item> + <item> + <property name="text"> + <string>320x240, 187 Hz</string> + </property> + </item> + <item> + <property name="text"> + <string>320x240, 120 Hz</string> + </property> + </item> + </widget> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + <widget class="QWizardPage" name="page_model"> + <property name="title"> + <string>Select a model</string> + </property> + <layout class="QGridLayout" name="gridLayout_6"> + <item row="0" column="0"> + <widget class="QLabel" name="label_5"> + <property name="text"> + <string>Select one of TrackHat models.</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QGroupBox" name="groupBox"> + <property name="styleSheet"> + <string notr="true">QGroupBox { border: 0; }</string> + </property> + <property name="title"> + <string/> + </property> + <layout class="QGridLayout" name="gridLayout_5"> + <item row="2" column="0"> + <widget class="QRadioButton" name="cap_model"> + <property name="text"> + <string>Cap, add a big logo</string> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QRadioButton" name="clip_model"> + <property name="text"> + <string>Clip, add a big logo</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QRadioButton" name="clip_model_left"> + <property name="text"> + <string>Clip, left-handed</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + <widget class="QWizardPage" name="page_done"> + <property name="title"> + <string>We're all done!</string> + </property> + <layout class="QGridLayout" name="gridLayout_7"> + <item row="0" column="0"> + <widget class="QLabel" name="label_6"> + <property name="text"> + <string><html><head/><body><p>You can now use your new hardware and thanks for flying TrackHat.</p></body></html></string> + </property> + </widget> + </item> + </layout> + </widget> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff --git a/ftnoir_tracker_pt/trans_calib.cpp b/facetracknoir/trans_calib.cpp index 2994eb48..2994eb48 100644 --- a/ftnoir_tracker_pt/trans_calib.cpp +++ b/facetracknoir/trans_calib.cpp diff --git a/ftnoir_tracker_pt/trans_calib.h b/facetracknoir/trans_calib.h index e20fc767..e20fc767 100644 --- a/ftnoir_tracker_pt/trans_calib.h +++ b/facetracknoir/trans_calib.h diff --git a/facetracknoir/ui-res.qrc b/facetracknoir/ui-res.qrc index 030a6153..b251ab8f 100644 --- a/facetracknoir/ui-res.qrc +++ b/facetracknoir/ui-res.qrc @@ -6,5 +6,7 @@ <file>images/facetracknoir.png</file> <file>images/no-feed.png</file> <file>images/filter-16.png</file> + <file>images/trackhat-cap.png</file> + <file>images/trackhat-clip.png</file> </qresource> </RCC> diff --git a/facetracknoir/ui.cpp b/facetracknoir/ui.cpp index 7a412bdb..405c516a 100644 --- a/facetracknoir/ui.cpp +++ b/facetracknoir/ui.cpp @@ -24,6 +24,8 @@ #include "ui.h" #include "opentrack/tracker.h" #include "opentrack/options.hpp" +#include "ftnoir_tracker_pt/ftnoir_tracker_pt.h" +#include "ftnoir_filter_accela/ftnoir_filter_accela.h" #include <QFileDialog> #include <QFileInfo> @@ -51,26 +53,14 @@ MainWindow::MainWindow() : connect(ui.btnEditCurves, SIGNAL(clicked()), this, SLOT(showCurveConfiguration())); connect(ui.btnShortcuts, SIGNAL(clicked()), this, SLOT(showKeyboardShortcuts())); - connect(ui.btnShowEngineControls, SIGNAL(clicked()), this, SLOT(showTrackerSettings())); connect(ui.btnShowServerControls, SIGNAL(clicked()), this, SLOT(showProtocolSettings())); - connect(ui.btnShowFilterControls, SIGNAL(clicked()), this, SLOT(showFilterSettings())); - - modules.filters().push_front(std::make_shared<dylib>("", dylib::Filter)); - - for (auto x : modules.trackers()) - ui.iconcomboTrackerSource->addItem(x->icon, x->name); for (auto x : modules.protocols()) ui.iconcomboProtocol->addItem(x->icon, x->name); - for (auto x : modules.filters()) - ui.iconcomboFilter->addItem(x->icon, x->name); - fill_profile_combobox(); - tie_setting(s.tracker_dll, ui.iconcomboTrackerSource); tie_setting(s.protocol_dll, ui.iconcomboProtocol); - tie_setting(s.filter_dll, ui.iconcomboFilter); connect(ui.btnStartTracker, SIGNAL(clicked()), this, SLOT(startTracker())); connect(ui.btnStopTracker, SIGNAL(clicked()), this, SLOT(stopTracker())); @@ -184,7 +174,7 @@ void MainWindow::fill_profile_combobox() { QStringList ini_list = group::ini_list(); QString current = QFileInfo(group::ini_pathname()).fileName(); - setWindowTitle(QString( const_cast<const char*>(opentrack_version) + QStringLiteral(" :: ")) + current); + setWindowTitle(QStringLiteral("TrackHat ") + QString( const_cast<const char*>(opentrack_version) + QStringLiteral(" :: ")) + current); ui.iconcomboProfile->clear(); for (auto x : ini_list) ui.iconcomboProfile->addItem(QIcon(":/images/settings16.png"), x); @@ -198,8 +188,6 @@ void MainWindow::updateButtonState(bool running, bool inertialp) ui.btnStartTracker->setEnabled ( not_running ); ui.btnStopTracker->setEnabled ( running ); ui.iconcomboProtocol->setEnabled ( not_running ); - ui.iconcomboFilter->setEnabled ( not_running ); - ui.iconcomboTrackerSource->setEnabled(not_running); ui.video_frame_label->setVisible(not_running || inertialp); ui.btnSaveAs->setEnabled(not_running); ui.btnLoad->setEnabled(not_running); @@ -219,7 +207,7 @@ void MainWindow::startTracker() { // tracker dtor needs run first work = nullptr; - libs = SelectedLibraries(ui.video_frame, current_tracker(), current_protocol(), current_filter()); + libs = SelectedLibraries(ui.video_frame, std::make_shared<Tracker_PT>(), current_protocol(), std::make_shared<FTNoIR_Filter>()); { double p[6] = {0,0,0, 0,0,0}; @@ -240,12 +228,6 @@ void MainWindow::startTracker() { bindKeyboardShortcuts(); - if (pTrackerDialog) - pTrackerDialog->register_tracker(libs.pTracker.get()); - - if (pFilterDialog) - pFilterDialog->register_filter(libs.pFilter.get()); - if (pProtocolDialog) pProtocolDialog->register_protocol(libs.pProtocol.get()); @@ -263,24 +245,12 @@ void MainWindow::stopTracker( ) { pose_update_timer.stop(); ui.pose_display->rotateBy(0, 0, 0, 0, 0, 0); - if (pTrackerDialog) - { - pTrackerDialog->unregister_tracker(); - pTrackerDialog = nullptr; - } - if (pProtocolDialog) { pProtocolDialog->unregister_protocol(); pProtocolDialog = nullptr; } - if (pFilterDialog) - { - pFilterDialog->unregister_filter(); - pFilterDialog = nullptr; - } - work = nullptr; libs = SelectedLibraries(); @@ -364,23 +334,10 @@ bool mk_dialog(mem<dylib> lib, mem<t>* orig) return false; } - -void MainWindow::showTrackerSettings() -{ - if (mk_dialog(current_tracker(), &pTrackerDialog) && libs.pTracker) - pTrackerDialog->register_tracker(libs.pTracker.get()); -} - void MainWindow::showProtocolSettings() { if (mk_dialog(current_protocol(), &pProtocolDialog) && libs.pProtocol) pProtocolDialog->register_protocol(libs.pProtocol.get()); } - -void MainWindow::showFilterSettings() { - if (mk_dialog(current_filter(), &pFilterDialog) && libs.pFilter) - pFilterDialog->register_filter(libs.pFilter.get()); -} - template<typename t, typename... Args> bool mk_window(mem<t>* place, Args... params) { @@ -401,7 +358,7 @@ bool mk_window(mem<t>* place, Args... params) } void MainWindow::showKeyboardShortcuts() { - if (mk_window(&shortcuts_widget)) + if (mk_window<OptionsDialog, State&>(&shortcuts_widget, *this)) connect(shortcuts_widget.get(), SIGNAL(reload()), this, SLOT(bindKeyboardShortcuts())); } diff --git a/facetracknoir/ui.h b/facetracknoir/ui.h index f2758d81..1a4ce5cb 100644 --- a/facetracknoir/ui.h +++ b/facetracknoir/ui.h @@ -71,23 +71,13 @@ class MainWindow : public QMainWindow, private State mem<MapWidget> mapping_widget; QShortcut kbd_quit; QPixmap no_feed_pixmap; - mem<IFilterDialog> pFilterDialog; mem<IProtocolDialog> pProtocolDialog; - mem<ITrackerDialog> pTrackerDialog; process_detector_worker det; - mem<dylib> current_tracker() - { - return modules.trackers().value(ui.iconcomboTrackerSource->currentIndex(), nullptr); - } mem<dylib> current_protocol() { return modules.protocols().value(ui.iconcomboProtocol->currentIndex(), nullptr); } - mem<dylib> current_filter() - { - return modules.filters().value(ui.iconcomboFilter->currentIndex(), nullptr); - } void changeEvent(QEvent* e) override; @@ -109,9 +99,7 @@ private slots: void exit(); void profileSelected(int index); - void showTrackerSettings(); void showProtocolSettings(); - void showFilterSettings(); void showKeyboardShortcuts(); void showCurveConfiguration(); void showHeadPose(); diff --git a/facetracknoir/wizard.cpp b/facetracknoir/wizard.cpp new file mode 100644 index 00000000..2ce81689 --- /dev/null +++ b/facetracknoir/wizard.cpp @@ -0,0 +1,6 @@ +#include "wizard.h" + +Wizard::Wizard(QWidget* parent = nullptr) : QWizard(parent) +{ + ui.setupUi(this); +} diff --git a/facetracknoir/wizard.h b/facetracknoir/wizard.h new file mode 100644 index 00000000..bf135f80 --- /dev/null +++ b/facetracknoir/wizard.h @@ -0,0 +1,18 @@ +#pragma once + +#include "opentrack/options.hpp" +#include "opentrack/main-settings.hpp" +#include "opentrack/mappings.hpp" +#include "ui_trackhat-wizard.h" +#include "ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h" +#include <QWizard> + +class Wizard : public QWizard +{ + Q_OBJECT + Ui_Form ui; + settings_pt pt; + main_settings s; +public: + Wizard(QWidget* parent); +}; diff --git a/ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui b/ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui deleted file mode 100644 index 2387723a..00000000 --- a/ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui +++ /dev/null @@ -1,295 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>AccelaUICFilterControls</class> - <widget class="QWidget" name="AccelaUICFilterControls"> - <property name="windowModality"> - <enum>Qt::NonModal</enum> - </property> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>501</width> - <height>358</height> - </rect> - </property> - <property name="windowTitle"> - <string>Accela filter settings</string> - </property> - <property name="windowIcon"> - <iconset resource="../facetracknoir/ui-res.qrc"> - <normaloff>:/images/filter-16.png</normaloff>:/images/filter-16.png</iconset> - </property> - <layout class="QGridLayout" name="gridLayout"> - <item row="0" column="0"> - <widget class="QFrame" name="frame"> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <layout class="QGridLayout" name="gridLayout_3"> - <item row="1" column="3"> - <widget class="QSlider" name="rotation_slider"> - <property name="maximum"> - <number>99</number> - </property> - <property name="pageStep"> - <number>5</number> - </property> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="tickPosition"> - <enum>QSlider::TicksAbove</enum> - </property> - <property name="tickInterval"> - <number>25</number> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="lblSensYaw_6"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Rotation sensitivity</string> - </property> - </widget> - </item> - <item row="0" column="0"> - <widget class="QLabel" name="label_2"> - <property name="text"> - <string>Smoothing</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLabel" name="ewma_label"> - <property name="minimumSize"> - <size> - <width>48</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>0 ms</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QLabel" name="rot_gain"> - <property name="text"> - <string>0°</string> - </property> - </widget> - </item> - <item row="0" column="3"> - <widget class="QSlider" name="ewma_slider"> - <property name="maximum"> - <number>100</number> - </property> - <property name="singleStep"> - <number>10</number> - </property> - <property name="pageStep"> - <number>25</number> - </property> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="tickPosition"> - <enum>QSlider::TicksAbove</enum> - </property> - <property name="tickInterval"> - <number>25</number> - </property> - </widget> - </item> - <item row="6" column="0"> - <widget class="QLabel" name="label_6"> - <property name="text"> - <string>Translation deadzone</string> - </property> - </widget> - </item> - <item row="4" column="0"> - <widget class="QLabel" name="label_4"> - <property name="text"> - <string>Rotation deadzone</string> - </property> - </widget> - </item> - <item row="4" column="3"> - <widget class="QSlider" name="rot_dz_slider"> - <property name="maximum"> - <number>100</number> - </property> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - <item row="4" column="1"> - <widget class="QLabel" name="rot_dz"> - <property name="text"> - <string>0°</string> - </property> - </widget> - </item> - <item row="6" column="3"> - <widget class="QSlider" name="trans_dz_slider"> - <property name="maximum"> - <number>100</number> - </property> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - <item row="6" column="1"> - <widget class="QLabel" name="trans_dz"> - <property name="text"> - <string>0mm</string> - </property> - </widget> - </item> - <item row="5" column="0"> - <widget class="QLabel" name="label"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Translation sensitivity</string> - </property> - </widget> - </item> - <item row="5" column="1"> - <widget class="QLabel" name="trans_gain"> - <property name="text"> - <string>0mm</string> - </property> - </widget> - </item> - <item row="5" column="3"> - <widget class="QSlider" name="translation_slider"> - <property name="maximum"> - <number>99</number> - </property> - <property name="pageStep"> - <number>5</number> - </property> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="tickPosition"> - <enum>QSlider::TicksAbove</enum> - </property> - <property name="tickInterval"> - <number>25</number> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item row="3" column="0"> - <widget class="QDialogButtonBox" name="buttonBox"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="standardButtons"> - <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QGroupBox" name="groupBox"> - <property name="title"> - <string>GroupBox</string> - </property> - <layout class="QGridLayout" name="gridLayout_2"> - <item row="0" column="1"> - <widget class="QLabel" name="label_9"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="font"> - <font> - <pointsize>7</pointsize> - </font> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="text"> - <string><html><head/><body><p align="justify"><br/><span style=" font-size:10pt;">Accela by </span><a href="https://github.com/sthalik"><span style=" font-size:10pt; text-decoration: underline; color:#0057ae;">Stanisław Halik</span></a><span style=" font-size:10pt;"><br/>Thanks to </span><a href="https://github.com/dbaarda"><span style=" font-size:10pt; text-decoration: underline; color:#0057ae;">Donovan Baarda</span></a></p><p align="right"><span style=" font-size:10pt;">2012-2015</span></p><p align="right"><br/></p></body></html></string> - </property> - <property name="textFormat"> - <enum>Qt::RichText</enum> - </property> - <property name="scaledContents"> - <bool>false</bool> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - <property name="wordWrap"> - <bool>true</bool> - </property> - <property name="margin"> - <number>0</number> - </property> - <property name="indent"> - <number>0</number> - </property> - <property name="openExternalLinks"> - <bool>true</bool> - </property> - <property name="textInteractionFlags"> - <set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set> - </property> - </widget> - </item> - <item row="0" column="0"> - <widget class="QLabel" name="label_3"> - <property name="text"> - <string><html><head/><body><p>Visit <a href="https://github.com/opentrack/opentrack/wiki/Accela-in-opentrack-2.3"><span style=" text-decoration: underline; color:#0000ff;">our wiki</span></a> for description of the settings.</p></body></html></string> - </property> - <property name="openExternalLinks"> - <bool>true</bool> - </property> - </widget> - </item> - </layout> - </widget> - </item> - </layout> - </widget> - <tabstops> - <tabstop>buttonBox</tabstop> - </tabstops> - <resources> - <include location="../facetracknoir/ui-res.qrc"/> - </resources> - <connections/> - <slots> - <slot>startEngineClicked()</slot> - <slot>stopEngineClicked()</slot> - <slot>cameraSettingsClicked()</slot> - </slots> -</ui> diff --git a/ftnoir_filter_accela/ftnoir_filter_accela.cpp b/ftnoir_filter_accela/ftnoir_filter_accela.cpp index 4d5f4a28..acb9e4ac 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela.cpp +++ b/ftnoir_filter_accela/ftnoir_filter_accela.cpp @@ -104,12 +104,3 @@ void FTNoIR_Filter::filter(const double* input, double *output) } } -extern "C" OPENTRACK_EXPORT IFilter* GetConstructor() -{ - return new FTNoIR_Filter; -} - -extern "C" OPENTRACK_EXPORT Metadata* GetMetadata() -{ - return new FTNoIR_FilterDll; -} diff --git a/ftnoir_filter_accela/ftnoir_filter_accela.h b/ftnoir_filter_accela/ftnoir_filter_accela.h index e45af03a..e2b29ee4 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela.h +++ b/ftnoir_filter_accela/ftnoir_filter_accela.h @@ -1,5 +1,4 @@ #pragma once -#include "ui_ftnoir_accela_filtercontrols.h" #include "opentrack/plugin-api.hpp" #include "qfunctionconfigurator/functionconfig.h" #include <atomic> @@ -10,9 +9,9 @@ using namespace options; #include "opentrack/timer.hpp" -struct settings : opts { +struct settings_accela : opts { value<int> rot_threshold, trans_threshold, ewma, rot_deadzone, trans_deadzone; - settings() : + settings_accela() : opts("Accela"), rot_threshold(b, "rotation-threshold", 30), trans_threshold(b, "translation-threshold", 50), @@ -29,39 +28,9 @@ public: void filter(const double* input, double *output); Map rot, trans; private: - settings s; + settings_accela s; bool first_run; double last_output[6]; double smoothed_input[6]; Timer t; }; - -class FilterControls: public IFilterDialog -{ - Q_OBJECT -public: - FilterControls(); - void register_filter(IFilter* filter); - void unregister_filter(); -private: - Ui::AccelaUICFilterControls ui; - void discard(); - void save(); - FTNoIR_Filter* accela_filter; - settings s; -private slots: - void doOK(); - void doCancel(); - void update_ewma_display(int value); - void update_rot_display(int value); - void update_trans_display(int value); - void update_rot_dz_display(int value); - void update_trans_dz_display(int value); -}; - -class FTNoIR_FilterDll : public Metadata -{ -public: - QString name() { return QString("Accela"); } - QIcon icon() { return QIcon(":/images/filter-16.png"); } -}; diff --git a/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp b/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp deleted file mode 100644 index 52c8318a..00000000 --- a/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp +++ /dev/null @@ -1,91 +0,0 @@ -#include "ftnoir_filter_accela/ftnoir_filter_accela.h" -#include <cmath> -#include <QDebug> -#include <algorithm> -#include <QDoubleSpinBox> -#include "opentrack/plugin-api.hpp" - -FilterControls::FilterControls() : - accela_filter(nullptr) -{ - ui.setupUi( this ); - connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); - connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); - - connect(ui.rotation_slider, SIGNAL(valueChanged(int)), this, SLOT(update_rot_display(int))); - connect(ui.translation_slider, SIGNAL(valueChanged(int)), this, SLOT(update_trans_display(int))); - connect(ui.ewma_slider, SIGNAL(valueChanged(int)), this, SLOT(update_ewma_display(int))); - connect(ui.rot_dz_slider, SIGNAL(valueChanged(int)), this, SLOT(update_rot_dz_display(int))); - connect(ui.trans_dz_slider, SIGNAL(valueChanged(int)), this, SLOT(update_trans_dz_display(int))); - - tie_setting(s.rot_threshold, ui.rotation_slider); - tie_setting(s.trans_threshold, ui.translation_slider); - tie_setting(s.ewma, ui.ewma_slider); - tie_setting(s.rot_deadzone, ui.rot_dz_slider); - tie_setting(s.trans_deadzone, ui.trans_dz_slider); - - update_rot_display(ui.rotation_slider->value()); - update_trans_display(ui.translation_slider->value()); - update_ewma_display(ui.ewma_slider->value()); - update_rot_dz_display(ui.rot_dz_slider->value()); - update_trans_dz_display(ui.trans_dz_slider->value()); -} - -void FilterControls::register_filter(IFilter* filter) -{ - accela_filter = static_cast<FTNoIR_Filter*>(filter); -} - -void FilterControls::unregister_filter() -{ - accela_filter = nullptr; -} - -void FilterControls::doOK() { - save(); - this->close(); -} - -void FilterControls::doCancel() { - discard(); - close(); -} - -void FilterControls::discard() -{ - s.b->reload(); -} - -void FilterControls::save() { - s.b->save(); -} - -void FilterControls::update_rot_display(int value) -{ - ui.rot_gain->setText(QString::number((value + 1) * 10 / 100.) + "°"); -} - -void FilterControls::update_trans_display(int value) -{ - ui.trans_gain->setText(QString::number((value + 1) * 5 / 100.) + "mm"); -} - -void FilterControls::update_ewma_display(int value) -{ - ui.ewma_label->setText(QString::number(value * 2) + "ms"); -} - -void FilterControls::update_rot_dz_display(int value) -{ - ui.rot_dz->setText(QString::number(value * 2 / 100.) + "°"); -} - -void FilterControls::update_trans_dz_display(int value) -{ - ui.trans_dz->setText(QString::number(value * 1 / 100.) + "mm"); -} - -extern "C" OPENTRACK_EXPORT IFilterDialog* GetDialog() -{ - return new FilterControls; -} diff --git a/ftnoir_tracker_pt/FTNoIR_PT_Controls.ui b/ftnoir_tracker_pt/FTNoIR_PT_Controls.ui deleted file mode 100644 index 3e900e8e..00000000 --- a/ftnoir_tracker_pt/FTNoIR_PT_Controls.ui +++ /dev/null @@ -1,1186 +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>405</width> - <height>593</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>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="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="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="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="1"> - <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="2" 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="2" column="1"> - <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> - </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="QLabel" name="label_59"> - <property name="text"> - <string><html><head/><body><p>Only pitch and yaw during calibration.</p><p>Don't roll and don't translate.</p></body></html></string> - </property> - </widget> - </item> - <item row="2" column="1"> - <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> - <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> - <tabstop>tcalib_button</tabstop> - </tabstops> - <resources> - <include location="ftnoir_tracker_pt.qrc"/> - </resources> - <connections/> - <slots> - <slot>startEngineClicked()</slot> - <slot>stopEngineClicked()</slot> - <slot>cameraSettingsClicked()</slot> - </slots> -</ui> diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp index dc0659e5..d48f9252 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp @@ -55,7 +55,19 @@ void Tracker_PT::reset_command(Command command) float Tracker_PT::get_focal_length() { static constexpr float pi = 3.1415926f; - const float fov = static_cast<int>(s.fov) * pi / 180.f; + float fov_; + switch (s.fov) + { + default: + case 0: + fov_ = 56; + break; + case 1: + fov_ = 75; + break; + } + + const float fov = static_cast<int>(fov_) * pi / 180.f; return 0.5f / tan(0.5f * fov); } @@ -140,9 +152,35 @@ void Tracker_PT::apply_settings() qDebug()<<"Tracker:: Applying settings"; QMutexLocker l(&camera_mtx); QMutexLocker lock(&mutex); - 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()<<"Tracker::apply ends"; } @@ -208,14 +246,3 @@ void Tracker_PT::data(THeadPoseData *data) data[TZ] = t[2] / 10.0; } } - -//----------------------------------------------------------------------------- -#ifdef OPENTRACK_API -extern "C" OPENTRACK_EXPORT ITracker* GetConstructor() -#else -#pragma comment(linker, "/export:GetTracker=_GetTracker@0") -OPENTRACK_EXPORT ITrackerPtr __stdcall GetTracker() -#endif -{ - return new Tracker_PT; -} diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt.qrc b/ftnoir_tracker_pt/ftnoir_tracker_pt.qrc deleted file mode 100644 index a8f9a1af..00000000 --- a/ftnoir_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/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp b/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp deleted file mode 100644 index 5b17df5b..00000000 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp +++ /dev/null @@ -1,196 +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 "ftnoir_tracker_pt_dialog.h" - -#include <QMessageBox> -#include <QDebug> -#include <opencv2/core/core.hpp> -#ifndef OPENTRACK_API -# include <boost/shared_ptr.hpp> -#else -# include <memory> -# include "opentrack/camera-names.hpp" -#endif -#include <vector> - -using namespace std; - -//----------------------------------------------------------------------------- -TrackerDialog_PT::TrackerDialog_PT() - : tracker(NULL), - timer(this), - trans_calib_running(false) -{ - ui.setupUi( this ); - -#ifdef OPENTRACK_API - ui.camdevice_combo->addItems(get_camera_names()); -#else - vector<string> device_names; - get_camera_device_names(device_names); - for (vector<string>::iterator iter = device_names.begin(); iter != device_names.end(); ++iter) - { - ui.camdevice_combo->addItem(iter->c_str()); - } -#endif - - 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); - - 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() -{ - open_camera_settings(tracker ? &static_cast<cv::VideoCapture&>(tracker->camera) : nullptr, s.camera_name, tracker ? &tracker->camera_mtx : 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() -{ - if (tracker) - { - QString to_print; - - // display caminfo - CamInfo info; - tracker->get_cam_info(&info); - 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 - { - QString to_print = "Tracker offline"; - ui.caminfo_label->setText(to_print); - ui.pointinfo_label->setText(to_print); - } -} - -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); -} - -extern "C" OPENTRACK_EXPORT ITrackerDialog* GetDialog( ) -{ - return new TrackerDialog_PT; -} diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.h b/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.h deleted file mode 100644 index 7e75d2a4..00000000 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.h +++ /dev/null @@ -1,55 +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 - -#ifdef OPENTRACK_API -# include "opentrack/plugin-api.hpp" -#else -#include "..\ftnoir_tracker_base\ftnoir_tracker_base.h" -#endif -#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/ftnoir_tracker_pt/ftnoir_tracker_pt_dll.cpp b/ftnoir_tracker_pt/ftnoir_tracker_pt_dll.cpp deleted file mode 100644 index 1aaa1bf9..00000000 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt_dll.cpp +++ /dev/null @@ -1,20 +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 "ftnoir_tracker_pt_dll.h" -#include <QIcon> - -#ifdef OPENTRACK_API -# include "opentrack/plugin-api.hpp" -extern "C" OPENTRACK_EXPORT Metadata* GetMetadata() -#else -# pragma comment(linker, "/export:GetTrackerDll=_GetTrackerDll@0") -OPENTRACK_EXPORT ITrackerDllPtr __stdcall GetTrackerDll() -#endif -{ - return new TrackerDll; -} diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt_dll.h b/ftnoir_tracker_pt/ftnoir_tracker_pt_dll.h deleted file mode 100644 index 9579d46c..00000000 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt_dll.h +++ /dev/null @@ -1,24 +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. - */ - -#if defined(OPENTRACK_API) -# include "opentrack/plugin-api.hpp" -#else -# include "../ftnoir_tracker_base/ftnoir_tracker_base.h" -#endif - -//----------------------------------------------------------------------------- -class TrackerDll : -#if defined(OPENTRACK_API) - public Metadata -#else - public ITrackerDll -#endif -{ - QString name() { return QString("PointTracker 1.1"); } - QIcon icon() { return QIcon(":/Resources/Logo_IR.png"); } -}; diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h b/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h index af2f5978..00346267 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h @@ -13,54 +13,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, 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; 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", 10), 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) {} diff --git a/ftnoir_tracker_pt/point_tracker.h b/ftnoir_tracker_pt/point_tracker.h index 7c710704..49ff577e 100644 --- a/ftnoir_tracker_pt/point_tracker.h +++ b/ftnoir_tracker_pt/point_tracker.h @@ -69,8 +69,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) { @@ -85,26 +83,25 @@ public: float s22 = M02.dot(M02); P = 1.0/(s11*s22-s12*s12) * cv::Matx22f(s22, -s12, -s12, s11); } - + + enum { Cap = 0, Clip = 1 }; + void set_model(settings_pt& s) { - switch (s.active_model_panel) + if (s.model_used == Cap) { - 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; - 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)); - 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); - break; + const double z = 100, x = 120, y = 60; + M01 = cv::Vec3f(-x, -y, -z); + M02 = cv::Vec3f(x, -y, -z); + } + else + { + const double a = 27, b = 43, c = 62, d = 74; + M01 = cv::Vec3f(0, b, -a); + M02 = cv::Vec3f(0, -c, -d); } } - + void get_d_order(const std::vector<cv::Vec2f>& points, int* d_order, cv::Vec2f d) const; }; diff --git a/opentrack/main-settings.hpp b/opentrack/main-settings.hpp index 250d4563..d3a49a83 100644 --- a/opentrack/main-settings.hpp +++ b/opentrack/main-settings.hpp @@ -7,11 +7,9 @@ using namespace options; struct axis_opts { - value<double> zero; value<bool> invert, altp; value<int> src; axis_opts(pbundle b, QString pfx, int idx) : - zero(b, n(pfx, "zero-pos"), 0), invert(b, n(pfx, "invert-sign"), false), altp(b, n(pfx, "alt-axis-sign"), false), src(b, n(pfx, "source-index"), idx) @@ -23,16 +21,14 @@ private: }; struct main_settings : opts { - value<QString> tracker_dll, filter_dll, protocol_dll; + value<QString> protocol_dll; axis_opts a_x, a_y, a_z, a_yaw, a_pitch, a_roll; value<bool> tcomp_p, tcomp_tz; value<bool> tray_enabled; value<int> camera_yaw, camera_pitch, camera_roll; - value<bool> center_at_startup; + value<bool> center_at_startup, wizard_done; main_settings() : opts("opentrack-ui"), - tracker_dll(b, "tracker-dll", ""), - filter_dll(b, "filter-dll", ""), protocol_dll(b, "protocol-dll", ""), a_x(b, "x", TX), a_y(b, "y", TY), @@ -46,6 +42,7 @@ struct main_settings : opts { camera_yaw(b, "camera-yaw", 0), camera_pitch(b, "camera-pitch", 0), camera_roll(b, "camera-roll", 0), - center_at_startup(b, "center-at-startup", true) + center_at_startup(b, "center-at-startup", true), + wizard_done(b, "wizard-done", false) {} }; diff --git a/opentrack/options.hpp b/opentrack/options.hpp index f4deb8a1..9768bc43 100644 --- a/opentrack/options.hpp +++ b/opentrack/options.hpp @@ -40,7 +40,7 @@ template<typename t> using mem = std::shared_ptr<t>; #define OPENTRACK_CONFIG_FILENAME_KEY "settings-file" #define OPENTRACK_DEFAULT_CONFIG_PATH "/settings/default.ini" -#define OPENTRACK_ORG "opentrack-2.3" +#define OPENTRACK_ORG "TrackHat opentrack-2.3" namespace options { template<typename k, typename v> diff --git a/opentrack/plugin-support.hpp b/opentrack/plugin-support.hpp index ec8bb3c8..78443cae 100644 --- a/opentrack/plugin-support.hpp +++ b/opentrack/plugin-support.hpp @@ -52,7 +52,7 @@ extern "C" typedef void* (*OPENTRACK_CTOR_FUNPTR)(void); extern "C" typedef Metadata* (*OPENTRACK_METADATA_FUNPTR)(void); struct dylib { - enum Type { Filter, Tracker, Protocol }; + enum Type { Protocol }; dylib(const QString& filename, Type t) : type(t), @@ -161,17 +161,14 @@ struct dylib { static QList<mem<dylib>> enum_libraries() { - const char* filters_n[] = { "opentrack-filter-*.", - "opentrack-tracker-*.", - "opentrack-proto-*." - }; - const Type filters_t[] = { Filter, Tracker, Protocol }; + const char* filters_n[] = { "opentrack-proto-*." }; + const Type filters_t[] = { Protocol }; QDir settingsDir( QCoreApplication::applicationDirPath() ); QList<mem<dylib>> ret; - for (int i = 0; i < 3; i++) + for (int i = 0; i < 1; i++) { QString filter = filters_n[i]; auto t = filters_t[i]; @@ -225,8 +222,6 @@ private: struct Modules { Modules() : module_list(dylib::enum_libraries()), - filter_modules(filter(dylib::Filter)), - tracker_modules(filter(dylib::Tracker)), protocol_modules(filter(dylib::Protocol)) {} QList<mem<dylib>>& filters() { return filter_modules; } diff --git a/opentrack/selected-libraries.cpp b/opentrack/selected-libraries.cpp index c39ee3f5..630b7db2 100644 --- a/opentrack/selected-libraries.cpp +++ b/opentrack/selected-libraries.cpp @@ -5,33 +5,25 @@ SelectedLibraries::~SelectedLibraries() { } -SelectedLibraries::SelectedLibraries(QFrame* frame, dylibptr t, dylibptr p, dylibptr f) : +SelectedLibraries::SelectedLibraries(QFrame* frame, mem<ITracker> t, dylibptr p, mem<IFilter> f) : pTracker(nullptr), pFilter(nullptr), pProtocol(nullptr), correct(false) { + pTracker = t; pProtocol = make_dylib_instance<IProtocol>(p); + pFilter = f; - if (!pProtocol) + if (!pTracker || !pProtocol) { - qDebug() << "protocol dylib load failure"; + qDebug() << "dylib load failure"; return; } if(!pProtocol->correct()) { qDebug() << "protocol load failure"; - pProtocol = nullptr; - return; - } - - pTracker = make_dylib_instance<ITracker>(t); - pFilter = make_dylib_instance<IFilter>(f); - - if (!pTracker) - { - qDebug() << "tracker dylib load failure"; return; } diff --git a/opentrack/selected-libraries.hpp b/opentrack/selected-libraries.hpp index 2813cd27..547f5f54 100644 --- a/opentrack/selected-libraries.hpp +++ b/opentrack/selected-libraries.hpp @@ -16,7 +16,7 @@ struct SelectedLibraries { mem<ITracker> pTracker; mem<IFilter> pFilter; mem<IProtocol> pProtocol; - SelectedLibraries(QFrame* frame, dylibptr t, dylibptr p, dylibptr f); + SelectedLibraries(QFrame* frame, mem<ITracker> t, dylibptr p, mem<IFilter> f); SelectedLibraries() : pTracker(nullptr), pFilter(nullptr), pProtocol(nullptr), correct(false) {} ~SelectedLibraries(); bool correct; diff --git a/opentrack/tracker.cpp b/opentrack/tracker.cpp index fae0e8a2..502f7a96 100644 --- a/opentrack/tracker.cpp +++ b/opentrack/tracker.cpp @@ -47,7 +47,7 @@ double Tracker::map(double pos, Mapping& axis) axis.curve.setTrackingActive( !altp ); axis.curveAlt.setTrackingActive( altp ); auto& fc = altp ? axis.curveAlt : axis.curve; - return fc.getValue(pos) + axis.opts.zero; + return fc.getValue(pos); } void Tracker::t_compensate(const rmat& rmat, const double* xyz, double* output, bool rz) |