aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorN.N. <sevyves@users.sourceforge.net>2009-09-21 07:39:56 +0000
committerN.N. <sevyves@users.sourceforge.net>2009-09-21 07:39:56 +0000
commitf3117bf10c367592e30a7b5559e30d7b75b494f3 (patch)
treeb2d19a3bedc0b75483d7afe118b9ad7c84cac5b1
parent2ee1e781e01ebdedef10c7f30580a2641ac10650 (diff)
fix global movement detection
svn path=/trunk/externals/pix_opencv/; revision=12422
-rw-r--r--pix_opencv_motempl.cc99
1 files changed, 72 insertions, 27 deletions
diff --git a/pix_opencv_motempl.cc b/pix_opencv_motempl.cc
index 120a243..545b437 100644
--- a/pix_opencv_motempl.cc
+++ b/pix_opencv_motempl.cc
@@ -237,15 +237,30 @@ void pix_opencv_motempl :: processRGBAImage(imageStruct &image)
cvLine( motion, 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( motion, tindex, center, &font, CV_RGB(255,255,255));
- SETFLOAT(&rlist[0], j);
- SETFLOAT(&rlist[1], center.x);
- SETFLOAT(&rlist[2], center.y);
- SETFLOAT(&rlist[3], comp_rect.width);
- SETFLOAT(&rlist[4], comp_rect.height);
- SETFLOAT(&rlist[5], angle);
- outlet_list( m_dataout, 0, 6, rlist );
+ if( i < 0 ) // case of the whole image
+ {
+ sprintf( tindex, "%d", i );
+ cvPutText( motion, tindex, center, &font, CV_RGB(255,255,255));
+ SETFLOAT(&rlist[0], i);
+ SETFLOAT(&rlist[1], center.x);
+ SETFLOAT(&rlist[2], center.y);
+ SETFLOAT(&rlist[3], comp_rect.width);
+ SETFLOAT(&rlist[4], comp_rect.height);
+ SETFLOAT(&rlist[5], angle);
+ outlet_list( m_dataout, 0, 6, rlist );
+ }
+ else
+ {
+ sprintf( tindex, "%d", ++j );
+ cvPutText( motion, tindex, center, &font, CV_RGB(255,255,255));
+ SETFLOAT(&rlist[0], j);
+ SETFLOAT(&rlist[1], center.x);
+ SETFLOAT(&rlist[2], center.y);
+ SETFLOAT(&rlist[3], comp_rect.width);
+ SETFLOAT(&rlist[4], comp_rect.height);
+ SETFLOAT(&rlist[5], angle);
+ outlet_list( m_dataout, 0, 6, rlist );
+ }
}
@@ -394,15 +409,30 @@ void pix_opencv_motempl :: processRGBImage(imageStruct &image)
cvLine( motion, 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( motion, tindex, center, &font, CV_RGB(255,255,255));
- SETFLOAT(&rlist[0], j);
- SETFLOAT(&rlist[1], center.x);
- SETFLOAT(&rlist[2], center.y);
- SETFLOAT(&rlist[3], comp_rect.width);
- SETFLOAT(&rlist[4], comp_rect.height);
- SETFLOAT(&rlist[5], angle);
- outlet_list( m_dataout, 0, 6, rlist );
+ if( i < 0 ) // case of the whole image
+ {
+ sprintf( tindex, "%d", i );
+ cvPutText( motion, tindex, center, &font, CV_RGB(255,255,255));
+ SETFLOAT(&rlist[0], i);
+ SETFLOAT(&rlist[1], center.x);
+ SETFLOAT(&rlist[2], center.y);
+ SETFLOAT(&rlist[3], comp_rect.width);
+ SETFLOAT(&rlist[4], comp_rect.height);
+ SETFLOAT(&rlist[5], angle);
+ outlet_list( m_dataout, 0, 6, rlist );
+ }
+ else
+ {
+ sprintf( tindex, "%d", ++j );
+ cvPutText( motion, tindex, center, &font, CV_RGB(255,255,255));
+ SETFLOAT(&rlist[0], j);
+ SETFLOAT(&rlist[1], center.x);
+ SETFLOAT(&rlist[2], center.y);
+ SETFLOAT(&rlist[3], comp_rect.width);
+ SETFLOAT(&rlist[4], comp_rect.height);
+ SETFLOAT(&rlist[5], angle);
+ outlet_list( m_dataout, 0, 6, rlist );
+ }
}
@@ -556,15 +586,30 @@ void pix_opencv_motempl :: processGrayImage(imageStruct &image)
cvLine( motion, 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( motion, tindex, center, &font, CV_RGB(255,255,255));
- SETFLOAT(&rlist[0], j);
- SETFLOAT(&rlist[1], center.x);
- SETFLOAT(&rlist[2], center.y);
- SETFLOAT(&rlist[3], comp_rect.width);
- SETFLOAT(&rlist[4], comp_rect.height);
- SETFLOAT(&rlist[5], angle);
- outlet_list( m_dataout, 0, 6, rlist );
+ if( i < 0 ) // case of the whole image
+ {
+ sprintf( tindex, "%d", i );
+ cvPutText( motion, tindex, center, &font, CV_RGB(255,255,255));
+ SETFLOAT(&rlist[0], i);
+ SETFLOAT(&rlist[1], center.x);
+ SETFLOAT(&rlist[2], center.y);
+ SETFLOAT(&rlist[3], comp_rect.width);
+ SETFLOAT(&rlist[4], comp_rect.height);
+ SETFLOAT(&rlist[5], angle);
+ outlet_list( m_dataout, 0, 6, rlist );
+ }
+ else
+ {
+ sprintf( tindex, "%d", ++j );
+ cvPutText( motion, tindex, center, &font, CV_RGB(255,255,255));
+ SETFLOAT(&rlist[0], j);
+ SETFLOAT(&rlist[1], center.x);
+ SETFLOAT(&rlist[2], center.y);
+ SETFLOAT(&rlist[3], comp_rect.width);
+ SETFLOAT(&rlist[4], comp_rect.height);
+ SETFLOAT(&rlist[5], angle);
+ outlet_list( m_dataout, 0, 6, rlist );
+ }
}