diff options
-rw-r--r-- | facetracknoir/tracker.cpp | 13 | ||||
-rw-r--r-- | ftnoir_tracker_ht/ftnoir_tracker_ht.cpp | 1 | ||||
-rw-r--r-- | ftnoir_tracker_pt/camera.cpp | 4 | ||||
-rw-r--r-- | ftnoir_tracker_pt/ftnoir_tracker_pt.cpp | 15 | ||||
-rw-r--r-- | qfunctionconfigurator/functionconfig.h | 2 |
5 files changed, 17 insertions, 18 deletions
diff --git a/facetracknoir/tracker.cpp b/facetracknoir/tracker.cpp index 15b36f69..f624d6a1 100644 --- a/facetracknoir/tracker.cpp +++ b/facetracknoir/tracker.cpp @@ -143,15 +143,14 @@ void Tracker::run() { bool bTracker2Confid = false;
THeadPoseData last;
+ THeadPoseData newpose;
+ THeadPoseData last_post_filter;
forever
{
if (should_quit)
break;
- // Check event for stop thread
-
- THeadPoseData newpose;
newpose.pitch = 0.0f;
newpose.roll = 0.0f;
newpose.yaw = 0.0f;
@@ -199,7 +198,7 @@ void Tracker::run() { //
// Only copy valid values
//
- if (Tracker::confid) {
+ if (confid) {
offset_camera.x = GlobalPose->X.headPos;
offset_camera.y = GlobalPose->Y.headPos;
offset_camera.z = GlobalPose->Z.headPos;
@@ -222,7 +221,7 @@ void Tracker::run() { do_game_zero = false;
}
- if (Tracker::do_tracking && Tracker::confid) {
+ if (do_tracking && confid) {
// get values
target_camera.x = GlobalPose->X.headPos;
target_camera.y = GlobalPose->Y.headPos;
@@ -238,7 +237,7 @@ void Tracker::run() { // Use advanced filtering, when a filter was selected.
//
if (Libraries->pFilter) {
- THeadPoseData last_post_filter = gameoutput_camera;
+ last_post_filter = gameoutput_camera;
Libraries->pFilter->FilterHeadPoseData(¤t_camera, &target_camera, &new_camera, &last_post_filter, newp);
}
else {
@@ -261,7 +260,7 @@ void Tracker::run() { //
// Reverse Axis.
//
- if (Tracker::do_axis_reverse) {
+ if (do_axis_reverse) {
output_camera.z = Z_PosWhenReverseAxis; // Set the desired Z-position
}
diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp index 4f7d68f0..33b4c944 100644 --- a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp +++ b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp @@ -228,6 +228,7 @@ bool Tracker::GiveHeadPoseData(THeadPoseData* data) videoWidget->updateImage(shm->frame.frame, shm->frame.width, shm->frame.height); //memcpy(foo, shm->frame.frame, shm->frame.width * shm->frame.height * 3); fresh = true; + shm->frame.width = 0; } if (shm->result.filled) { if (enableRX) diff --git a/ftnoir_tracker_pt/camera.cpp b/ftnoir_tracker_pt/camera.cpp index 96ba3b89..90fcfaaf 100644 --- a/ftnoir_tracker_pt/camera.cpp +++ b/ftnoir_tracker_pt/camera.cpp @@ -92,8 +92,8 @@ bool CVCamera::_get_frame(Mat* frame) {
Mat tmp;
bool ret = cap->read(tmp);
- if (ret)
- flip(tmp, *frame, 0);
+ //if (ret)
+ // flip(tmp, *frame, 0);
return ret;
}
diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp index b4cb613b..96017d52 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp @@ -66,7 +66,6 @@ void Tracker::run() {
{
- refreshVideo();
QMutexLocker lock(&mutex);
if (should_quit)
break;
@@ -84,14 +83,16 @@ void Tracker::run() const std::vector<cv::Vec2f>& points = point_extractor.extract_points(frame, dt, draw_frame);
tracking_valid = point_tracker.track(points, camera.get_info().f, dt);
frame_count++;
+ fresh = true;
}
#ifdef PT_PERF_LOG
log_stream<<"dt: "<<dt;
if (!frame.empty()) log_stream<<" fps: "<<camera.get_info().fps;
log_stream<<"\n";
#endif
+ refreshVideo();
}
- msleep(sleep_time);
+ msleep(sleep_time);
}
qDebug()<<"Tracker:: Thread stopping";
@@ -143,12 +144,12 @@ void Tracker::center() void Tracker::refreshVideo()
{
- if (video_widget)
+ if (video_widget && fresh)
{
Mat frame_copy;
std::auto_ptr< vector<Vec2f> > points;
{
- QMutexLocker lock(&mutex);
+//QMutexLocker lock(&mutex);
if (!draw_frame || frame.empty()) return;
// copy the frame and points from the tracker thread
@@ -157,8 +158,7 @@ void Tracker::refreshVideo() }
video_widget->update_image(frame_copy, points);
- fresh = true;
- }
+ }
}
void Tracker::StartTracker(QFrame* videoframe)
@@ -194,7 +194,6 @@ void Tracker::paint_widget() { bool Tracker::GiveHeadPoseData(THeadPoseData *data)
{
- refreshVideo();
const float rad2deg = 180.0/3.14159265;
const float deg2rad = 1.0/rad2deg;
{
@@ -245,7 +244,7 @@ bool Tracker::GiveHeadPoseData(THeadPoseData *data) data->yaw = rad2deg * alpha;
}
if (bEnablePitch) {
- data->pitch = -rad2deg * beta;
+ data->pitch = rad2deg * beta;
}
if (bEnableRoll) {
data->roll = rad2deg * gamma;
diff --git a/qfunctionconfigurator/functionconfig.h b/qfunctionconfigurator/functionconfig.h index d81711a7..9f380000 100644 --- a/qfunctionconfigurator/functionconfig.h +++ b/qfunctionconfigurator/functionconfig.h @@ -28,7 +28,7 @@ private: QString _title;
float getValueInternal(int x);
QPointF lastValueTracked; // The last input value requested by the Tracker, with it's output-value.
- bool _tracking_active;
+ volatile bool _tracking_active;
int _max_Input;
int _max_Output;
|