GFreenect - Reference Manual | ||||
---|---|---|---|---|
Top | Description | Object Hierarchy | Implemented Interfaces | Properties | Signals |
struct GFreenectDevice; struct GFreenectDeviceClass; void gfreenect_device_get_accel (GFreenectDevice *self
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
); gboolean gfreenect_device_get_accel_finish (GFreenectDevice *self
,gdouble *x
,gdouble *y
,gdouble *z
,GAsyncResult *result
,GError **error
); gboolean gfreenect_device_get_accel_sync (GFreenectDevice *self
,gdouble *x
,gdouble *y
,gdouble *z
,GCancellable *cancellable
,GError **error
); guint8 * gfreenect_device_get_depth_frame_grayscale (GFreenectDevice *self
,gsize *len
,GFreenectFrameMode *frame_mode
); guint8 * gfreenect_device_get_depth_frame_raw (GFreenectDevice *self
,gsize *len
,GFreenectFrameMode *frame_mode
); void gfreenect_device_get_tilt_angle (GFreenectDevice *self
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
); gdouble gfreenect_device_get_tilt_angle_finish (GFreenectDevice *self
,GAsyncResult *result
,GError **error
); gdouble gfreenect_device_get_tilt_angle_sync (GFreenectDevice *self
,GCancellable *cancellable
,GError **error
); guint8 * gfreenect_device_get_video_frame_raw (GFreenectDevice *self
,gsize *len
,GFreenectFrameMode *frame_mode
); guint8 * gfreenect_device_get_video_frame_rgb (GFreenectDevice *self
,gsize *len
,GFreenectFrameMode *frame_mode
); void gfreenect_device_new (gint device_index
,guint subdevices
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
); GFreenectDevice * gfreenect_device_new_finish (GAsyncResult *result
,GError **error
); void gfreenect_device_set_led (GFreenectDevice *self
,GFreenectLed led
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
); gboolean gfreenect_device_set_led_finish (GFreenectDevice *self
,GAsyncResult *result
,GError **error
); void gfreenect_device_set_tilt_angle (GFreenectDevice *self
,gdouble tilt_angle
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
); gboolean gfreenect_device_set_tilt_angle_finish (GFreenectDevice *self
,GAsyncResult *result
,GError **error
); gboolean gfreenect_device_start_depth_stream (GFreenectDevice *self
,GFreenectDepthFormat format
,GError **error
); gboolean gfreenect_device_start_video_stream (GFreenectDevice *self
,GFreenectResolution resolution
,GFreenectVideoFormat format
,GError **error
); gboolean gfreenect_device_stop_depth_stream (GFreenectDevice *self
,GError **error
); gboolean gfreenect_device_stop_video_stream (GFreenectDevice *self
,GError **error
);
"index" gint : Read / Write / Construct Only "led" guint : Read / Write "subdevices" guint : Read / Write / Construct Only "tilt-angle" gdouble : Read / Write
A GFreenectDevice is created using the asynchronous failable constructor
gfreenect_device_new()
. Then gfreenect_device_new_finish()
is called
within the provided callback, to obtain the new GFreenectDevice instance.
Use gfreenect_device_set_tilt_angle()
and
gfreenect_device_set_tilt_angle_finish()
to asynchronously move the tilt
motor to the desired angle. gfreenect_device_get_tilt_angle()
and
gfreenect_device_get_tilt_angle_finish()
are used to obtain the current tilt
angle, also asynchronously. For a synchronous call use
gfreenect_device_get_tilt_angle_sync()
.
The led status is set asynchronously using gfreenect_device_set_led()
and
gfreenect_device_set_led_finish()
.
To start the depth or video camera streams,
use gfreenect_device_start_depth_stream()
and
gfreenect_device_start_video_stream()
respectively. Then connect to the
signals "depth-frame" and "video-frame"
to get notified when a new frame is available. The actual frame data is
obtained using methods like gfreenect_device_get_depth_frame_raw()
,
gfreenect_device_get_depth_frame_grayscale()
,
gfreenect_device_get_video_frame_rgb()
, etc. Note that these methods should
only be called from within the signal handlers.
The accelerometer data can be obtained asynchronously using
gfreenect_device_get_accel()
and gfreenect_device_get_accel_finish()
,
or synchronously using gfreenect_device_get_accel_sync()
.
struct GFreenectDeviceClass { GObjectClass parent_class; /* Signal prototypes */ void (* depth_frame) (GFreenectDevice *self, gpointer user_data); void (* video_frame) (GFreenectDevice *self, gpointer user_data); };
GObjectClass |
|
Prototype for "depth-frame" signal | |
Prototype for "video-frame" signal |
void gfreenect_device_get_accel (GFreenectDevice *self
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
);
Gets the accelerometer data asynchronously. Use
gfreenect_device_get_accel_finish()
to obtain the results.
See gfreenect_device_get_accel_sync()
for a blocking version of this
method.
|
The GFreenectDevice |
|
A cancellable object, or NULL . [allow-none]
|
|
A function to be called upon
completion, or NULL . [scope async][allow-none]
|
|
An arbitrary user data to pass in callback ,
or NULL . [allow-none]
|
gboolean gfreenect_device_get_accel_finish (GFreenectDevice *self
,gdouble *x
,gdouble *y
,gdouble *z
,GAsyncResult *result
,GError **error
);
Retrieves the result of a gfreenect_device_get_accel()
operation.
|
The GFreenectDevice |
|
A pointer to retrieve the X-axis value of the accelerometer. [out][allow-none] |
|
A pointer to retrieve the Y-axis value of the accelerometer. [out][allow-none] |
|
A pointer to retrieve the Z-axis value of the accelerometer. [out][allow-none] |
|
The GAsyncResult provided in the callback |
|
A pointer to a GError, or NULL . [allow-none]
|
Returns : |
TRUE on success or FALSE if an error occurred. |
gboolean gfreenect_device_get_accel_sync (GFreenectDevice *self
,gdouble *x
,gdouble *y
,gdouble *z
,GCancellable *cancellable
,GError **error
);
Retrieves the accelerometer data synchronously. See
gfreenect_device_get_accel()
for a non-blocking version of this method.
|
The GFreenectDevice |
|
A pointer to retrieve the X-axis value of the accelerometer. [out][allow-none] |
|
A pointer to retrieve the Y-axis value of the accelerometer. [out][allow-none] |
|
A pointer to retrieve the Z-axis value of the accelerometer. [out][allow-none] |
|
A cancellable object, or NULL . [allow-none]
|
|
A pointer to a GError, or NULL . [allow-none]
|
Returns : |
TRUE on success or FALSE if an error occurred. |
guint8 * gfreenect_device_get_depth_frame_grayscale (GFreenectDevice *self
,gsize *len
,GFreenectFrameMode *frame_mode
);
Retrieves one depth frame in RGB format using gray values to represent the
depth. This method is useful for rendering the frame directly to an RGB
capable texture.
Optionally the frame metadata can also be retrieved providing a non-NULL
pointer to a GFreenectFrameMode structure in frame_mode
.
This method should only be called within a "depth-frame" signal handler, otherwise the returned values can be undefined.
|
The GFreenectDevice |
|
A pointer to retrieve the length of the returned frame data. [out][allow-none] |
|
A GFreenectFrameMode structure to fill with the attributes of the frame. [out][allow-none] |
Returns : |
An array
of len bytes representing the frame data. [array length=len][element-type guint8][transfer none]
|
guint8 * gfreenect_device_get_depth_frame_raw (GFreenectDevice *self
,gsize *len
,GFreenectFrameMode *frame_mode
);
Retrieves one depth frame in raw format as provided by the lower levels.
Optionally the frame metadata can also be retrieved providing a non-NULL
pointer to a GFreenectFrameMode structure in frame_mode
.
This method should only be called within a "depth-frame" signal handler, otherwise the returned values can be undefined.
|
The GFreenectDevice |
|
A pointer to retrieve the length of the returned frame data. [out][allow-none] |
|
A GFreenectFrameMode structure to fill with the attributes of the frame. [out][allow-none] |
Returns : |
An array
of len bytes representing the frame data. [array length=len][element-type guint8][transfer none]
|
void gfreenect_device_get_tilt_angle (GFreenectDevice *self
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
);
Asynchronously gets the current angle of the tilt motor. Use
gfreenect_device_get_tilt_angle_finish()
to obtain the results.
|
The GFreenectDevice |
|
A cancellable object, or NULL . [allow-none]
|
|
A function to be called upon
completion, or NULL . [scope async][allow-none]
|
|
An arbitrary user data to pass in callback ,
or NULL . [allow-none]
|
gdouble gfreenect_device_get_tilt_angle_finish (GFreenectDevice *self
,GAsyncResult *result
,GError **error
);
Obtains the result of a gfreenect_device_get_tilt_angle()
operation.
|
The GFreenectDevice |
|
The GAsyncResult provided in the callback |
|
A pointer to a GError, or NULL . [allow-none]
|
Returns : |
The tilt motor angle, or 0.0 upon error. Notice that 0.0 is a valid
return value so the error argument should also be checked. |
gdouble gfreenect_device_get_tilt_angle_sync (GFreenectDevice *self
,GCancellable *cancellable
,GError **error
);
Gets the current angle of the tilt motor synchronously. This is the blocking
version of gfreenect_device_get_tilt_angle()
.
|
The GFreenectDevice |
|
A cancellable object, or NULL . [allow-none]
|
|
A pointer to a GError, or NULL . [allow-none]
|
Returns : |
The tilt motor angle, or 0.0 upon error. Notice that 0.0 is a valid
return value so the error argument should also be checked. |
guint8 * gfreenect_device_get_video_frame_raw (GFreenectDevice *self
,gsize *len
,GFreenectFrameMode *frame_mode
);
Retrieves one video frame in raw format as provided by the lower levels.
Optionally the frame metadata can also be retrieved providing a non-NULL
pointer to a GFreenectFrameMode structure in frame_mode
.
This method should only be called within a "video-frame" signal handler, otherwise the returned values can be undefined.
|
The GFreenectDevice |
|
A pointer to retrieve the length of the returned frame data. [out][allow-none] |
|
A GFreenectFrameMode structure to fill with the attributes of the frame. [out][allow-none] |
Returns : |
An array
of len bytes representing the frame data. [array length=len][element-type guint8][transfer none]
|
guint8 * gfreenect_device_get_video_frame_rgb (GFreenectDevice *self
,gsize *len
,GFreenectFrameMode *frame_mode
);
Retrieves one video frame in RGB format. A conversion to RGB is applied if the video format is set to IR (infra-red). This method is useful for rendering the frame directly to an RGB capable texture.
Optionally the frame metadata can also be retrieved providing a non-NULL
pointer to a GFreenectFrameMode structure in frame_mode
.
This method should only be called within a "depth-frame" signal handler, otherwise the returned values can be undefined.
|
The GFreenectDevice |
|
A pointer to retrieve the length of the returned frame data. [out][allow-none] |
|
A GFreenectFrameMode structure to fill with the attributes of the frame. [out][allow-none] |
Returns : |
An array
of len bytes representing the frame data. [array length=len][element-type guint8][transfer none]
|
void gfreenect_device_new (gint device_index
,guint subdevices
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
);
Constructs a new GFreenectDevice object asynchronously. The actual instance is
obtained with gfreenect_device_new_finish()
when callback
is called.
|
The device index to use, normally 0 for one kinect sensor attached |
|
Or'ed combination of subdevices to use from GFreenectSubdevice set |
|
The cancellable object. [allow-none] |
|
The callback to be called when the new instance is ready. [scope async] |
|
User data to pass in callback . [allow-none]
|
GFreenectDevice * gfreenect_device_new_finish (GAsyncResult *result
,GError **error
);
Returns the new instance of GFreenectDevice constructed with
gfreenect_device_new()
, or NULL
if an error occurred, in which case
error
is set acordingly.
|
The GAsyncResult provided in the callback |
|
A pointer to a GError, or NULL . [allow-none]
|
Returns : |
The newly created GFreenectDevice upon success,
of NULL otherwise. [transfer full]
|
void gfreenect_device_set_led (GFreenectDevice *self
,GFreenectLed led
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
);
Sets the status of the device's led asynchronously. Use
gfreenect_device_set_led_finish()
to obtain the result of the operation.
If this method is called while a previous operation has not completed, a
G_IO_ERROR_PENDING
error occurs.
|
The GFreenectDevice |
|
A led status from GFreenectLed |
|
A cancellable object, or NULL . [allow-none]
|
|
The function to call upon completion,
or NULL . [scope async][allow-none]
|
|
Arbitrary user data to pass in callback , or NULL . [allow-none]
|
gboolean gfreenect_device_set_led_finish (GFreenectDevice *self
,GAsyncResult *result
,GError **error
);
Obtains the result of a gfreenect_device_set_led()
operation.
|
The GFreenectDevice |
|
The GAsyncResult provided in the callback |
|
A pointer to a GError, or NULL . [allow-none]
|
Returns : |
TRUE on success or FALSE if an error occurred. |
void gfreenect_device_set_tilt_angle (GFreenectDevice *self
,gdouble tilt_angle
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
);
Moves the tilt motor angle to tilt_angle
asynchronously. Acceptable values
are in the range -31.0 to 31.0. Use gfreenect_device_set_tilt_angle_finish()
to obtain the result of the operation.
If this method is called while a previous operation has not completed (the
motor is still moving), a G_IO_ERROR_PENDING
error occurs.
|
The GFreenectDevice |
|
The angle to move the tilt motor to |
|
A cancellable object, or NULL . [allow-none]
|
|
The function to call upon completion,
or NULL . [scope async][allow-none]
|
|
Arbitrary user data to pass in callback , or NULL . [allow-none]
|
gboolean gfreenect_device_set_tilt_angle_finish (GFreenectDevice *self
,GAsyncResult *result
,GError **error
);
Obtains the result of a gfreenect_device_set_tilt_angle()
operation.
|
The GFreenectDevice |
|
The GAsyncResult provided in the callback |
|
A pointer to a GError, or NULL . [allow-none]
|
Returns : |
TRUE on success or FALSE if an error occurred. |
gboolean gfreenect_device_start_depth_stream (GFreenectDevice *self
,GFreenectDepthFormat format
,GError **error
);
Starts the depth camera stream. After calling this, the "depth-frame"
signal is triggered whenever a new frame is available. Use
gfreenect_device_stop_depth_stream()
to stop it.
|
The GFreenectDevice |
|
A GFreenectDepthFormat to use |
|
A pointer to a GError, or NULL . [allow-none]
|
Returns : |
TRUE on success or FALSE if an error occurred. |
gboolean gfreenect_device_start_video_stream (GFreenectDevice *self
,GFreenectResolution resolution
,GFreenectVideoFormat format
,GError **error
);
Starts the video camera stream. After calling this, the "video-frame"
signal is triggered whenever a new frame is available. Use
gfreenect_device_stop_video_stream()
to stop it.
|
The GFreenectDevice |
|
A GFreenectResolution to use |
|
A GFreenectVideoFormat to use |
|
A pointer to a GError, or NULL . [allow-none]
|
Returns : |
TRUE on success or FALSE if an error occurred. |
gboolean gfreenect_device_stop_depth_stream (GFreenectDevice *self
,GError **error
);
Stops the depth camera stream that was previously started with
gfreenect_device_start_depth_stream()
.
|
The GFreenectDevice |
|
A pointer to a GError, or NULL . [allow-none]
|
Returns : |
TRUE on success or FALSE if an error occurred. |
gboolean gfreenect_device_stop_video_stream (GFreenectDevice *self
,GError **error
);
Stops the video camera stream that was previously started with
gfreenect_device_start_video_stream()
.
|
The GFreenectDevice |
|
A pointer to a GError, or NULL . [allow-none]
|
Returns : |
TRUE on success or FALSE if an error occurred. |
"index"
property"index" gint : Read / Write / Construct Only
The index of the kinect device sensor in the bus. Normally zero for a single device.
Allowed values: [G_MAXULONG,8]
Default value: -1
"led"
property"led" guint : Read / Write
The status of the sensor's led, from GFreenectLed set.
Allowed values: <= 6
Default value: 0
"subdevices"
property"subdevices" guint : Read / Write / Construct Only
The or'ed combination of subdevices from GFreenectSubdevice that have been activated.
Allowed values: <= 7
Default value: 3
"tilt-angle"
property"tilt-angle" gdouble : Read / Write
The sensor's tilt motor angle relative to the horizon.
Allowed values: [-31,31]
Default value: 0
"depth-frame"
signalvoid user_function (GFreenectDevice *self,
gpointer user_data) : Action
Called whenever a new depth frame is available. The depth stream has to be
started with gfreenect_device_start_depth_stream()
.
|
The GFreenectDevice |
|
user data set when the signal handler was connected. |
"video-frame"
signalvoid user_function (GFreenectDevice *self,
gpointer user_data) : Action
Called whenever a new video frame is available. The video stream has to be
started with gfreenect_device_start_video_stream()
.
|
The GFreenectDevice |
|
user data set when the signal handler was connected. |