AForge.Video.Kinect
Kinect's LED color options.
The LED is off.
The LED is on and has green color.
The LED is on and has red color.
The LED is on and has yellow color.
The LED is blinking with green color.
The LED is blinking from red to yellow color.
Kinect's resolutions of video and depth cameras.
Low resolution.
Medium resolution.
Hight resolution.
The class provides access to Microsoft's Xbox Kinect
controller.
The class allows to manipulate Kinec device by changing its LED color, setting motor's
tilt value and accessing its camera. See and
classes, which provide access to actual video.
In order to run correctly the class requires freenect.dll library
to be put into solution's output folder. This can be found within the AForge.NET framework's
distribution in Externals folder.
Sample usage:
// get Kinect device
Kinect kinectDevice = Kinect.GetDevice( 0 );
// change LED color
kinectDevice.LedColor = LedColorOption.Yellow;
// set motor tilt angle to -10 degrees
kinectDevice.SetMotorTilt( -10 );
// get video camera
KinectVideoCamera videoCamera = kinectDevice.GetVideoCamera( );
// see example for video camera also
ID of the opened Kinect device.
Number of Kinect devices available in the system.
Get initialized instance of the Kinect device.
ID of the Kinect device to get instance of, [0, ),
Returns initialized Kinect device. Use method
when the device is no longer required.
There is no Kinect device with specified ID connected to the system.
Failed connecting to the Kinect device specified ID.
Object finalizer/destructor makes sure unmanaged resource are freed if user did not call .
Dispose device freeing all associated unmanaged resources.
Set color of Kinect's LED.
LED color to set.
Some error occurred with the device. Check error message.
Set motor's tilt value.
Tilt value to set, [-31, 30] degrees.
Motor tilt has to be in the [-31, 31] range.
Some error occurred with the device. Check error message.
Get accelerometer values for 3 axes.
X axis value on the accelerometer.
Y axis value on the accelerometer.
Z axis value on the accelerometer.
Units of all 3 values are m/s2. The g value used
for calculations is taken as 9.80665 m/s2.
Get Kinect's video camera.
Returns Kinect's video camera.
The method simply creates instance of the class
by calling its appropriate constructor. Use method
to start the video then.
Get Kinect's depth camera.
Returns Kinect's depth camera.
The method simply creates instance of the class
by calling its appropriate constructor. Use method
to start the video then.
Video source for Microsoft Kinect's depth sensor.
The video source captures depth data from Microsoft Kinect
depth sensor, which is aimed originally as a gaming device for XBox 360 platform.
Prior to using the class, make sure you've installed Kinect's drivers
as described on Open Kinect
project's page.
In order to run correctly the class requires freenect.dll library
to be put into solution's output folder. This can be found within the AForge.NET framework's
distribution in Externals folder.
Sample usage:
// create video source
KinectDepthCamera videoSource = new KinectDepthCamera( 0 );
// set NewFrame event handler
videoSource.NewFrame += new NewFrameEventHandler( video_NewFrame );
// start the video source
videoSource.Start( );
// ...
private void video_NewFrame( object sender, NewFrameEventArgs eventArgs )
{
// get new frame
Bitmap bitmap = eventArgs.Frame;
// process the frame
}
New frame event.
Notifies clients about new available frames from the video source.
Since video source may have multiple clients, each client is responsible for
making a copy (cloning) of the passed video frame, because the video source disposes its
own original copy after notifying of clients.
Video source error event.
This event is used to notify clients about any type of errors occurred in
video source object, for example internal exceptions.
Video playing finished event.
This event is used to notify clients that the video playing has finished.
Provide original depth image or colored depth map.
The property specifies if the video source should provide original data
provided by Kinect's depth sensor or provide colored depth map. If the property is set to
, then the video source will provide 16 bpp grayscale images, where
11 least significant bits represent data provided by the sensor. If the property is
set to , then the video source will provide 24 bpp color images,
which represents depth map. In this case depth is encoded by color gradient:
white->red->yellow->green->cyan->blue->black. So colors which are closer to white represent
objects which are closer to the Kinect sensor, but colors which are closer to black represent
objects which are further away from Kinect.
The property must be set before running the video source to take effect.
Default value is set to .
Resolution of depth sensor to set.
The property must be set before running the video source to take effect.
Default value of the property is set to .
A string identifying the video source.
State of the video source.
Current state of video source object - running or not.
Received bytes count.
Number of bytes the video source provided from the moment of the last
access to the property.
Received frames count.
Number of frames the video source provided from the moment of the last
access to the property.
Initializes a new instance of the class.
Kinect's device ID (index) to connect to.
Initializes a new instance of the class.
Kinect's device ID (index) to connect to.
Resolution of depth sensor to set.
Initializes a new instance of the class.
Kinect's device ID (index) to connect to.
Resolution of depth sensor to set.
Provide original depth image or colored depth map
(see property).
Start video source.
Starts video source and returns execution to caller. Video camera will be started
and will provide new video frames through the event.
The specified resolution is not supported for the selected
mode of the Kinect depth sensor.
Could not connect to Kinect's depth sensor.
Another connection to the specified depth sensor is already running.
Signal video source to stop its work.
Calling this method is equivalent to calling
for Kinect video camera.
Wait for video source has stopped.
Calling this method is equivalent to calling
for Kinect video camera.
Stop video source.
The method stop the video source, so it no longer provides new video frames
and does not consume any resources.
Enumeration of video camera modes for the .
24 bit per pixel RGB mode.
8 bit per pixel Bayer mode.
8 bit per pixel Infra Red mode.
Video source for Microsoft Kinect's video camera.
The video source captures video data from Microsoft Kinect
video camera, which is aimed originally as a gaming device for XBox 360 platform.
Prior to using the class, make sure you've installed Kinect's drivers
as described on Open Kinect
project's page.
In order to run correctly the class requires freenect.dll library
to be put into solution's output folder. This can be found within the AForge.NET framework's
distribution in Externals folder.
Sample usage:
// create video source
KinectVideoCamera videoSource = new KinectVideoCamera( 0 );
// set NewFrame event handler
videoSource.NewFrame += new NewFrameEventHandler( video_NewFrame );
// start the video source
videoSource.Start( );
// ...
private void video_NewFrame( object sender, NewFrameEventArgs eventArgs )
{
// get new frame
Bitmap bitmap = eventArgs.Frame;
// process the frame
}
New frame event.
Notifies clients about new available frames from the video source.
Since video source may have multiple clients, each client is responsible for
making a copy (cloning) of the passed video frame, because the video source disposes its
own original copy after notifying of clients.
Video source error event.
This event is used to notify clients about any type of errors occurred in
video source object, for example internal exceptions.
Video playing finished event.
This event is used to notify clients that the video playing has finished.
Specifies video mode for the camera.
The property must be set before running the video source to take effect.
Default value of the property is set to .
Resolution of video camera to set.
The property must be set before running the video source to take effect.
Default value of the property is set to .
A string identifying the video source.
State of the video source.
Current state of video source object - running or not.
Received bytes count.
Number of bytes the video source provided from the moment of the last
access to the property.
Received frames count.
Number of frames the video source provided from the moment of the last
access to the property.
Initializes a new instance of the class.
Kinect's device ID (index) to connect to.
Initializes a new instance of the class.
Kinect's device ID (index) to connect to.
Resolution of video camera to set.
Initializes a new instance of the class.
Kinect's device ID (index) to connect to.
Resolution of video camera to set.
Sets video camera mode.
Start video source.
Starts video source and returns execution to caller. Video camera will be started
and will provide new video frames through the event.
The specified resolution is not supported for the selected
mode of the Kinect video camera.
Could not connect to Kinect's video camera.
Another connection to the specified video camera is already running.
Signal video source to stop its work.
Calling this method is equivalent to calling
for Kinect video camera.
Wait for video source has stopped.
Calling this method is equivalent to calling
for Kinect video camera.
Stop video source.
The method stops the video source, so it no longer provides new video frames
and does not consume any resources.