CinderBlock for Azure Kinect (K4A) camera integration with Cinder. Support for the Azure Kinect, the Orbbec Femto Bolt and the Orbbec Femto Mega (both untested).
- Azure Kinect SDK v1.4.1
- Body Tracking SDK v1.1.2 (optional, for skeleton tracking)
- Visual Studio 2022 (v143 toolset) / C++20
- 0.9.4dev Cinder
- Clone/copy to
<Cinder>/blocks/Cinder-AzureKinect - Install the Azure Kinect SDK
- Install the Body Tracking SDK if using skeleton features
Each sample imports samples/CinderKinectAzure.props which defines SDK paths:
<K4A_SDK_PATH>C:\Program Files\Azure Kinect SDK v1.4.1</K4A_SDK_PATH>
<K4ABT_SDK_PATH>C:\Program Files\Azure Kinect Body Tracking SDK</K4ABT_SDK_PATH>To use in your project:
- Copy
samples/CinderKinectAzure.propsto your project'sproj/folder - Edit paths if your SDK is installed elsewhere
- In your
.vcxproj, add to PropertySheets:
<Import Project="..\CinderKinectAzure.props" />Link against:
k4a.lib- Core SDKk4arecord.lib- Recording/playback supportk4abt.lib- Body tracking (if usingCinderKinectAzureBodyTracking.h)
$(K4A_SDK_PATH)\sdk\include
$(K4ABT_SDK_PATH)\sdk\include // for body tracking
Copy SDK DLLs to output directory:
copy /y "$(K4A_SDK_PATH)\sdk\windows-desktop\amd64\release\bin\*.dll" $(OutDir)
#include "CinderKinectAzure.h"
// Create camera with resolution and depth mode
auto camera = std::make_unique<cika::Camera>(
K4A_COLOR_RESOLUTION_720P,
K4A_DEPTH_MODE_NFOV_UNBINNED
);
// Set coordinate system (default is Kinect-native: Z forward, Y down)
camera->setCoordinateSystem( cika::CoordinateSystem::RIGHT_HANDED_Y_UP ); // OpenGL style
camera->setUnits( cika::Unit::METER );
// Start capture with preprocessing options
camera->startCapture( cika::CaptureFormat().imageColorGeomDepth() );
// In update loop
if( camera->update() ) {
auto colorImage = camera->getImageColor();
auto depthImage = camera->getImageDepth();
}std::filesystem::path path = "recording.mkv";
auto camera = std::make_unique<cika::Camera>( path, true ); // loop=true// Enable point cloud preprocessing
camera->startCapture( cika::CaptureFormat().pointsRgbGeomDepth() );
// Get points (XYZ + RGB interleaved floats)
std::vector<float> points( camera->getDepthWidth() * camera->getDepthHeight() * 6 );
uint32_t numPoints = camera->getPointsRgbGeomDepth( points.data(), true );#include "CinderKinectAzureBodyTracking.h"
auto tracker = std::make_unique<cika::BodyTracker>( camera.get() );
// In update loop
if( tracker->update() ) {
auto bodies = tracker->getBodies();
for( const auto& body : bodies ) {
auto headPos = body.joints[K4ABT_JOINT_HEAD].position;
}
}#include "CinderKinectAzureGl.h"
// Create GL point cloud renderer
glm::ivec2 depthRes( camera->getDepthWidth(), camera->getDepthHeight() );
auto pointCloudGl = std::make_unique<cika::PointCloudGl>( depthRes );
// Initialize depth table (once after camera setup)
pointCloudGl->updateDepthTable( camera->getDepthTableGeomDepth() );
// In update loop
pointCloudGl->updateColor( camera->getImageColorGeomDepth() );
pointCloudGl->updateDepth( camera->getImageDepth() );
// In draw
pointCloudGl->draw();| Sample | Description |
|---|---|
| DepthView | Basic point cloud from CPU |
| DepthViewGPU | GPU-accelerated point cloud using depth table shader |
| ImageCapture | Capture and save frames |
| Projection | 2D/3D coordinate projection |
| Skeleton2D | 2D body tracking overlay |
| Skeleton3D | 3D body tracking visualization |
| MultiCamDepthView | Multiple camera support |
| MultiCamImageCapture | Multi-camera capture |
kinect_azure/
├── include/
│ ├── CinderKinectAzure.h # Core camera API
│ ├── CinderKinectAzureBodyTracking.h # Body tracking
│ └── CinderKinectAzureGl.h # GL helpers (decoupled)
├── src/
│ ├── CinderKinectAzure.cpp
│ ├── CinderKinectAzureBodyTracking.cpp
│ └── CinderKinectAzureGl.cpp
└── samples/
├── CinderKinectAzure.props # SDK path configuration
└── [sample folders]/
- The GL functionality is separated into
CinderKinectAzureGl.h/.cppto allow headless use without OpenGL dependencies. - IMU data is available via
startImu(),updateImu(), andgetImuSample(). - Depth tables (
getDepthTableGeomDepth()) are lazily computed and cached.