Distance movement left-right up-down RRS feed

  • General discussion

  • In my latest project, i want to create a remote control app. With the kinect sdk, i get the drepth,video,skeleton stream of data and the distance from the kinect to the head position detected by the skeleton (SkeletonFrame.SkeletonData[i].SkeletonPositions[NUI_SKELETON_POSITION_HEAD].z). With the help of opencv, i track the eye pupil in real time getting both coodinates(left,right pupil). So my question is this one: how can i calculate the distance(in meters) from the last position to the current position, when the users moves from left to right, and from up to down?

    I created a function that calculates the 3d distance from 2 FT_VECTOR3D points - the last know coordinates and the current coordinates, but this isn't specific for the right-left or up-down movement. I need to find a reference point or something like this. Another idea will be that after the face tracking starts, i do a calibration test and i save in a file the current position of the head joint, distance user-to-kinect,pitch,roll,yaw angles and for every frame i just calculate the distance from the current position to the one that i saved it in a file. I don't know how clear i've been regarding my question but if someone has any question, i ll be eager to respond in order to get a proper solution to this problem.

    float getDistanceMovementLeftRight(FT_VECTOR3D m_HeadPoint)
    	_lastPosition.x = _currentPosition.x;
    	_lastPosition.y = _currentPosition.y;
    	_lastPosition.z = _currentPosition.z;
    	_currentPosition.x = m_HeadPoint.x;
    	_currentPosition.y = m_HeadPoint.y;
    	_currentPosition.z = m_HeadPoint.z;
    	float _movementLeftRight = sqrt( pow((_currentPosition.x - _lastPosition.x),2) 
    							+ pow((_currentPosition.y - _lastPosition.y),2)
    							+ pow((_currentPosition.z - _lastPosition.z),2));
    	return _movementLeftRight;

    Monday, March 3, 2014 4:06 PM