2015-03-23 20:27:36 -0500 commented question (opencv249\sources\samples\c\motempl.c): cvCalcGlobalOrientation always get 0 angle in Ubuntu Linux? Hi, yesterday until now troobleshooting about this problem, but still have no outcomes:( I tried the way to insert the codes for cvCalcGlobalOrientation, and then calling it as a function in my update_mhi().......but the result still the same, cvCalcGlobalOrientation still return zero.... did anyone facing the same/similar problem when using this cvCalcGlobalOrientation function in linux platform? please share your experience or give any advice/suggestion, thank you so much. 2015-03-23 02:54:15 -0500 asked a question (opencv249\sources\samples\c\motempl.c): cvCalcGlobalOrientation always get 0 angle in Ubuntu Linux? I am doing a project which using the motempl.c in opencv, which I use it to detect the motion and compute the direction of the moving objects. The codes for the motemp1.c can be found in samples folder of opencv (opencv249\sources\samples\c\motempl.c) However, one weird thing happened as the motempl.c is running flawlessly in window (I use window visual studio 2010), but when I run it in linux platform, everything seems normal, except the angles which displayed in the small red circles and the big white circle are always zero. I compare the codes between the Window and the Ubuntu, and they are the same. So, after I am checking again, I am suspecting this is caused by the "cvCalGlobalOrientation" function in opencv.It seems like "cvCalGlobalOrientation" function doesn't compute the angle and the direction of the detected motion. My reason for this is because the codes that following it is the drawing of the line in the circles which indicate the direction and angle of the detected motion, and the angle of the line inside the circle is based on the angle which computed by "cvCalcGlobalOrientation". Thus, if the angle displayed in the result is always zero, means there is something wrong in this function "cvCalcGlobalOrientation"? but, it works fine in the window platform. Part of the codes for this issue is as shown below: (complete code: opencv249\sources\samples\c\motempl.c)  angle = cvCalcGlobalOrientation( orient, mask, mhi, timestamp, MHI_DURATION); angle = 360.0 - angle; // adjust for images with top-left origin count = cvNorm( silh, 0, CV_L1, 0 ); // calculate number of points within silhouette ROI cvResetImageROI( mhi ); cvResetImageROI( orient ); cvResetImageROI( mask ); cvResetImageROI( silh ); // check for the case of little motion if( count < comp_rect.width*comp_rect.height * 0.05 ) continue; // draw a clock with arrow indicating the direction center = cvPoint( (comp_rect.x + comp_rect.width/2), (comp_rect.y + comp_rect.height/2) ); cvCircle( dst, center, cvRound(magnitude*1.2), color, 3, CV_AA, 0 ); 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 );  Can anyone please give some advice about this? Really appreciate)