Calculates the general motion direction in the selected region and returns the angle between 0 and 360. At first the function builds the orientation histogram and finds the basic orientation as a coordinate of the histogram maximum. After that the function calculates the shift relative to the basic orientation as a weighted sum of all orientation vectors: the more recent is the motion, the greater is the weight. The resultant angle is a circular sum of the basic orientation and the shift.

Namespace: Emgu.CV
Assembly: Emgu.CV (in Emgu.CV.dll) Version: 2.2.1.1150 (2.2.1.1150)

Syntax

         
 C#  Visual Basic  Visual C++ 
public static double cvCalcGlobalOrientation(
	IntPtr orientation,
	IntPtr mask,
	IntPtr mhi,
	double timestamp,
	double duration
)
Public Shared Function cvCalcGlobalOrientation ( _
	orientation As IntPtr, _
	mask As IntPtr, _
	mhi As IntPtr, _
	timestamp As Double, _
	duration As Double _
) As Double
public:
static double cvCalcGlobalOrientation(
	IntPtr orientation, 
	IntPtr mask, 
	IntPtr mhi, 
	double timestamp, 
	double duration
)

Parameters

orientation
IntPtr
Motion gradient orientation image; calculated by the function cvCalcMotionGradient.
mask
IntPtr
Mask image. It may be a conjunction of valid gradient mask, obtained with cvCalcMotionGradient and mask of the region, whose direction needs to be calculated.
mhi
IntPtr
Motion history image.
timestamp
Double
Current time in milliseconds or other units, it is better to store time passed to cvUpdateMotionHistory before and reuse it here, because running cvUpdateMotionHistory and cvCalcMotionGradient on large images may take some time.
duration
Double
Maximal duration of motion track in milliseconds, the same as in cvUpdateMotionHistory

Return Value

The angle

See Also