Kinect-v2 Unity Examples - KinectScripts  2.20.0
KinectManager Class Reference

KinectManager is the main and the most basic Kinect-related component. It is used to control the sensor and poll the data streams. More...

Inheritance diagram for KinectManager:

Public Types

enum  AutoHeightAngle : int { DontUse, ShowInfoOnly, AutoUpdate, AutoUpdateAndShowInfo }
 
enum  UserMapType : int {
  None, RawUserDepth, BodyTexture, UserTexture,
  CutOutTexture
}
 
enum  UserDetectionOrder : int { Appearance = 0, Distance = 1, LeftToRight = 2 }
 
enum  Smoothing : int {
  None, Default, Light, Medium,
  Aggressive
}
 
enum  AllowedRotations : int { None = 0, Default = 1, All = 2 }
 

Public Member Functions

bool IsInitialized ()
 Determines if the sensor and KinectManager-component are initialized and ready to use. More...
 
KinectInterop.DepthSensorPlatform GetSensorPlatform ()
 Gets the selected depth-sensor platform. More...
 
int GetBodyCount ()
 Gets the number of bodies, tracked by the sensor. More...
 
int GetJointCount ()
 Gets the the number of body joints, tracked by the sensor. More...
 
KinectInterop.JointType GetParentJoint (KinectInterop.JointType joint)
 Gets the parent joint of the given joint. More...
 
KinectInterop.JointType GetNextJoint (KinectInterop.JointType joint)
 Gets the next joint of the given joint. More...
 
int GetColorImageWidth ()
 Gets the width of the color image, returned by the sensor. More...
 
int GetColorImageHeight ()
 Gets the height of the color image, returned by the sensor. More...
 
Vector3 GetColorImageScale ()
 Gets the color image scale. More...
 
Vector3 GetDepthImageScale ()
 Gets the depth image scale. More...
 
long GetColorFrameTime ()
 Gets the last color frame time, as returned by the sensor. More...
 
long GetDepthFrameTime ()
 Gets the last depth frame time, as returned by the sensor. More...
 
int GetDepthImageWidth ()
 Gets the width of the depth image, returned by the sensor. More...
 
int GetDepthImageHeight ()
 Gets the height of the depth image, returned by the sensor. More...
 
byte [] GetRawBodyIndexMap ()
 Gets the raw body index data, if ComputeUserMap is true. More...
 
ushort [] GetRawDepthMap ()
 Gets the raw depth data, if ComputeUserMap is true. More...
 
ushort [] GetRawInfraredMap ()
 Gets the raw infrared data, if ComputeInfraredMap is true. More...
 
Texture GetUsersLblTex ()
 Gets the users texture, if ComputeUserMap is true More...
 
Texture2D GetUsersLblTex2D ()
 Gets the users 2d-texture, if ComputeUserMap is true More...
 
Texture GetUsersClrTex ()
 Gets the color image texture,if ComputeColorMap is true More...
 
Texture2D GetUsersClrTex2D ()
 Gets the color image 2d-texture,if ComputeColorMap is true More...
 
bool IsUserDetected ()
 Determines whether at least one user is currently detected by the sensor More...
 
bool IsUserDetected (int i)
 Determines whether the user with the specified index is currently detected by the sensor More...
 
bool IsUserTracked (Int64 userId)
 Determines whether the user with the specified userId is in the list of tracked users or not. More...
 
int GetUsersCount ()
 Gets the number of currently tracked users. More...
 
List< long > GetAllUserIds ()
 Gets the IDs of all currently tracked users. More...
 
int GetMaxUserIndex ()
 Gets the max player-index of the currently tracked users. More...
 
List< int > GetAllUserIndices ()
 Gets the player indices of all currently tracked users. More...
 
Int64 GetUserIdByIndex (int i)
 Gets the user ID by the specified user index. More...
 
int GetUserIndexById (Int64 userId)
 Gets the user index by the specified user ID. More...
 
int GetBodyIndexByUserId (Int64 userId)
 Gets the body index by the specified user ID, or -1 if the user ID does not exist. More...
 
List< int > GetTrackedBodyIndices ()
 Gets the list of tracked body indices. More...
 
bool IsTrackedUsersLimited ()
 Determines whether the tracked users are limited by their number or distance or not. More...
 
Int64 GetPrimaryUserID ()
 Gets the UserID of the primary user (the first or the closest one), or 0 if no user is detected. More...
 
bool SetPrimaryUserID (Int64 userId)
 Sets the primary user ID, in order to change the active user. More...
 
int GetDisplayedBodyIndex ()
 Gets the body index [0-5], if there is single body selected to be displayed on the user map, or -1 if all bodies are displayed. More...
 
bool SetDisplayedBodyIndex (int iBodyIndex)
 Sets the body index [0-5], if a single body must be displayed on the user map, or -1 if all bodies must be displayed. More...
 
long GetBodyFrameTimestamp ()
 Gets the last body frame timestamp. More...
 
Matrix4x4 GetKinectToWorldMatrix ()
 Gets the kinect to world matrix. More...
 
void UpdateKinectToWorldMatrix ()
 Updates the kinect to world transform matrix, according to the current values of SensorHeight, SensorAngle and FlipLeftRight. More...
 
void SetKinectToWorldMatrix (Vector3 sensorPos, Quaternion sensorRot, Vector3 sensorScale)
 Sets the kinect to world matrix. More...
 
Vector3 GetUserKinectPosition (Int64 userId)
 Gets the user position in Kinect coordinate system, in meters. More...
 
Vector3 GetUserPosition (Int64 userId)
 Gets the user position, relative to the sensor, in meters. More...
 
Quaternion GetUserOrientation (Int64 userId, bool flip)
 Gets the user orientation. More...
 
KinectInterop.TrackingState GetJointTrackingState (Int64 userId, int joint)
 Gets the tracking state of the joint. More...
 
bool IsJointTracked (Int64 userId, int joint)
 Determines whether the given joint of the specified user is being tracked. More...
 
Vector3 GetJointKinectPosition (Int64 userId, int joint)
 Gets the joint position of the specified user, in Kinect coordinate system, in meters. More...
 
Vector3 GetJointPosition (Int64 userId, int joint)
 Gets the joint position of the specified user, in meters. More...
 
Vector3 GetJointPositionFlipX (Int64 userId, int joint)
 Gets the joint position of the specified user with flipped x-coordinate, in meters. More...
 
Vector3 GetJointVelocity (Int64 userId, int joint)
 Gets the joint velocity for the specified user and joint, in meters/s. More...
 
Vector3 GetJointDirection (Int64 userId, int joint, bool flipX, bool flipZ)
 Gets the joint direction of the specified user, relative to its parent joint. More...
 
Vector3 GetDirectionBetweenJoints (Int64 userId, int firstJoint, int secondJoint, bool flipX, bool flipZ)
 Gets the direction between the given joints of the specified user. More...
 
Quaternion GetJointOrientation (Int64 userId, int joint, bool flip)
 Gets the joint orientation of the specified user. More...
 
float GetAngleAtJoint (Int64 userId, int joint)
 Gets the angle between bones at the given joint. More...
 
Vector3 GetJointPosDepthOverlay (Int64 userId, int joint, Camera camera, Rect imageRect)
 Gets the 3d overlay position of the given joint over the depth-image. More...
 
Vector3 GetJointPosColorOverlay (Int64 userId, int joint, Camera camera, Rect imageRect)
 Gets the 3d overlay position of the given joint over the color-image. More...
 
Vector2 GetJointPosColorOverlay (Int64 userId, int joint, Rect imageRect)
 Gets the 2d overlay position of the given joint over the given image. More...
 
Vector2 GetJointDepthMapPos (Int64 userId, int joint)
 Gets the joint position on the depth map texture. More...
 
Vector2 GetJointColorMapPos (Int64 userId, int joint)
 Gets the joint position on the color map texture. More...
 
bool IsUserTurnedAround (Int64 userId)
 Determines whether the given user is turned around or not. More...
 
bool IsLeftHandConfidenceHigh (Int64 userId)
 Determines whether the left hand confidence is high for the specified user. More...
 
bool IsRightHandConfidenceHigh (Int64 userId)
 Determines whether the right hand confidence is high for the specified user. More...
 
KinectInterop.HandState GetLeftHandState (Int64 userId)
 Gets the left hand state for the specified user. More...
 
KinectInterop.HandState GetRightHandState (Int64 userId)
 Gets the right hand state for the specified user. More...
 
bool GetLeftHandInteractionBox (Int64 userId, ref Vector3 leftBotBack, ref Vector3 rightTopFront, bool bValidBox)
 Gets the left hand interaction box for the specified user. More...
 
bool GetRightHandInteractionBox (Int64 userId, ref Vector3 leftBotBack, ref Vector3 rightTopFront, bool bValidBox)
 Gets the right hand interaction box for the specified user. More...
 
Rect GetForegroundRectDepth (Camera foregroundCamera)
 Gets the foreground rectangle of the depth image. More...
 
Rect GetForegroundRectColor (Camera foregroundCamera)
 Gets the foreground rectangle of the color image.. More...
 
Vector3 GetPosDepthOverlay (int dx, int dy, ushort depth, Camera camera, Rect imageRect)
 Gets the 3d overlay position of a point over the depth-image. More...
 
ushort GetDepthForPixel (int x, int y)
 Gets the depth value for the specified pixel, if ComputeUserMap is true. More...
 
ushort GetDepthForIndex (int index)
 Gets the depth value for the specified pixel, if ComputeUserMap is true. More...
 
Vector3 MapDepthPointToSpaceCoords (Vector2 posPoint, ushort depthValue, bool bWorldCoords)
 Returns the space coordinates of a depth-map point, or Vector3.zero if the sensor is not initialized More...
 
bool MapDepthFrameToSpaceCoords (ref Vector3[] avSpaceCoords)
 Maps the depth frame to space coordinates. More...
 
Vector2 MapSpacePointToDepthCoords (Vector3 posPoint)
 Returns the depth-map coordinates of a space point, or Vector2.zero if Kinect is not initialized More...
 
Vector2 MapDepthPointToColorCoords (Vector2 posPoint, ushort depthValue)
 Returns the color-map coordinates of a depth point. More...
 
bool MapDepthFrameToColorCoords (ref Vector2[] avColorCoords)
 Maps the depth frame to color coordinates. More...
 
bool MapColorFrameToDepthCoords (ref Vector2[] avDepthCoords)
 Maps the color frame to depth coordinates. More...
 
Vector2 MapColorPointToDepthCoords (Vector2 colorPos, bool bReadDepthCoordsIfNeeded)
 Returns the depth-map coordinates of a color point. More...
 
void ClearKinectUsers ()
 Removes all currently detected users, allowing new user-detection process to start. More...
 
void ResetFilters ()
 Resets the Kinect data filters. More...
 
void DetectGesture (Int64 UserId, KinectGestures.Gestures gesture)
 Adds a gesture to the list of detected gestures for the specified user. More...
 
bool ResetGesture (Int64 UserId, KinectGestures.Gestures gesture)
 Resets the gesture state for the given gesture of the specified user. More...
 
void ResetPlayerGestures (Int64 UserId)
 Resets the gesture states for all gestures of the specified user. More...
 
bool DeleteGesture (Int64 UserId, KinectGestures.Gestures gesture)
 Deletes the gesture for the specified user. More...
 
void ClearGestures (Int64 UserId)
 Deletes all gestures for the specified user. More...
 
List< KinectGestures.GesturesGetGesturesList (Int64 UserId)
 Gets the list of gestures for the specified user. More...
 
int GetGesturesCount (Int64 UserId)
 Gets the gestures count for the specified user. More...
 
KinectGestures.Gestures GetGestureAtIndex (Int64 UserId, int i)
 Gets the gesture at the specified index for the given user. More...
 
bool IsTrackingGesture (Int64 UserId, KinectGestures.Gestures gesture)
 Determines whether the given gesture is in the list of gestures for the specified user. More...
 
bool IsGestureComplete (Int64 UserId, KinectGestures.Gestures gesture, bool bResetOnComplete)
 Determines whether the given gesture for the specified user is complete. More...
 
bool IsGestureCancelled (Int64 UserId, KinectGestures.Gestures gesture)
 Determines whether the given gesture for the specified user is canceled. More...
 
float GetGestureProgress (Int64 UserId, KinectGestures.Gestures gesture)
 Gets the progress (in range [0, 1]) of the given gesture for the specified user. More...
 
Vector3 GetGestureScreenPos (Int64 UserId, KinectGestures.Gestures gesture)
 Gets the normalized screen position of the given gesture for the specified user. More...
 
string GetWorldMatrixData (char delimiter)
 Gets the world matrix data as one csv line. More...
 
string GetBodyHandData (ref long liRelTime, char delimiter)
 Gets the body hand as one csv line, or returns empty string if there is no new body frame. More...
 
string GetBodyFrameData (ref long liRelTime, ref float fUnityTime, char delimiter)
 Gets the body frame as one csv line, or returns empty string if there is no new body frame. More...
 
string GetBodyFrameDataK4b (ref long liRelTime, ref float fUnityTime, char delimiter)
 Gets the body frame as one csv line (k4b style), or returns empty string if there is no new body frame. More...
 
bool IsPlayModeEnabled ()
 Determines whether the play mode is enabled or not. More...
 
void EnablePlayMode (bool bEnabled)
 Enables or displables the play mode. More...
 
bool SetWorldMatrixData (string sLine)
 Sets the world matrix data from the given csv line. More...
 
bool SetBodyHandData (string sLine)
 Sets the body hand data from the given csv line. More...
 
bool SetBodyFrameData (string sLine)
 Sets the body frame from the given csv line. More...
 
void RenderUserImageTexture (long userId, RenderTexture texture)
 
virtual void RearrangeUserIndices ()
 Rearranges the user indices, according to the current criteria More...
 
void RefreshAvatarUserIds ()
 Refreshs the userIds of all available avatar controllers, after new user appears in front of the sensor, or when some user gets lost. More...
 
void refreshGestureListeners ()
 Refreshs the gesture listeners' list. More...
 
void refreshAvatarControllers ()
 Refreshs the avatar controllers' list. More...
 

Static Public Member Functions

static bool IsKinectInitialized ()
 Determines if the sensor and KinectManager-component are initialized and ready to use. More...
 

Public Attributes

float sensorHeight = 1.0f
 
float sensorAngle = 0f
 
AutoHeightAngle autoHeightAngle = AutoHeightAngle.DontUse
 
UserMapType computeUserMap = UserMapType.RawUserDepth
 
bool computeColorMap = false
 
bool computeInfraredMap = false
 
bool displayUserMap = false
 
bool displayColorMap = false
 
bool displaySkeletonLines = false
 
float DisplayMapsWidthPercent = 20f
 
bool useMultiSourceReader = false
 
float minUserDistance = 0.5f
 
float maxUserDistance = 0f
 
float maxLeftRightDistance = 0f
 
int maxTrackedUsers = 6
 
bool showTrackedUsersOnly = true
 
UserDetectionOrder userDetectionOrder = UserDetectionOrder.Appearance
 
bool ignoreInferredJoints = false
 
bool ignoreZCoordinates = false
 
bool lateUpdateAvatars = false
 
bool skipRemoteAvatars = false
 
Smoothing smoothing = Smoothing.Default
 
bool useBoneOrientationConstraints = false
 
bool estimateJointVelocities = false
 
Smoothing velocitySmoothing = Smoothing.Light
 
bool allowTurnArounds = false
 
AllowedRotations allowedHandRotations = AllowedRotations.Default
 
float waitTimeBeforeRemove = 1f
 
List< AvatarControlleravatarControllers = new List<AvatarController>()
 
KinectGestures.Gestures playerCalibrationPose
 
List< KinectGestures.GesturesplayerCommonGestures = new List<KinectGestures.Gestures>()
 
float minTimeBetweenGestures = 0.7f
 
KinectGestures gestureManager
 
List< MonoBehaviour > gestureListeners = new List<MonoBehaviour>()
 
UnityEngine.UI.Text calibrationText
 
UnityEngine.UI.Text gesturesDebugText
 

Properties

static KinectManager Instance [get]
 Gets the single KinectManager instance. More...
 

Detailed Description

KinectManager is the main and the most basic Kinect-related component. It is used to control the sensor and poll the data streams.

Member Function Documentation

◆ ClearGestures()

void KinectManager.ClearGestures ( Int64  UserId)

Deletes all gestures for the specified user.

Parameters
UserIdUser ID

◆ ClearKinectUsers()

void KinectManager.ClearKinectUsers ( )

Removes all currently detected users, allowing new user-detection process to start.

◆ DeleteGesture()

bool KinectManager.DeleteGesture ( Int64  UserId,
KinectGestures.Gestures  gesture 
)

Deletes the gesture for the specified user.

Returns
true, if gesture was deleted, false otherwise.
Parameters
UserIdUser ID
gestureGesture type

◆ DetectGesture()

void KinectManager.DetectGesture ( Int64  UserId,
KinectGestures.Gestures  gesture 
)

Adds a gesture to the list of detected gestures for the specified user.

Parameters
UserIdUser ID
gestureGesture type

◆ EnablePlayMode()

void KinectManager.EnablePlayMode ( bool  bEnabled)

Enables or displables the play mode.

Parameters
bEnabledIf set to true enables the play mode.

◆ GetAllUserIds()

List<long> KinectManager.GetAllUserIds ( )

Gets the IDs of all currently tracked users.

Returns
The list of all currently tracked users.

◆ GetAllUserIndices()

List<int> KinectManager.GetAllUserIndices ( )

Gets the player indices of all currently tracked users.

Returns
The list of player-indices of all tracked users.

◆ GetAngleAtJoint()

float KinectManager.GetAngleAtJoint ( Int64  userId,
int  joint 
)

Gets the angle between bones at the given joint.

Returns
The angle at joint.
Parameters
userIdUser ID
jointJoint index

◆ GetBodyCount()

int KinectManager.GetBodyCount ( )

Gets the number of bodies, tracked by the sensor.

Returns
The body count.

◆ GetBodyFrameData()

string KinectManager.GetBodyFrameData ( ref long  liRelTime,
ref float  fUnityTime,
char  delimiter 
)

Gets the body frame as one csv line, or returns empty string if there is no new body frame.

Returns
The body frame as a csv line.
Parameters
liRelTimeReference to variable, used to compare frame times.
fUnityTimeReference to variable, used to save the current Unity time.

◆ GetBodyFrameDataK4b()

string KinectManager.GetBodyFrameDataK4b ( ref long  liRelTime,
ref float  fUnityTime,
char  delimiter 
)

Gets the body frame as one csv line (k4b style), or returns empty string if there is no new body frame.

Returns
The body frame as a csv line.
Parameters
liRelTimeReference to variable, used to compare frame times.
fUnityTimeReference to variable, used to save the current Unity time.

◆ GetBodyFrameTimestamp()

long KinectManager.GetBodyFrameTimestamp ( )

Gets the last body frame timestamp.

Returns
The last body frame timestamp.

◆ GetBodyHandData()

string KinectManager.GetBodyHandData ( ref long  liRelTime,
char  delimiter 
)

Gets the body hand as one csv line, or returns empty string if there is no new body frame.

Returns
The body hand as a csv line.
Parameters
liRelTimeReference to variable, used to compare frame times.

◆ GetBodyIndexByUserId()

int KinectManager.GetBodyIndexByUserId ( Int64  userId)

Gets the body index by the specified user ID, or -1 if the user ID does not exist.

Returns
The body index by user ID.
Parameters
userIdUser ID

◆ GetColorFrameTime()

long KinectManager.GetColorFrameTime ( )

Gets the last color frame time, as returned by the sensor.

Returns
The color frame time.

◆ GetColorImageHeight()

int KinectManager.GetColorImageHeight ( )

Gets the height of the color image, returned by the sensor.

Returns
The color image height.

◆ GetColorImageScale()

Vector3 KinectManager.GetColorImageScale ( )

Gets the color image scale.

Returns
The color image scale.

◆ GetColorImageWidth()

int KinectManager.GetColorImageWidth ( )

Gets the width of the color image, returned by the sensor.

Returns
The color image width.

◆ GetDepthForIndex()

ushort KinectManager.GetDepthForIndex ( int  index)

Gets the depth value for the specified pixel, if ComputeUserMap is true.

Returns
The depth value.
Parameters
indexDepth index.

◆ GetDepthForPixel()

ushort KinectManager.GetDepthForPixel ( int  x,
int  y 
)

Gets the depth value for the specified pixel, if ComputeUserMap is true.

Returns
The depth value.
Parameters
xThe X coordinate of the pixel.
yThe Y coordinate of the pixel.

◆ GetDepthFrameTime()

long KinectManager.GetDepthFrameTime ( )

Gets the last depth frame time, as returned by the sensor.

Returns
The depth frame time.

◆ GetDepthImageHeight()

int KinectManager.GetDepthImageHeight ( )

Gets the height of the depth image, returned by the sensor.

Returns
The depth image height.

◆ GetDepthImageScale()

Vector3 KinectManager.GetDepthImageScale ( )

Gets the depth image scale.

Returns
The depth image scale.

◆ GetDepthImageWidth()

int KinectManager.GetDepthImageWidth ( )

Gets the width of the depth image, returned by the sensor.

Returns
The depth image width.

◆ GetDirectionBetweenJoints()

Vector3 KinectManager.GetDirectionBetweenJoints ( Int64  userId,
int  firstJoint,
int  secondJoint,
bool  flipX,
bool  flipZ 
)

Gets the direction between the given joints of the specified user.

Returns
The direction between joints.
Parameters
userIdUser ID
firstJointFirst joint index
secondJointSecond joint index
flipXIf set to true flips the X-coordinate
flipZIf set to true flips the Z-coordinate

◆ GetDisplayedBodyIndex()

int KinectManager.GetDisplayedBodyIndex ( )

Gets the body index [0-5], if there is single body selected to be displayed on the user map, or -1 if all bodies are displayed.

Returns
The displayed body index [0-5], or -1 if all bodies are displayed.

◆ GetForegroundRectColor()

Rect KinectManager.GetForegroundRectColor ( Camera  foregroundCamera)

Gets the foreground rectangle of the color image..

Parameters
foregroundCameraThe foreground camera, or null if there is no foreground camera.
Returns
The foreground rectangle.

◆ GetForegroundRectDepth()

Rect KinectManager.GetForegroundRectDepth ( Camera  foregroundCamera)

Gets the foreground rectangle of the depth image.

Parameters
foregroundCameraThe foreground camera, or null if there is no foreground camera.
Returns
The foreground rectangle.

◆ GetGestureAtIndex()

KinectGestures.Gestures KinectManager.GetGestureAtIndex ( Int64  UserId,
int  i 
)

Gets the gesture at the specified index for the given user.

Returns
The gesture at specified index.
Parameters
UserIdUser ID
iIndex

◆ GetGestureProgress()

float KinectManager.GetGestureProgress ( Int64  UserId,
KinectGestures.Gestures  gesture 
)

Gets the progress (in range [0, 1]) of the given gesture for the specified user.

Returns
The gesture progress.
Parameters
UserIdUser ID
gestureGesture type

◆ GetGesturesCount()

int KinectManager.GetGesturesCount ( Int64  UserId)

Gets the gestures count for the specified user.

Returns
The gestures count.
Parameters
UserIdUser ID

◆ GetGestureScreenPos()

Vector3 KinectManager.GetGestureScreenPos ( Int64  UserId,
KinectGestures.Gestures  gesture 
)

Gets the normalized screen position of the given gesture for the specified user.

Returns
The normalized screen position.
Parameters
UserIdUser ID
gestureGesture type

◆ GetGesturesList()

List<KinectGestures.Gestures> KinectManager.GetGesturesList ( Int64  UserId)

Gets the list of gestures for the specified user.

Returns
The gestures list.
Parameters
UserIdUser ID

◆ GetJointColorMapPos()

Vector2 KinectManager.GetJointColorMapPos ( Int64  userId,
int  joint 
)

Gets the joint position on the color map texture.

Returns
The joint position in texture coordinates.
Parameters
userIdUser ID
jointJoint index

◆ GetJointCount()

int KinectManager.GetJointCount ( )

Gets the the number of body joints, tracked by the sensor.

Returns
The count of joints.

◆ GetJointDepthMapPos()

Vector2 KinectManager.GetJointDepthMapPos ( Int64  userId,
int  joint 
)

Gets the joint position on the depth map texture.

Returns
The joint position in texture coordinates.
Parameters
userIdUser ID
jointJoint index

◆ GetJointDirection()

Vector3 KinectManager.GetJointDirection ( Int64  userId,
int  joint,
bool  flipX,
bool  flipZ 
)

Gets the joint direction of the specified user, relative to its parent joint.

Returns
The joint direction.
Parameters
userIdUser ID
jointJoint index
flipXIf set to true flips the X-coordinate
flipZIf set to true flips the Z-coordinate

◆ GetJointKinectPosition()

Vector3 KinectManager.GetJointKinectPosition ( Int64  userId,
int  joint 
)

Gets the joint position of the specified user, in Kinect coordinate system, in meters.

Returns
The joint kinect position.
Parameters
userIdUser ID
jointJoint index

◆ GetJointOrientation()

Quaternion KinectManager.GetJointOrientation ( Int64  userId,
int  joint,
bool  flip 
)

Gets the joint orientation of the specified user.

Returns
The joint rotation.
Parameters
userIdUser ID
jointJoint index
flipIf set to true, this means non-mirrored rotation

◆ GetJointPosColorOverlay() [1/2]

Vector3 KinectManager.GetJointPosColorOverlay ( Int64  userId,
int  joint,
Camera  camera,
Rect  imageRect 
)

Gets the 3d overlay position of the given joint over the color-image.

Returns
The joint position for color overlay.
Parameters
userIdUser ID
jointJoint index
cameraCamera used to visualize the 3d overlay position
imageRectColor image rectangle on the screen

◆ GetJointPosColorOverlay() [2/2]

Vector2 KinectManager.GetJointPosColorOverlay ( Int64  userId,
int  joint,
Rect  imageRect 
)

Gets the 2d overlay position of the given joint over the given image.

Returns
The 2d joint position for color overlay.
Parameters
userIdUser ID
jointJoint index
imageRectColor image rectangle on the screen

◆ GetJointPosDepthOverlay()

Vector3 KinectManager.GetJointPosDepthOverlay ( Int64  userId,
int  joint,
Camera  camera,
Rect  imageRect 
)

Gets the 3d overlay position of the given joint over the depth-image.

Returns
The joint position for depth overlay.
Parameters
userIdUser ID
jointJoint index
cameraCamera used to visualize the 3d overlay position
imageRectDepth image rectangle on the screen

◆ GetJointPosition()

Vector3 KinectManager.GetJointPosition ( Int64  userId,
int  joint 
)

Gets the joint position of the specified user, in meters.

Returns
The joint position.
Parameters
userIdUser ID
jointJoint index

◆ GetJointPositionFlipX()

Vector3 KinectManager.GetJointPositionFlipX ( Int64  userId,
int  joint 
)

Gets the joint position of the specified user with flipped x-coordinate, in meters.

Returns
The joint position.
Parameters
userIdUser ID
jointJoint index

◆ GetJointTrackingState()

KinectInterop.TrackingState KinectManager.GetJointTrackingState ( Int64  userId,
int  joint 
)

Gets the tracking state of the joint.

Returns
The joint tracking state.
Parameters
userIdUser ID
jointJoint index

◆ GetJointVelocity()

Vector3 KinectManager.GetJointVelocity ( Int64  userId,
int  joint 
)

Gets the joint velocity for the specified user and joint, in meters/s.

Returns
The joint velocity.
Parameters
userIdUser ID.
jointJoint index.

◆ GetKinectToWorldMatrix()

Matrix4x4 KinectManager.GetKinectToWorldMatrix ( )

Gets the kinect to world matrix.

Returns
The kinect to world matrix.

◆ GetLeftHandInteractionBox()

bool KinectManager.GetLeftHandInteractionBox ( Int64  userId,
ref Vector3  leftBotBack,
ref Vector3  rightTopFront,
bool  bValidBox 
)

Gets the left hand interaction box for the specified user.

Returns
true, if left hand interaction box was gotten, false otherwise.
Parameters
userIdUser ID
leftBotBackVector containing the left, bottom and back coordinates, in meters
rightTopFrontVector containing the right, top and front coordinates, in meters
bValidBoxIf set to true, the previously set coordinates are valid

◆ GetLeftHandState()

KinectInterop.HandState KinectManager.GetLeftHandState ( Int64  userId)

Gets the left hand state for the specified user.

Returns
The left hand state.
Parameters
userIdUser ID

◆ GetMaxUserIndex()

int KinectManager.GetMaxUserIndex ( )

Gets the max player-index of the currently tracked users.

Returns
The max player-index of the tracked users.

◆ GetNextJoint()

KinectInterop.JointType KinectManager.GetNextJoint ( KinectInterop.JointType  joint)

Gets the next joint of the given joint.

Returns
The next joint.
Parameters
jointJoint.

◆ GetParentJoint()

KinectInterop.JointType KinectManager.GetParentJoint ( KinectInterop.JointType  joint)

Gets the parent joint of the given joint.

Returns
The parent joint.
Parameters
jointJoint.

◆ GetPosDepthOverlay()

Vector3 KinectManager.GetPosDepthOverlay ( int  dx,
int  dy,
ushort  depth,
Camera  camera,
Rect  imageRect 
)

Gets the 3d overlay position of a point over the depth-image.

Returns
The 3d position for depth overlay.
Parameters
dxDepth image X
dyDepth image X
depthDistance in mm. If it is 0, the function will try to read the current depth value.
cameraCamera used to visualize the 3d overlay position
imageRectDepth image rectangle on the screen

◆ GetPrimaryUserID()

Int64 KinectManager.GetPrimaryUserID ( )

Gets the UserID of the primary user (the first or the closest one), or 0 if no user is detected.

Returns
The primary user ID.

◆ GetRawBodyIndexMap()

byte [] KinectManager.GetRawBodyIndexMap ( )

Gets the raw body index data, if ComputeUserMap is true.

Returns
The raw body index data.

◆ GetRawDepthMap()

ushort [] KinectManager.GetRawDepthMap ( )

Gets the raw depth data, if ComputeUserMap is true.

Returns
The raw depth map.

◆ GetRawInfraredMap()

ushort [] KinectManager.GetRawInfraredMap ( )

Gets the raw infrared data, if ComputeInfraredMap is true.

Returns
The raw infrared map.

◆ GetRightHandInteractionBox()

bool KinectManager.GetRightHandInteractionBox ( Int64  userId,
ref Vector3  leftBotBack,
ref Vector3  rightTopFront,
bool  bValidBox 
)

Gets the right hand interaction box for the specified user.

Returns
true, if right hand interaction box was gotten, false otherwise.
Parameters
userIdUser ID
leftBotBackVector containing the left, bottom and back coordinates, in meters
rightTopFrontector containing the right, top and front coordinates, in meters
bValidBoxIf set to true, the previously set coordinates are valid

◆ GetRightHandState()

KinectInterop.HandState KinectManager.GetRightHandState ( Int64  userId)

Gets the right hand state for the specified user.

Returns
The right hand state.
Parameters
userIdUser ID

◆ GetSensorPlatform()

KinectInterop.DepthSensorPlatform KinectManager.GetSensorPlatform ( )

Gets the selected depth-sensor platform.

Returns
The selected depth-sensor platform.

◆ GetTrackedBodyIndices()

List<int> KinectManager.GetTrackedBodyIndices ( )

Gets the list of tracked body indices.

Returns
The list of body indices.

◆ GetUserIdByIndex()

Int64 KinectManager.GetUserIdByIndex ( int  i)

Gets the user ID by the specified user index.

Returns
The user ID by index.
Parameters
iThe user index.

◆ GetUserIndexById()

int KinectManager.GetUserIndexById ( Int64  userId)

Gets the user index by the specified user ID.

Returns
The user index by user ID.
Parameters
userIdUser ID

◆ GetUserKinectPosition()

Vector3 KinectManager.GetUserKinectPosition ( Int64  userId)

Gets the user position in Kinect coordinate system, in meters.

Returns
The user kinect position.
Parameters
userIdUser ID

◆ GetUserOrientation()

Quaternion KinectManager.GetUserOrientation ( Int64  userId,
bool  flip 
)

Gets the user orientation.

Returns
The user rotation.
Parameters
userIdUser ID
flipIf set to true, this means non-mirrored rotation.

◆ GetUserPosition()

Vector3 KinectManager.GetUserPosition ( Int64  userId)

Gets the user position, relative to the sensor, in meters.

Returns
The user position.
Parameters
userIdUser ID

◆ GetUsersClrTex()

Texture KinectManager.GetUsersClrTex ( )

Gets the color image texture,if ComputeColorMap is true

Returns
The color image texture.

◆ GetUsersClrTex2D()

Texture2D KinectManager.GetUsersClrTex2D ( )

Gets the color image 2d-texture,if ComputeColorMap is true

Returns
The color image 2d-texture.

◆ GetUsersCount()

int KinectManager.GetUsersCount ( )

Gets the number of currently tracked users.

Returns
The users count.

◆ GetUsersLblTex()

Texture KinectManager.GetUsersLblTex ( )

Gets the users texture, if ComputeUserMap is true

Returns
The users texture.

◆ GetUsersLblTex2D()

Texture2D KinectManager.GetUsersLblTex2D ( )

Gets the users 2d-texture, if ComputeUserMap is true

Returns
The users 2d-texture.

◆ GetWorldMatrixData()

string KinectManager.GetWorldMatrixData ( char  delimiter)

Gets the world matrix data as one csv line.

Returns
The world matrix data as a csv line.

◆ IsGestureCancelled()

bool KinectManager.IsGestureCancelled ( Int64  UserId,
KinectGestures.Gestures  gesture 
)

Determines whether the given gesture for the specified user is canceled.

Returns
true if the gesture is canceled; otherwise, false.
Parameters
UserIdUser ID
gestureGesture type

◆ IsGestureComplete()

bool KinectManager.IsGestureComplete ( Int64  UserId,
KinectGestures.Gestures  gesture,
bool  bResetOnComplete 
)

Determines whether the given gesture for the specified user is complete.

Returns
true if the gesture is complete; otherwise, false.
Parameters
UserIdUser ID
gestureGesture type
bResetOnCompleteIf set to true, resets the gesture state.

◆ IsInitialized()

bool KinectManager.IsInitialized ( )

Determines if the sensor and KinectManager-component are initialized and ready to use.

Returns
true if Kinect is initialized; otherwise, false.

◆ IsJointTracked()

bool KinectManager.IsJointTracked ( Int64  userId,
int  joint 
)

Determines whether the given joint of the specified user is being tracked.

Returns
true if this instance is joint tracked the specified userId joint; otherwise, false.
Parameters
userIdUser ID
jointJoint index

◆ IsKinectInitialized()

static bool KinectManager.IsKinectInitialized ( )
static

Determines if the sensor and KinectManager-component are initialized and ready to use.

Returns
true if Kinect is initialized; otherwise, false.

◆ IsLeftHandConfidenceHigh()

bool KinectManager.IsLeftHandConfidenceHigh ( Int64  userId)

Determines whether the left hand confidence is high for the specified user.

Returns
true if the left hand confidence is high; otherwise, false.
Parameters
userIdUser ID

◆ IsPlayModeEnabled()

bool KinectManager.IsPlayModeEnabled ( )

Determines whether the play mode is enabled or not.

Returns
true if the play mode is enabled; otherwise, false.

◆ IsRightHandConfidenceHigh()

bool KinectManager.IsRightHandConfidenceHigh ( Int64  userId)

Determines whether the right hand confidence is high for the specified user.

Returns
true if the right hand confidence is high; otherwise, false.
Parameters
userIdUser ID

◆ IsTrackedUsersLimited()

bool KinectManager.IsTrackedUsersLimited ( )

Determines whether the tracked users are limited by their number or distance or not.

Returns
true if the users are limited by number or distance; otherwise, false.

◆ IsTrackingGesture()

bool KinectManager.IsTrackingGesture ( Int64  UserId,
KinectGestures.Gestures  gesture 
)

Determines whether the given gesture is in the list of gestures for the specified user.

Returns
true if the gesture is in the list of gestures for the specified user; otherwise, false.
Parameters
UserIdUser ID
gestureGesture type

◆ IsUserDetected() [1/2]

bool KinectManager.IsUserDetected ( )

Determines whether at least one user is currently detected by the sensor

Returns
true if at least one user is detected; otherwise, false.

◆ IsUserDetected() [2/2]

bool KinectManager.IsUserDetected ( int  i)

Determines whether the user with the specified index is currently detected by the sensor

Returns
true if the user is detected; otherwise, false.
Parameters
iThe user index.

◆ IsUserTracked()

bool KinectManager.IsUserTracked ( Int64  userId)

Determines whether the user with the specified userId is in the list of tracked users or not.

Returns
true if the user with the specified userId is tracked; otherwise, false.
Parameters
userIdUser identifier.

◆ IsUserTurnedAround()

bool KinectManager.IsUserTurnedAround ( Int64  userId)

Determines whether the given user is turned around or not.

Returns
true if the user is turned around; otherwise, false.
Parameters
userIdUser ID

◆ MapColorFrameToDepthCoords()

bool KinectManager.MapColorFrameToDepthCoords ( ref Vector2 []  avDepthCoords)

Maps the color frame to depth coordinates.

Returns
true on success, false otherwise.
Parameters
avDepthCoordsBuffer for color-to-depth coordinates.

◆ MapColorPointToDepthCoords()

Vector2 KinectManager.MapColorPointToDepthCoords ( Vector2  colorPos,
bool  bReadDepthCoordsIfNeeded 
)

Returns the depth-map coordinates of a color point.

Returns
The depth coords.
Parameters
colorPosColor position.
bReadDepthCoordsIfNeededIf set to true allows reading of depth coords, if needed.

◆ MapDepthFrameToColorCoords()

bool KinectManager.MapDepthFrameToColorCoords ( ref Vector2 []  avColorCoords)

Maps the depth frame to color coordinates.

Returns
true on success, false otherwise.
Parameters
avColorCoordsBuffer for depth-to-color coordinates.

◆ MapDepthFrameToSpaceCoords()

bool KinectManager.MapDepthFrameToSpaceCoords ( ref Vector3 []  avSpaceCoords)

Maps the depth frame to space coordinates.

Returns
true on success, false otherwise.
Parameters
avSpaceCoordsBuffer for the depth-to-space coordinates.

◆ MapDepthPointToColorCoords()

Vector2 KinectManager.MapDepthPointToColorCoords ( Vector2  posPoint,
ushort  depthValue 
)

Returns the color-map coordinates of a depth point.

Returns
The color-map coordinates.
Parameters
posPointDepth point coordinates
depthValueDepth value

◆ MapDepthPointToSpaceCoords()

Vector3 KinectManager.MapDepthPointToSpaceCoords ( Vector2  posPoint,
ushort  depthValue,
bool  bWorldCoords 
)

Returns the space coordinates of a depth-map point, or Vector3.zero if the sensor is not initialized

Returns
The space coordinates.
Parameters
posPointDepth point coordinates
depthValueDepth value
bWorldCoordsIf set to true, applies the sensor height and angle to the space coordinates.

◆ MapSpacePointToDepthCoords()

Vector2 KinectManager.MapSpacePointToDepthCoords ( Vector3  posPoint)

Returns the depth-map coordinates of a space point, or Vector2.zero if Kinect is not initialized

Returns
The depth-map coordinates.
Parameters
posPointSpace point coordinates

◆ RearrangeUserIndices()

virtual void KinectManager.RearrangeUserIndices ( )
virtual

Rearranges the user indices, according to the current criteria

◆ refreshAvatarControllers()

void KinectManager.refreshAvatarControllers ( )

Refreshs the avatar controllers' list.

◆ RefreshAvatarUserIds()

void KinectManager.RefreshAvatarUserIds ( )

Refreshs the userIds of all available avatar controllers, after new user appears in front of the sensor, or when some user gets lost.

◆ refreshGestureListeners()

void KinectManager.refreshGestureListeners ( )

Refreshs the gesture listeners' list.

◆ ResetFilters()

void KinectManager.ResetFilters ( )

Resets the Kinect data filters.

◆ ResetGesture()

bool KinectManager.ResetGesture ( Int64  UserId,
KinectGestures.Gestures  gesture 
)

Resets the gesture state for the given gesture of the specified user.

Returns
true, if gesture was reset, false otherwise.
Parameters
UserIdUser ID
gestureGesture type

◆ ResetPlayerGestures()

void KinectManager.ResetPlayerGestures ( Int64  UserId)

Resets the gesture states for all gestures of the specified user.

Parameters
UserIdUser ID

◆ SetBodyFrameData()

bool KinectManager.SetBodyFrameData ( string  sLine)

Sets the body frame from the given csv line.

Returns
true on success, false otherwise.
Parameters
sLineThe body frame as csv line.

◆ SetBodyHandData()

bool KinectManager.SetBodyHandData ( string  sLine)

Sets the body hand data from the given csv line.

Returns
true on success, false otherwise.
Parameters
sLineThe hand data as csv line.

◆ SetDisplayedBodyIndex()

bool KinectManager.SetDisplayedBodyIndex ( int  iBodyIndex)

Sets the body index [0-5], if a single body must be displayed on the user map, or -1 if all bodies must be displayed.

Returns
true, if the change was successful, false otherwise.
Parameters
iBodyIndexThe single body index, or -1 if all bodies must be displayed.

◆ SetKinectToWorldMatrix()

void KinectManager.SetKinectToWorldMatrix ( Vector3  sensorPos,
Quaternion  sensorRot,
Vector3  sensorScale 
)

Sets the kinect to world matrix.

Parameters
sensorPosSensor position.
sensorRotSensor rotation.
sensorScalePosition scale (could be used to flip left-right).

◆ SetPrimaryUserID()

bool KinectManager.SetPrimaryUserID ( Int64  userId)

Sets the primary user ID, in order to change the active user.

Returns
true, if primary user ID was set, false otherwise.
Parameters
userIdUser ID

◆ SetWorldMatrixData()

bool KinectManager.SetWorldMatrixData ( string  sLine)

Sets the world matrix data from the given csv line.

Returns
true on success, false otherwise.
Parameters
sLineThe kinect2world data as csv line.

◆ UpdateKinectToWorldMatrix()

void KinectManager.UpdateKinectToWorldMatrix ( )

Updates the kinect to world transform matrix, according to the current values of SensorHeight, SensorAngle and FlipLeftRight.

Property Documentation

◆ Instance

KinectManager KinectManager.Instance
staticget

Gets the single KinectManager instance.

The KinectManager instance.