summaryrefslogtreecommitdiffhomepage
path: root/tracker-pt/module
diff options
context:
space:
mode:
Diffstat (limited to 'tracker-pt/module')
-rw-r--r--tracker-pt/module/camera.cpp6
-rw-r--r--tracker-pt/module/camera.h3
-rw-r--r--tracker-pt/module/module.cpp17
-rw-r--r--tracker-pt/module/point_extractor.cpp9
4 files changed, 31 insertions, 4 deletions
diff --git a/tracker-pt/module/camera.cpp b/tracker-pt/module/camera.cpp
index 1afecc92..816f5baf 100644
--- a/tracker-pt/module/camera.cpp
+++ b/tracker-pt/module/camera.cpp
@@ -85,6 +85,7 @@ Camera::result Camera::get_frame(pt_frame& frame_)
bool Camera::start(int idx, int fps, int res_x, int res_y)
{
+
if (idx >= 0 && fps >= 0 && res_x >= 0 && res_y >= 0)
{
if (cam_desired.idx != idx ||
@@ -96,6 +97,11 @@ bool Camera::start(int idx, int fps, int res_x, int res_y)
stop();
desired_name = get_camera_names().value(idx);
+ bool kinectIRSensor = false;
+ if (desired_name.compare(KKinectIRSensor) == 0)
+ {
+ kinectIRSensor = true;
+ }
cam_desired.idx = idx;
cam_desired.fps = fps;
cam_desired.res_x = res_x;
diff --git a/tracker-pt/module/camera.h b/tracker-pt/module/camera.h
index 2ea633d0..644eead7 100644
--- a/tracker-pt/module/camera.h
+++ b/tracker-pt/module/camera.h
@@ -19,6 +19,9 @@
namespace pt_module {
+///
+/// Implement our camera interface using OpenCV VideoCapture.
+///
struct Camera final : pt_camera
{
Camera(const QString& module_name);
diff --git a/tracker-pt/module/module.cpp b/tracker-pt/module/module.cpp
index f665face..db3e8fac 100644
--- a/tracker-pt/module/module.cpp
+++ b/tracker-pt/module/module.cpp
@@ -2,6 +2,7 @@
#include "module.hpp"
#include "camera.h"
+#include "compat/camera-names.hpp"
#include "frame.hpp"
#include "point_extractor.h"
#include "ftnoir_tracker_pt_dialog.h"
@@ -18,6 +19,7 @@ static const QString module_name = "tracker-pt";
namespace pt_module {
+// Traits for OpenCV VideoCapture camera
struct pt_module_traits final : pt_runtime_traits
{
pointer<pt_camera> make_camera() const override
@@ -48,9 +50,22 @@ struct pt_module_traits final : pt_runtime_traits
struct tracker_pt : Tracker_PT
{
- tracker_pt() : Tracker_PT(pointer<pt_runtime_traits>(new pt_module_traits))
+ tracker_pt() : Tracker_PT(module_name)
{
}
+
+ pointer<pt_runtime_traits> create_traits() override
+ {
+ // Create different traits according to settings
+ if (s.camera_name().compare(KKinectIRSensor) == 0)
+ {
+ // Use Kinect IR trait
+ return pointer<pt_runtime_traits>(new pt_module_traits);
+ }
+
+ return pointer<pt_runtime_traits>(new pt_module_traits);
+ }
+
};
struct dialog_pt : TrackerDialog_PT
diff --git a/tracker-pt/module/point_extractor.cpp b/tracker-pt/module/point_extractor.cpp
index 298d8752..049f4acd 100644
--- a/tracker-pt/module/point_extractor.cpp
+++ b/tracker-pt/module/point_extractor.cpp
@@ -235,9 +235,12 @@ static void draw_blobs(cv::Mat& preview_frame, const blob* blobs, unsigned nblob
: cv::Scalar(0, 0, 255);
cv::Point pos(iround(b.pos[0]*cx+offx), iround(b.pos[1]*cy+offy));
- cv::putText(preview_frame, buf, pos,
- cv::FONT_HERSHEY_PLAIN, overlay_size, text_color,
- 1);
+
+ // That crashes in debug x64 on my dev machine when using Kinect V2 Video Sensor
+ // Seems to work fine with official beta 3 though
+ //cv::putText(preview_frame, buf, pos,
+ // cv::FONT_HERSHEY_PLAIN, overlay_size, text_color,
+ // 1);
}
}