KinectBridgeWithMATLABBasics D2D C++ Sample
Kinect for Windows 1.7, 1.8
|To compile and run this sample, you must have MATLAB R2012a or R2012b installed. To find out more about MATLAB see the MathWorks web page and look for the Try or Buy link.|
This sample shows how to perform numerical computation and visualization using MATLAB functions on video and depth data from a sensor.
|The Sample Uses the Following APIs||To Do This|
|NuiImageResolutionToSize function||Get the width and height of the depth frame.|
|NuiGetSensorCount function||Get the number of sensors that are ready for use.|
|NuiCreateSensorByIndex function and INuiSensor interface||Create an interface that represents a connected sensor.|
|INuiSensor::NuiStatus method||Check the sensor status to see if the sensor is connected.|
|INuiSensor::NuiInitialize method and NUI_IMAGE_TYPE_DEPTH_AND_PLAYER_INDEX constant||Initialize the sensor to stream out depth data.|
|INuiSensor::NuiImageStreamSetImageFrameFlags method and NUI_IMAGE_STREAM_FLAG_ENABLE_NEAR_MODE constant||Set depth data range to near range.|
|CreateEvent function||Create an event that will be signaled when depth data is available by returning an event handle.|
|INuiSensor::NuiImageStreamOpen method, NUI_IMAGE_TYPE_DEPTH constant, NUI_IMAGE_RESOLUTION_640x480 constant, the event handle||Open a depth stream to receive depth data.|
|CreateBitmap function||Create a bitmap for the color data.|
|UpdateBitmap function||Save the color image in a bitmap for drawing.|
|INuiSensor::NuiImageStreamGetNextFrame method||Get the next frame of color data (using the color data event handle).|
|INuiFrameTexture::LockRect method and NUI_LOCKED_RECT structure||Lock the texture to prepare for saving texture data.|
|INuiFrameTexture::UnlockRect method||Unlock the texture after saving the texture data.|
|INuiSensor::NuiImageStreamReleaseFrame method||Release each frame of depth data after saving it.|
|INuiSensor::Release method||Release the sensor when you exit the application.|
|NuiShutdown function||Shut down the sensor.|
KinectHelper is an abstract base class that holds functions to communicate with the Kinect runtime to get color and depth data, one frame at a time. MatlabKinectHelper is a concrete implementation of the KinectHelper class that implements functionality to convert the color and depth data from the sensor into RGB matrices used by MATLAB. These classes are only available in this sample and are not part of the Kinect for Windows SDK or Toolkit.
|The Sample Uses the Following Additional Classes and Methods||To Do This|
|KinectHelper::SetDepthFrameResolution method||Set the resolution of the depth frame.|
|KinectHelper::IsInitialized method||Update a frame only if it has been initialized.|
|KinectHelper::UpdateColorFrame method||Get a new color frame.|
|KinectHelper::GetColorImage method||Get the color image.|
|KinectHelper::SetColorFrameResolution method||Set the resolution of the color frame.|
|KinectHelper::GetColorFrameSize method||Initialize the color MATLAB matrix|
To run a sample you must have the Kinect for Windows SDK installed. To compile a sample, you must have the developer toolkit installed. The latest SDK and developer toolkit are available on the developer download page. If you need help installing the toolkit, look on this page: To Install the SDK and Toolkit. The toolkit includes a sample browser, which you can use to launch a sample or download it to your machine. To open the sample browser, click Start > All Programs > Kinect for Windows SDK [version number] > Developer Toolkit Browser.
If you need help loading a sample in Visual Studio or using Visual Studio to compile, run, or debug, see Opening, Building, and Running Samples in Visual Studio.