diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2016-12-31 07:28:00 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2016-12-31 07:53:02 +0100 |
commit | 1576bd06113ca6fc9a4ddb68621a636c0a21ee2e (patch) | |
tree | 6d14bc3bf4b251f3f8dda02cd16bdc2990e5f2aa /tracker-aruco | |
parent | e8d59272d85bcac4a89ff36a190aee09dd7dfac9 (diff) |
tracker/aruco: add inactive experimental unsharp masking code
It's slow and untested beyond my replaying users' camera feed videos.
Diffstat (limited to 'tracker-aruco')
-rw-r--r-- | tracker-aruco/ftnoir_tracker_aruco.cpp | 18 | ||||
-rw-r--r-- | tracker-aruco/ftnoir_tracker_aruco.h | 9 |
2 files changed, 27 insertions, 0 deletions
diff --git a/tracker-aruco/ftnoir_tracker_aruco.cpp b/tracker-aruco/ftnoir_tracker_aruco.cpp index 53907808..ec778624 100644 --- a/tracker-aruco/ftnoir_tracker_aruco.cpp +++ b/tracker-aruco/ftnoir_tracker_aruco.cpp @@ -15,6 +15,10 @@ #include <opencv2/imgproc.hpp> #include <opencv2/calib3d.hpp> +#ifdef DEBUG_UNSHARP_MASKING +# include <opencv2/highgui.hpp> +#endif + #include <QMutexLocker> #include <QDebug> @@ -34,6 +38,10 @@ constexpr const double aruco_tracker::RC; constexpr const float aruco_tracker::size_min; constexpr const float aruco_tracker::size_max; +#ifdef DEBUG_UNSHARP_MASKING +constexpr double aruco_tracker::gauss_kernel_size; +#endif + aruco_tracker::aruco_tracker() : pose{0,0,0, 0,0,0}, fps(0), @@ -371,6 +379,16 @@ void aruco_tracker::run() cv::cvtColor(color, grayscale, cv::COLOR_RGB2GRAY); +#ifdef DEBUG_UNSHARP_MASKING + { + static constexpr double strength = double(DEBUG_UNSHARP_MASKING); + cv::GaussianBlur(grayscale, blurred, cv::Size(0, 0), gauss_kernel_size); + cv::addWeighted(grayscale, 1 + strength, blurred, -strength, 0, grayscale); + cv::imshow("capture", grayscale); + cv::waitKey(1); + } +#endif + color.copyTo(frame); set_intrinsics(); diff --git a/tracker-aruco/ftnoir_tracker_aruco.h b/tracker-aruco/ftnoir_tracker_aruco.h index 6e7db3f6..53eaa247 100644 --- a/tracker-aruco/ftnoir_tracker_aruco.h +++ b/tracker-aruco/ftnoir_tracker_aruco.h @@ -28,6 +28,8 @@ #include <opencv2/core.hpp> #include <opencv2/videoio.hpp> +// value 0->1 +//#define DEBUG_UNSHARP_MASKING .75 using namespace options; @@ -98,6 +100,9 @@ private: double pose[6], fps, no_detection_timeout; cv::Mat frame, grayscale, color; cv::Matx33d r; +#ifdef DEBUG_UNSHARP_MASKING + cv::Mat blurred; +#endif std::vector<cv::Point3f> obj_points; cv::Matx33d intrinsics; aruco::MarkerDetector detector; @@ -139,6 +144,10 @@ private: { 0, 0 } }; +#ifdef DEBUG_UNSHARP_MASKING + static constexpr double gauss_kernel_size = 3; +#endif + static constexpr double timeout = 1; static constexpr double timeout_backoff_c = 4./11; |