Portfolio - KinectCamera

KinectCamera

A convenient encapsulation for kinect camera image capture

Overview

This project encapsulates complicated Kinect library function calls
into a simple class for convinence.

It provides the following image capture abilities:

  • Color image
  • Infrared image
  • Depth image

Example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Header
#include "KinectCamera.h"

// (Optional) set log output
Log::Initialise("Test.log");
Log::SetThreshold(Log::Level::Debug);

// Initialize camera object
KinectCamera TestCamera;

// (Optional) set wanted image types
TestCamera.m_bColorWanted = true;
TestCamera.m_bInfraredWanted = true;
TestCamera.m_bDepthWanted = true;

// Set image output location
TestCamera.m_szColorOutput = "TestColor.png";
TestCamera.m_szInfraredOutput = "TestInfrared.png";
TestCamera.m_szDepthOutput = "TestDepth.png";

// Initialize sensor (would succeed if driver is installed correctly,
// regardless the camera is connected or not)
TestCamera.InitializeDefaultSensor();

// Check for availiablity of camera sensor
while (FAILED(TestCamera.CheckAvailiable()))
// Kinect may not be ready; wait and retry
Sleep(100);

for (int i = 0; i < 100; i++)
{
// Capture the image
if (SUCCEEDED(TestCamera.Capture()))
break;
}