skeltrack-joint

skeltrack-joint — Data structure that holds information about a skeleton joint.

Synopsis

#define             SKELTRACK_JOINT_MAX_JOINTS
typedef             SkeltrackJointList;
enum                SkeltrackJointId;
struct              SkeltrackJoint;
gpointer            skeltrack_joint_copy                (SkeltrackJoint *joint);
void                skeltrack_joint_free                (SkeltrackJoint *joint);
void                skeltrack_joint_list_free           (SkeltrackJointList list);
SkeltrackJointList  skeltrack_joint_list_new            (void);
SkeltrackJoint *    skeltrack_joint_list_get_joint      (SkeltrackJointList list,
                                                         SkeltrackJointId id);

Object Hierarchy

  GBoxed
   +----SkeltrackJoint

Description

A SkeltrackJoint is built automatically by SkeltrackSkeleton when it finds a skeleton joint and can be used to get information about it. Each SkeltrackJoint holds an id, given by SkeltrackJointId that indicates which of the human skeleton joints it represents.

Spacial information about a joint is given by the x, y and z coordinates. To represent the joint in a 2D, the variables screen_x and screen_y will indicate the joint's position in the screen and are calculated taking into account the "dimension-reduction" (it will be multiplied by this value).

The tracked list of joints is represented by SkeltrackJointList and given by skeltrack_skeleton_track_joints_finish(). To get a SkeltrackJoint from a SkeltrackJointList object, use the skeltrack_joint_list_get_joint() indicating the needed SkeltrackJointId.

A SkeltrackJointList can be freed by using skeltrack_joint_list_free(). A SkeltrackJoint can be copied by skeltrack_joint_copy() and freed by skeltrack_joint_free().

Details

SKELTRACK_JOINT_MAX_JOINTS

#define SKELTRACK_JOINT_MAX_JOINTS 7


SkeltrackJointList

typedef SkeltrackJoint **SkeltrackJointList;


enum SkeltrackJointId

typedef enum {
  SKELTRACK_JOINT_ID_HEAD,
  SKELTRACK_JOINT_ID_LEFT_SHOULDER,
  SKELTRACK_JOINT_ID_RIGHT_SHOULDER,
  SKELTRACK_JOINT_ID_LEFT_ELBOW,
  SKELTRACK_JOINT_ID_RIGHT_ELBOW,
  SKELTRACK_JOINT_ID_LEFT_HAND,
  SKELTRACK_JOINT_ID_RIGHT_HAND
} SkeltrackJointId;

Available joint ids.

SKELTRACK_JOINT_ID_HEAD

The head

SKELTRACK_JOINT_ID_LEFT_SHOULDER

The left shoulder

SKELTRACK_JOINT_ID_RIGHT_SHOULDER

The right shoulder

SKELTRACK_JOINT_ID_LEFT_ELBOW

The left elbow

SKELTRACK_JOINT_ID_RIGHT_ELBOW

The right elbow

SKELTRACK_JOINT_ID_LEFT_HAND

The left hand

SKELTRACK_JOINT_ID_RIGHT_HAND

The right hand

struct SkeltrackJoint

struct SkeltrackJoint {
  SkeltrackJointId id;

  gint x;
  gint y;
  gint z;

  gint screen_x;
  gint screen_y;
};

SkeltrackJointId id;

The id of the joint

gint x;

The x coordinate of the joint in the space (in mm)

gint y;

The y coordinate of the joint in the space (in mm)

gint z;

The z coordinate of the joint in the space (in mm)

gint screen_x;

The x coordinate of the joint in the screen (in pixels)

gint screen_y;

The y coordinate of the joint in the screen (in pixels)

skeltrack_joint_copy ()

gpointer            skeltrack_joint_copy                (SkeltrackJoint *joint);

Makes an exact copy of a SkeltrackJoint object.

joint :

The SkeltrackJoint to copy

Returns :

A newly created SkeltrackJoint. Use skeltrack_joint_free() to free it. [transfer full]

skeltrack_joint_free ()

void                skeltrack_joint_free                (SkeltrackJoint *joint);

Frees a SkeltrackJoint object.

joint :

The SkeltrackJoint to free

skeltrack_joint_list_free ()

void                skeltrack_joint_list_free           (SkeltrackJointList list);

Frees a SkeltrackJointList object and each SkeltrackJoint in it.

list :

The SkeltrackJointList to free

skeltrack_joint_list_new ()

SkeltrackJointList  skeltrack_joint_list_new            (void);

Created a new list of SkeltrackJointsList with its joints as NULL. When it is no longer needed, free it with skeltrack_joint_list_free().

Returns :

A newly allocated SkeltrackJointList. [transfer full]

skeltrack_joint_list_get_joint ()

SkeltrackJoint *    skeltrack_joint_list_get_joint      (SkeltrackJointList list,
                                                         SkeltrackJointId id);

Gets a joint from a list of skeleton joints. The joint returned needs to be freed by using skeltrack_joint_free() or, alternatively, the whole list and its joints can be freed by using skeltrack_joint_list_free().

list :

The SkeltrackJointList

id :

The SkeltrackJointId of the joint to get

Returns :

The SkeltrackJoint that corresponds to the given id or NULL if that joint wasn't found. [transfer full]