aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorN.N. <sevyves@users.sourceforge.net>2009-09-21 07:38:54 +0000
committerN.N. <sevyves@users.sourceforge.net>2009-09-21 07:38:54 +0000
commit14162487d41e46760fd0902bacf8cede5ead13f1 (patch)
tree4a4c5285482e673c66fe033f88129a7bcd9d1b7e
parentb90bcddf332475229f76ec1ae0560130df7fde6a (diff)
fix global movement detection
svn path=/trunk/externals/pdp_opencv/; revision=12421
-rw-r--r--pdp_opencv_motempl.c33
1 files changed, 24 insertions, 9 deletions
diff --git a/pdp_opencv_motempl.c b/pdp_opencv_motempl.c
index 76ed1ec..6f21efc 100644
--- a/pdp_opencv_motempl.c
+++ b/pdp_opencv_motempl.c
@@ -202,15 +202,30 @@ void pdp_opencv_motempl_update_mhi( t_pdp_opencv_motempl *x, IplImage* img, Ipl
cvLine( dst, center, cvPoint( cvRound( center.x + magnitude*cos(angle*CV_PI/180)),
cvRound( center.y - magnitude*sin(angle*CV_PI/180))), color, 3, CV_AA, 0 );
- sprintf( tindex, "%d", ++j );
- cvPutText( dst, tindex, center, &x->font, CV_RGB(255,255,255));
- SETFLOAT(&x->rlist[0], j);
- SETFLOAT(&x->rlist[1], center.x);
- SETFLOAT(&x->rlist[2], center.y);
- SETFLOAT(&x->rlist[3], comp_rect.width);
- SETFLOAT(&x->rlist[4], comp_rect.height);
- SETFLOAT(&x->rlist[5], angle);
- outlet_list( x->x_dataout, 0, 6, x->rlist );
+ if ( i<0 )
+ {
+ sprintf( tindex, "%d", i );
+ cvPutText( dst, tindex, center, &x->font, CV_RGB(255,255,255));
+ SETFLOAT(&x->rlist[0], i);
+ SETFLOAT(&x->rlist[1], center.x);
+ SETFLOAT(&x->rlist[2], center.y);
+ SETFLOAT(&x->rlist[3], comp_rect.width);
+ SETFLOAT(&x->rlist[4], comp_rect.height);
+ SETFLOAT(&x->rlist[5], angle);
+ outlet_list( x->x_dataout, 0, 6, x->rlist );
+ }
+ else
+ {
+ sprintf( tindex, "%d", ++j );
+ cvPutText( dst, tindex, center, &x->font, CV_RGB(255,255,255));
+ SETFLOAT(&x->rlist[0], j);
+ SETFLOAT(&x->rlist[1], center.x);
+ SETFLOAT(&x->rlist[2], center.y);
+ SETFLOAT(&x->rlist[3], comp_rect.width);
+ SETFLOAT(&x->rlist[4], comp_rect.height);
+ SETFLOAT(&x->rlist[5], angle);
+ outlet_list( x->x_dataout, 0, 6, x->rlist );
+ }
}
}