summaryrefslogtreecommitdiffhomepage
path: root/ftnoir_tracker_pt/video_widget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'ftnoir_tracker_pt/video_widget.cpp')
-rw-r--r--ftnoir_tracker_pt/video_widget.cpp53
1 files changed, 27 insertions, 26 deletions
diff --git a/ftnoir_tracker_pt/video_widget.cpp b/ftnoir_tracker_pt/video_widget.cpp
index c297c455..1b8b4a7a 100644
--- a/ftnoir_tracker_pt/video_widget.cpp
+++ b/ftnoir_tracker_pt/video_widget.cpp
@@ -39,33 +39,34 @@ void VideoWidget::resizeGL(int w, int h)
void VideoWidget::paintGL()
{
- QMutexLocker lck(&mtx);
+ QMutexLocker((QMutex*)&mtx);
if (resized_qframe.size() == size() || (resized_qframe.width() <= width() && resized_qframe.height() <= height())) {
glDrawPixels(resized_qframe.width(), resized_qframe.height(), GL_RGB, GL_UNSIGNED_BYTE, resized_qframe.bits());
-
- const int crosshair_radius = 10;
- const int crosshair_thickness = 1;
-
- glColor3f(1.0, 0.0, 0.0);
- glLineWidth(crosshair_thickness);
- int x,y;
- for (vector<Vec2f>::iterator iter = points->begin();
- iter != points->end();
- ++iter)
- {
- x = (*iter)[0] * resized_qframe.width() + resized_qframe.width()/2.0 + 0.5;
- y = (*iter)[1] * resized_qframe.width() + resized_qframe.height()/2.0 + 0.5;
-
- glBegin(GL_LINES);
- glVertex2i(x-crosshair_radius, y);
- glVertex2i(x+crosshair_radius, y);
- glEnd();
- glBegin(GL_LINES);
- glVertex2i(x, y-crosshair_radius);
- glVertex2i(x, y+crosshair_radius);
- glEnd();
- }
-
+ if (points.get() != NULL)
+ {
+ const int crosshair_radius = 10;
+ const int crosshair_thickness = 1;
+
+ glColor3f(1.0, 0.0, 0.0);
+ glLineWidth(crosshair_thickness);
+ int x,y;
+ for (vector<Vec2f>::iterator iter = points->begin();
+ iter != points->end();
+ ++iter)
+ {
+ x = (*iter)[0] * resized_qframe.width() + resized_qframe.width()/2.0 + 0.5;
+ y = (*iter)[1] * resized_qframe.width() + resized_qframe.height()/2.0 + 0.5;
+
+ glBegin(GL_LINES);
+ glVertex2i(x-crosshair_radius, y);
+ glVertex2i(x+crosshair_radius, y);
+ glEnd();
+ glBegin(GL_LINES);
+ glVertex2i(x, y-crosshair_radius);
+ glVertex2i(x, y+crosshair_radius);
+ glEnd();
+ }
+ }
} else {
glClear(GL_DEPTH_BUFFER_BIT);
}
@@ -75,7 +76,6 @@ void VideoWidget::paintGL()
void VideoWidget::resize_frame()
{
- QMutexLocker lck(&mtx);
#ifdef _WIN32
if (qframe.size() == size() || (qframe.width() <= width() && qframe.height() <= height()))
resized_qframe = qframe.mirrored();
@@ -96,6 +96,7 @@ void VideoWidget::update()
void VideoWidget::update_image(Mat frame, std::auto_ptr< vector<Vec2f> > points)
{
+ QMutexLocker((QMutex*)&mtx);
this->frame = frame;
this->points = points;