summaryrefslogtreecommitdiffhomepage
path: root/ftnoir_filter_accela
diff options
context:
space:
mode:
Diffstat (limited to 'ftnoir_filter_accela')
-rw-r--r--ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui36
-rw-r--r--ftnoir_filter_accela/ftnoir_filter_accela.cpp9
-rw-r--r--ftnoir_filter_accela/ftnoir_filter_accela.h1
-rw-r--r--ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp6
4 files changed, 38 insertions, 14 deletions
diff --git a/ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui b/ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui
index 0d41d5eb..f1f45bb5 100644
--- a/ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui
+++ b/ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui
@@ -70,16 +70,16 @@
</rect>
</property>
<property name="maxInputEGU" stdset="0">
- <number>4</number>
+ <number>6</number>
</property>
<property name="maxOutputEGU" stdset="0">
- <number>6</number>
+ <number>8</number>
</property>
<property name="pixPerEGU_Input" stdset="0">
- <number>191</number>
+ <number>127</number>
</property>
<property name="pixPerEGU_Output" stdset="0">
- <number>75</number>
+ <number>57</number>
</property>
<property name="gridDistEGU_Input" stdset="0">
<number>1</number>
@@ -126,16 +126,16 @@
</rect>
</property>
<property name="maxInputEGU" stdset="0">
- <number>4</number>
+ <number>6</number>
</property>
<property name="maxOutputEGU" stdset="0">
- <number>6</number>
+ <number>8</number>
</property>
<property name="pixPerEGU_Input" stdset="0">
- <number>191</number>
+ <number>127</number>
</property>
<property name="pixPerEGU_Output" stdset="0">
- <number>75</number>
+ <number>57</number>
</property>
<property name="gridDistEGU_Input" stdset="0">
<number>1</number>
@@ -322,6 +322,26 @@ background:none;</string>
</widget>
</item>
<item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Smoothing:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QDoubleSpinBox" name="smoothingFactor">
+ <property name="minimum">
+ <double>0.100000000000000</double>
+ </property>
+ <property name="maximum">
+ <double>100.000000000000000</double>
+ </property>
+ <property name="value">
+ <double>1.000000000000000</double>
+ </property>
+ </widget>
+ </item>
+ <item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
diff --git a/ftnoir_filter_accela/ftnoir_filter_accela.cpp b/ftnoir_filter_accela/ftnoir_filter_accela.cpp
index 543ce376..87df1ba7 100644
--- a/ftnoir_filter_accela/ftnoir_filter_accela.cpp
+++ b/ftnoir_filter_accela/ftnoir_filter_accela.cpp
@@ -21,8 +21,8 @@
#endif
FTNoIR_Filter::FTNoIR_Filter() :
- functionConfig("Accela-Scaling-Rotation", 4, 6),
- translationFunctionConfig("Accela-Scaling-Translation", 4, 6)
+ functionConfig("Accela-Scaling-Rotation", 6, 8),
+ translationFunctionConfig("Accela-Scaling-Translation", 6, 8)
{
first_run = true;
kMagicNumber = 100.0f;
@@ -50,6 +50,7 @@ void FTNoIR_Filter::loadSettings() {
iniFile.beginGroup ( "Accela" );
kMagicNumber = iniFile.value ( "Reduction", 100 ).toFloat();
kZoomSlowness = iniFile.value("zoom-slowness", 0).toFloat();
+ kSmoothingFactor = iniFile.value("smoothing-factor", 1).toFloat();
iniFile.endGroup ();
}
@@ -89,13 +90,13 @@ void FTNoIR_Filter::FilterHeadPoseData(double *current_camera_position,
double start = prev_output[i];
double vec = e2 - start;
int sign = vec < 0 ? -1 : 1;
- double x = fabs(vec);
+ double x = fabs(vec) / kSmoothingFactor;
QList<QPointF> points = (i >= 3 ? functionConfig : translationFunctionConfig).getPoints();
int extrapolatep = 0;
double ratio;
double maxx;
double add;
- // extrapolation of a spline
+ // linear extrapolation of a spline
if (points.size() > 1) {
QPointF last = points[points.size() - 1];
QPointF penultimate = points[points.size() - 2];
diff --git a/ftnoir_filter_accela/ftnoir_filter_accela.h b/ftnoir_filter_accela/ftnoir_filter_accela.h
index 4c513bb3..bcb15330 100644
--- a/ftnoir_filter_accela/ftnoir_filter_accela.h
+++ b/ftnoir_filter_accela/ftnoir_filter_accela.h
@@ -59,6 +59,7 @@ private:
double kFactor, kFactorTranslation;
double kSensitivity, kSensitivityTranslation;
double kMagicNumber, kZoomSlowness; // Stanislaws' magic number (should be 100 according to him...)
+ double kSmoothingFactor;
FunctionConfig functionConfig;
FunctionConfig translationFunctionConfig;
diff --git a/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp b/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp
index d2e7b1a8..3b5dbd15 100644
--- a/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp
+++ b/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp
@@ -39,8 +39,8 @@
//
FilterControls::FilterControls() :
QWidget(),
- functionConfig("Accela-Scaling-Rotation", 4, 8),
- translationFunctionConfig("Accela-Scaling-Translation", 4, 8)
+ functionConfig("Accela-Scaling-Rotation", 6, 8),
+ translationFunctionConfig("Accela-Scaling-Translation", 6, 8)
{
ui.setupUi( this );
@@ -156,6 +156,7 @@ void FilterControls::loadSettings() {
iniFile.beginGroup ( "Accela" );
ui.slideReduction->setValue (iniFile.value ( "Reduction", 100 ).toInt());
ui.slideZoom->setValue(iniFile.value("zoom-slowness", 0).toInt());
+ ui.smoothingFactor->setValue(iniFile.value("smoothing-factor", 1).toFloat());
iniFile.endGroup ();
settingsDirty = false;
@@ -175,6 +176,7 @@ void FilterControls::save() {
iniFile.beginGroup ( "Accela" );
iniFile.setValue ( "Reduction", ui.slideReduction->value() );
iniFile.setValue("zoom-slowness", ui.slideZoom->value());
+ iniFile.setValue("smoothing-factor", ui.smoothingFactor->value());
iniFile.endGroup ();
functionConfig.saveSettings(iniFile);