diff options
-rw-r--r-- | facetracknoir/tracker.cpp | 11 | ||||
-rw-r--r-- | ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui | 159 | ||||
-rw-r--r-- | ftnoir_filter_accela/ftnoir_filter_accela.cpp | 11 | ||||
-rw-r--r-- | ftnoir_filter_accela/ftnoir_filter_accela.h | 5 | ||||
-rw-r--r-- | ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp | 4 | ||||
-rw-r--r-- | ftnoir_filter_base/ftnoir_filter_base.h | 2 | ||||
-rw-r--r-- | ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp | 3 | ||||
-rw-r--r-- | ftnoir_filter_ewma2/ftnoir_filter_ewma2.h | 2 | ||||
-rw-r--r-- | ftnoir_filter_kalman/ftnoir_filter_kalman.h | 3 | ||||
-rw-r--r-- | ftnoir_filter_kalman/kalman.cpp | 3 |
10 files changed, 60 insertions, 143 deletions
diff --git a/facetracknoir/tracker.cpp b/facetracknoir/tracker.cpp index dfe71f28..fbf90a66 100644 --- a/facetracknoir/tracker.cpp +++ b/facetracknoir/tracker.cpp @@ -85,11 +85,9 @@ static void t_compensate(double* input, double* output) /** QThread run method @override **/
void Tracker::run() {
- T6DOF offset_camera, gameoutput_camera;
+ T6DOF offset_camera;
double newpose[6] = {0};
- double last_post_filter[6] ;
-
int sleep_ms = 15;
if (Libraries->pTracker)
@@ -144,9 +142,7 @@ void Tracker::run() { }
if (Libraries->pFilter) {
- for (int i = 0; i < 6; i++)
- last_post_filter[i] = gameoutput_camera.axes[i];
- Libraries->pFilter->FilterHeadPoseData(target_camera2.axes, new_camera.axes, last_post_filter);
+ Libraries->pFilter->FilterHeadPoseData(target_camera2.axes, new_camera.axes);
} else {
new_camera = target_camera2;
}
@@ -159,8 +155,7 @@ void Tracker::run() { t_compensate(output_camera.axes, output_camera.axes);
if (Libraries->pProtocol) {
- gameoutput_camera = output_camera;
- Libraries->pProtocol->sendHeadposeToGame( gameoutput_camera.axes ); // degrees & centimeters
+ Libraries->pProtocol->sendHeadposeToGame( output_camera.axes ); // degrees & centimeters
}
}
diff --git a/ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui b/ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui index b48496bf..fb6a9565 100644 --- a/ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui +++ b/ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui @@ -78,6 +78,9 @@ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> </property> <layout class="QFormLayout" name="formLayout_2"> + <property name="fieldGrowthPolicy"> + <enum>QFormLayout::ExpandingFieldsGrow</enum> + </property> <item row="0" column="0"> <widget class="QLabel" name="label_2"> <property name="sizePolicy"> @@ -160,76 +163,77 @@ </property> </widget> </item> - <item row="4" column="0"> - <widget class="QLabel" name="lblSensYaw_5"> + <item row="2" column="0"> + <widget class="QLabel" name="label_11"> + <property name="text"> + <string>Order #2</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QDoubleSpinBox" name="order_2nd"> <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Expanding"> + <sizepolicy hsizetype="Expanding" vsizetype="Maximum"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="minimumSize"> - <size> - <width>25</width> - <height>0</height> - </size> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> </property> - <property name="maximumSize"> - <size> - <width>150</width> - <height>16777215</height> - </size> + <property name="correctionMode"> + <enum>QAbstractSpinBox::CorrectToPreviousValue</enum> </property> - <property name="styleSheet"> - <string notr="true">color:#0; -background:none;</string> + <property name="decimals"> + <number>4</number> + </property> + <property name="minimum"> + <double>0.100000000000000</double> </property> + <property name="maximum"> + <double>65535.000000000000000</double> + </property> + <property name="value"> + <double>1.000000000000000</double> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="label_12"> <property name="text"> - <string>Zoomed</string> + <string>Order #3</string> </property> </widget> </item> - <item row="4" column="1"> - <widget class="QSpinBox" name="spinZoom"> + <item row="3" column="1"> + <widget class="QDoubleSpinBox" name="order_3rd"> <property name="sizePolicy"> <sizepolicy hsizetype="Expanding" vsizetype="Maximum"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="minimumSize"> - <size> - <width>20</width> - <height>22</height> - </size> - </property> - <property name="styleSheet"> - <string notr="true">background:none;</string> - </property> <property name="alignment"> <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> </property> - <property name="readOnly"> - <bool>false</bool> + <property name="correctionMode"> + <enum>QAbstractSpinBox::CorrectToPreviousValue</enum> </property> - <property name="suffix"> - <string>%</string> + <property name="decimals"> + <number>4</number> </property> <property name="minimum"> - <number>0</number> + <double>0.100000000000000</double> </property> <property name="maximum"> - <number>200</number> - </property> - <property name="singleStep"> - <number>1</number> + <double>65535.000000000000000</double> </property> <property name="value"> - <number>45</number> + <double>1.000000000000000</double> </property> </widget> </item> - <item row="5" column="0"> + <item row="4" column="0"> <widget class="QLabel" name="lblSensYaw_6"> <property name="sizePolicy"> <sizepolicy hsizetype="Fixed" vsizetype="Expanding"> @@ -258,7 +262,7 @@ background:none;</string> </property> </widget> </item> - <item row="5" column="1"> + <item row="4" column="1"> <widget class="QDoubleSpinBox" name="deadzone"> <property name="sizePolicy"> <sizepolicy hsizetype="Expanding" vsizetype="Maximum"> @@ -286,14 +290,14 @@ background:none;</string> </property> </widget> </item> - <item row="6" column="0"> + <item row="5" column="0"> <widget class="QLabel" name="label_10"> <property name="text"> <string>Exponent</string> </property> </widget> </item> - <item row="6" column="1"> + <item row="5" column="1"> <widget class="QDoubleSpinBox" name="expt"> <property name="sizePolicy"> <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> @@ -315,76 +319,6 @@ background:none;</string> </property> </widget> </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_11"> - <property name="text"> - <string>Order #2</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QDoubleSpinBox" name="order_2nd"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="alignment"> - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> - </property> - <property name="correctionMode"> - <enum>QAbstractSpinBox::CorrectToPreviousValue</enum> - </property> - <property name="decimals"> - <number>4</number> - </property> - <property name="minimum"> - <double>0.100000000000000</double> - </property> - <property name="maximum"> - <double>65535.000000000000000</double> - </property> - <property name="value"> - <double>1.000000000000000</double> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="QDoubleSpinBox" name="order_3rd"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="alignment"> - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> - </property> - <property name="correctionMode"> - <enum>QAbstractSpinBox::CorrectToPreviousValue</enum> - </property> - <property name="decimals"> - <number>4</number> - </property> - <property name="minimum"> - <double>0.100000000000000</double> - </property> - <property name="maximum"> - <double>65535.000000000000000</double> - </property> - <property name="value"> - <double>1.000000000000000</double> - </property> - </widget> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="label_12"> - <property name="text"> - <string>Order #3</string> - </property> - </widget> - </item> </layout> </widget> </item> @@ -720,7 +654,6 @@ background:none;</string> <tabstop>translation_alpha</tabstop> <tabstop>order_2nd</tabstop> <tabstop>order_3rd</tabstop> - <tabstop>spinZoom</tabstop> <tabstop>deadzone</tabstop> <tabstop>expt</tabstop> <tabstop>doubleSpinBox</tabstop> diff --git a/ftnoir_filter_accela/ftnoir_filter_accela.cpp b/ftnoir_filter_accela/ftnoir_filter_accela.cpp index a78a38c5..1046c268 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela.cpp +++ b/ftnoir_filter_accela/ftnoir_filter_accela.cpp @@ -31,7 +31,6 @@ void FTNoIR_Filter::loadSettings() { QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file)
iniFile.beginGroup ( "Accela" );
- zoom_factor = iniFile.value("zoom-slowness", ACCELA_ZOOM_SLOWNESS).toDouble();
rotation_alpha = iniFile.value("rotation-alpha", ACCELA_SMOOTHING_ROTATION).toDouble();
translation_alpha = iniFile.value("translation-alpha", ACCELA_SMOOTHING_TRANSLATION).toDouble();
second_order_alpha = iniFile.value("second-order-alpha", ACCELA_SECOND_ORDER_ALPHA).toDouble();
@@ -80,8 +79,7 @@ static inline T clamp(const T min, const T max, const T value) }
void FTNoIR_Filter::FilterHeadPoseData(const double* target_camera_position,
- double *new_camera_position,
- const double* last_post_filter_values)
+ double *new_camera_position)
{
if (first_run)
{
@@ -136,11 +134,10 @@ void FTNoIR_Filter::FilterHeadPoseData(const double* target_camera_position, const double a = i >= 3 ? rotation_alpha : translation_alpha;
const double a2 = a * second_order_alpha;
const double a3 = a * third_order_alpha;
- const double reduction = 1. / std::max(1., 1. + zoom_factor * -last_post_filter_values[TZ] / 1000);
const double velocity =
- parabola(a, vec * scaling[i], deadzone, expt) * reduction +
- parabola(a2, vec2 * scaling[i], deadzone, expt) * reduction +
- parabola(a3, vec3 * scaling[i], deadzone, expt) * reduction;
+ parabola(a, vec * scaling[i], deadzone, expt) +
+ parabola(a2, vec2 * scaling[i], deadzone, expt) +
+ parabola(a3, vec3 * scaling[i], deadzone, expt);
const double result = last_output[0][i] + velocity;
const bool done = sign > 0 ? result >= target_camera_position[i] : result <= target_camera_position[i];
new_camera_position[i] = done ? target_camera_position[i] : result;
diff --git a/ftnoir_filter_accela/ftnoir_filter_accela.h b/ftnoir_filter_accela/ftnoir_filter_accela.h index 0a550f0e..d91a5e42 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela.h +++ b/ftnoir_filter_accela/ftnoir_filter_accela.h @@ -34,7 +34,6 @@ #define ACCELA_SMOOTHING_ROTATION 60.0
#define ACCELA_SMOOTHING_TRANSLATION 40.0
-#define ACCELA_ZOOM_SLOWNESS 0
#define ACCELA_SECOND_ORDER_ALPHA 100.0
#define ACCELA_THIRD_ORDER_ALPHA 180.0
@@ -46,7 +45,7 @@ class FTNoIR_Filter : public IFilter public:
FTNoIR_Filter();
virtual ~FTNoIR_Filter();
- void FilterHeadPoseData(const double* target_camera_position, double *new_camera_position, const double* last_post_filter_values);
+ void FilterHeadPoseData(const double* target_camera_position, double *new_camera_position);
void Initialize() {
first_run = true;
}
@@ -55,7 +54,7 @@ private: QMutex mutex;
void loadSettings();
bool first_run;
- double rotation_alpha, translation_alpha, zoom_factor;
+ double rotation_alpha, translation_alpha;
double second_order_alpha, third_order_alpha;
double scaling[6];
double deadzone;
diff --git a/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp b/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp index be6836c2..a14db280 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp +++ b/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp @@ -47,8 +47,6 @@ FilterControls::FilterControls() : connect(ui.rotation_alpha, SIGNAL(valueChanged(double)), this, SLOT(settingChanged(double))); connect(ui.translation_alpha, SIGNAL(valueChanged(double)), this, SLOT(settingChanged(double))); - connect(ui.spinZoom, SIGNAL(valueChanged(int)), this, SLOT(settingChanged(int))); - QDoubleSpinBox* boxen[] = { ui.doubleSpinBox, ui.doubleSpinBox_2, @@ -157,7 +155,6 @@ void FilterControls::loadSettings() { //qDebug() << "FTNoIR_Filter::loadSettings2 says: size = " << NUM_OF(defScaleRotation); iniFile.beginGroup ( "Accela" ); - ui.spinZoom->setValue(iniFile.value("zoom-slowness", ACCELA_ZOOM_SLOWNESS).toInt()); ui.rotation_alpha->setValue(iniFile.value("rotation-alpha", ACCELA_SMOOTHING_ROTATION).toDouble()); ui.translation_alpha->setValue(iniFile.value("translation-alpha", ACCELA_SMOOTHING_TRANSLATION).toDouble()); ui.order_2nd->setValue(iniFile.value("second-order-alpha", ACCELA_SECOND_ORDER_ALPHA).toDouble()); @@ -210,7 +207,6 @@ void FilterControls::save() { iniFile.beginGroup ( "Accela" ); iniFile.setValue("rotation-alpha", ui.rotation_alpha->value()); iniFile.setValue("translation-alpha", ui.translation_alpha->value()); - iniFile.setValue("zoom-slowness", ui.spinZoom->value()); iniFile.setValue("deadzone", ui.deadzone->value()); iniFile.setValue("exponent", ui.expt->value()); iniFile.setValue("second-order-alpha", ui.order_2nd->value()); diff --git a/ftnoir_filter_base/ftnoir_filter_base.h b/ftnoir_filter_base/ftnoir_filter_base.h index 48a4a6b9..800e5deb 100644 --- a/ftnoir_filter_base/ftnoir_filter_base.h +++ b/ftnoir_filter_base/ftnoir_filter_base.h @@ -13,7 +13,7 @@ struct IFilter
{
virtual ~IFilter() = 0;
- virtual void FilterHeadPoseData(const double *target_camera_position, double *new_camera_position, const double *last_post_filter) = 0;
+ virtual void FilterHeadPoseData(const double *target_camera_position, double *new_camera_position) = 0;
virtual void Initialize() = 0;
};
diff --git a/ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp b/ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp index 3b208ef2..5f66be96 100644 --- a/ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp +++ b/ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp @@ -80,8 +80,7 @@ void FTNoIR_Filter::loadSettings() { }
void FTNoIR_Filter::FilterHeadPoseData(const double *target_camera_position,
- double *new_camera_position,
- const double *)
+ double *new_camera_position)
{
double delta;
double new_alpha;
diff --git a/ftnoir_filter_ewma2/ftnoir_filter_ewma2.h b/ftnoir_filter_ewma2/ftnoir_filter_ewma2.h index 7f2f21e6..86e4b65c 100644 --- a/ftnoir_filter_ewma2/ftnoir_filter_ewma2.h +++ b/ftnoir_filter_ewma2/ftnoir_filter_ewma2.h @@ -45,7 +45,7 @@ public: void Initialize() {}
void FilterHeadPoseData(const double *target_camera_position,
- double *new_camera_position, const double *);
+ double *new_camera_position);
void receiveSettings(double smin, double smax, double sexpt);
private:
diff --git a/ftnoir_filter_kalman/ftnoir_filter_kalman.h b/ftnoir_filter_kalman/ftnoir_filter_kalman.h index 6c2cb6a9..da6df2b1 100644 --- a/ftnoir_filter_kalman/ftnoir_filter_kalman.h +++ b/ftnoir_filter_kalman/ftnoir_filter_kalman.h @@ -30,8 +30,7 @@ public: } void Initialize() virt_override; void FilterHeadPoseData(const double *target_camera_position, - double *new_camera_position, - const double *) virt_override; + double *new_camera_position) virt_override; cv::KalmanFilter kalman; double prev_position[6]; double prev2_filter_pos[6]; diff --git a/ftnoir_filter_kalman/kalman.cpp b/ftnoir_filter_kalman/kalman.cpp index 5ecd417c..629cfcc8 100644 --- a/ftnoir_filter_kalman/kalman.cpp +++ b/ftnoir_filter_kalman/kalman.cpp @@ -93,8 +93,7 @@ static inline T clamp(const T min, const T max, const T value) } void FTNoIR_Filter::FilterHeadPoseData(const double* target_camera_position, - double *new_camera_position, - const double *) + double *new_camera_position) { bool new_target = false; |