diff options
-rwxr-xr-x | bin/NPClient.dll | bin | 15872 -> 15872 bytes | |||
-rwxr-xr-x | bin/NPClient64.dll | bin | 20992 -> 20480 bytes | |||
-rw-r--r-- | ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui | 57 | ||||
-rw-r--r-- | ftnoir_filter_accela/ftnoir_filter_accela.cpp | 13 | ||||
-rw-r--r-- | ftnoir_filter_accela/ftnoir_filter_accela.h | 3 | ||||
-rw-r--r-- | ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp | 12 | ||||
-rw-r--r-- | ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 17 |
7 files changed, 78 insertions, 24 deletions
diff --git a/bin/NPClient.dll b/bin/NPClient.dll Binary files differindex b291cb24..19c54d63 100755 --- a/bin/NPClient.dll +++ b/bin/NPClient.dll diff --git a/bin/NPClient64.dll b/bin/NPClient64.dll Binary files differindex 8521ca03..fb614039 100755 --- a/bin/NPClient64.dll +++ b/bin/NPClient64.dll diff --git a/ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui b/ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui index c7bd2808..1d3e95ef 100644 --- a/ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui +++ b/ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui @@ -229,6 +229,63 @@ background:none;</string> </property> </widget> </item> + <item row="3" column="0"> + <widget class="QLabel" name="lblSensYaw_6"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>25</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>150</width> + <height>16777215</height> + </size> + </property> + <property name="styleSheet"> + <string notr="true">color:#0; +background:none;</string> + </property> + <property name="text"> + <string>Deadzone</string> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QDoubleSpinBox" name="deadzone"> + <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="decimals"> + <number>3</number> + </property> + <property name="minimum"> + <double>0.000000000000000</double> + </property> + <property name="maximum"> + <double>3.000000000000000</double> + </property> + <property name="singleStep"> + <double>0.050000000000000</double> + </property> + <property name="value"> + <double>0.000000000000000</double> + </property> + </widget> + </item> </layout> </widget> </item> diff --git a/ftnoir_filter_accela/ftnoir_filter_accela.cpp b/ftnoir_filter_accela/ftnoir_filter_accela.cpp index 1168004f..63c82722 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela.cpp +++ b/ftnoir_filter_accela/ftnoir_filter_accela.cpp @@ -34,9 +34,8 @@ void FTNoIR_Filter::loadSettings() { 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();
- iniFile.endGroup ();
- iniFile.beginGroup("Accela-Scaling");
+ deadzone = iniFile.value("deadzone", 0.0).toDouble();
// bigger means less filtering
static const double init_scaling[] = {
1.5, // X
@@ -50,23 +49,23 @@ void FTNoIR_Filter::loadSettings() { {
scaling[i] = iniFile.value(QString("axis-%1").arg(QString::number(i)), init_scaling[i]).toDouble();
}
-
iniFile.endGroup();
}
-void FTNoIR_Filter::receiveSettings(double rot, double trans, double zoom_fac)
+void FTNoIR_Filter::receiveSettings(double rot, double trans, double zoom_fac, double dz)
{
QMutexLocker foo(&mutex);
rotation_alpha = rot;
translation_alpha = trans;
zoom_factor = zoom_fac;
+ deadzone = dz;
}
-static inline double parabola(const double a, const double x)
+static inline double parabola(const double a, const double x, const double dz)
{
const double a1 = 1./a;
- return a1 * pow(std::max<double>(x - 0.175, 1e-5), 2.2);
+ return a1 * pow(std::max<double>(x - dz, 1e-3), 1.975);
}
void FTNoIR_Filter::FilterHeadPoseData(const double* target_camera_position,
@@ -94,7 +93,7 @@ void FTNoIR_Filter::FilterHeadPoseData(const double* target_camera_position, const double x = fabs(vec);
const double a = i >= 3 ? rotation_alpha : translation_alpha;
const double reduction = 1. / std::max(1., 1. + zoom_factor * -last_post_filter_values[TZ] / 1000);
- const double velocity = parabola(a, x * scaling[i]) * reduction;
+ const double velocity = parabola(a, x * scaling[i], deadzone) * reduction;
const double result = current_camera_position[i] + velocity * sign;
const bool done = sign > 0 ? result >= target_camera_position[i] : result <= target_camera_position[i];
new_camera_position[i] = current_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 512b4576..1808e026 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela.h +++ b/ftnoir_filter_accela/ftnoir_filter_accela.h @@ -47,7 +47,7 @@ public: void Initialize() {
first_run = true;
}
- void receiveSettings(double rot, double trans, double zoom_fac);
+ void receiveSettings(double rot, double trans, double zoom_fac, double deadzone);
private:
QMutex mutex;
void loadSettings();
@@ -55,6 +55,7 @@ private: double rotation_alpha, translation_alpha, zoom_factor;
double current_camera_position[6];
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 559b9d4d..ca3377e1 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp +++ b/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp @@ -158,9 +158,8 @@ void FilterControls::loadSettings() { 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()); - iniFile.endGroup (); + ui.deadzone->setValue(iniFile.value("deadzone", 0).toDouble()); - iniFile.beginGroup("Accela-Scaling"); // bigger means less filtering static const double init_scaling[] = { 1.5, // X @@ -184,6 +183,7 @@ void FilterControls::loadSettings() { { boxen[i]->setValue(iniFile.value(QString("axis-%1").arg(QString::number(i)), init_scaling[i]).toDouble()); } + iniFile.endGroup(); settingsDirty = false; @@ -200,15 +200,13 @@ void FilterControls::save() { qDebug() << "FTNoIR_Filter::save() says: iniFile = " << currentFile; - double rot, trans, zoom; + double rot, trans, zoom, deadzone; iniFile.beginGroup ( "Accela" ); iniFile.setValue("rotation-alpha", rot = ui.rotation_alpha->value()); iniFile.setValue("translation-alpha", trans = ui.translation_alpha->value()); iniFile.setValue("zoom-slowness", zoom = ui.spinZoom->value()); - iniFile.endGroup (); - - iniFile.beginGroup("Accela-Scaling"); + iniFile.setValue("deadzone", deadzone = ui.deadzone->value()); QDoubleSpinBox* boxen[] = { ui.doubleSpinBox, @@ -228,7 +226,7 @@ void FilterControls::save() { settingsDirty = false; if (accela_filter) - accela_filter->receiveSettings(rot, trans, zoom); + accela_filter->receiveSettings(rot, trans, zoom, deadzone); } //////////////////////////////////////////////////////////////////////////////// diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index d068564d..d5ed9071 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -187,8 +187,10 @@ start: aruco::MarkerDetector detector; detector.setDesiredSpeed(3); - detector.setThresholdParams(11, 5); - cv::Mat color, color_, grayscale, grayscale2, rvec, tvec; + detector.setMinMaxSize(0.06, 0.4); + detector.setThresholdParams(11, 7); + + cv::Mat color, color_, grayscale, rvec, tvec; if (!camera->isOpened()) { @@ -203,11 +205,11 @@ start: auto freq = cv::getTickFrequency(); auto last_time = cv::getTickCount(); auto prev_time = last_time; + double last_delay = -1; int fps = 0; int last_fps = 0; double error = 0; std::vector<cv::Point2f> reprojection; - auto kernel = cv::createGaussianFilter(CV_8U, cv::Size(5, 5), 0); cv::Point2f last_centroid; while (!stop) { @@ -218,12 +220,9 @@ start: } if (!camera->read(color_)) continue; + auto tm = cv::getTickCount(); color_.copyTo(color); - cv::cvtColor(color, grayscale2, cv::COLOR_BGR2GRAY); - if (grayscale.empty()) - grayscale = grayscale2.clone(); - - kernel->apply(grayscale2, grayscale); + cv::cvtColor(color, grayscale, cv::COLOR_BGR2GRAY); const int scale = frame.cols > 480 ? 2 : 1; @@ -276,7 +275,7 @@ start: std::sprintf(buf, "Hz: %ld", last_fps); cv::putText(frame, buf, cv::Point(10, 32), cv::FONT_HERSHEY_PLAIN, scale, cv::Scalar(0, 255, 0), scale); - std::sprintf(buf, "Delay: %ld ms", (long) (1000 * (time - prev_time) / freq)); + std::sprintf(buf, "Jiffies: %ld", (long) (10000 * (time - tm) / freq)); cv::putText(frame, buf, cv::Point(10, 54), cv::FONT_HERSHEY_PLAIN, scale, cv::Scalar(80, 255, 0), scale); std::sprintf(buf, "Error: %f px", error); cv::putText(frame, buf, cv::Point(10, 76), cv::FONT_HERSHEY_PLAIN, scale, cv::Scalar(80, 255, 0), scale); |