Giter VIP home page Giter VIP logo

ofxazurekinect's Introduction

ofxAzureKinect

ofxAddon that allows you to use Azure Kinect in openFrameworks.

  • Get depth, color, depth to world, and color in depth frames as ofPixels or ofTexture.
  • Get point cloud VBO with texture coordinates in depth space.
  • Get body tracking skeleton and index texture.
  • Use multiple sensors per machine (tested up to 4!)
  • Set up sync mode (standalone, master, subordinate) with multiple devices when connected with sync cables.
  • Record and playback streams.
  • More coming soon...

Installation

The instructions below are based on the Azure Kinect Sensor SDK Usage page.

Windows

  • Install the Azure Kinect Sensor SDK.

  • Install the Azure Kinect Body Tracking SDK.

  • Add an environment variable for AZUREKINECT_SDK and set it to the Sensor SDK installation path (no trailing slash). The default is C:\Program Files\Azure Kinect SDK v1.4.1.

  • Add an environment variable for AZUREKINECT_BODY_SDK and set it to the Body SDK installation path (no trailing slash). The default is C:\Program Files\Azure Kinect Body Tracking SDK.

    Environment Variables

  • Add the path to the Sensor SDK bin folder to the PATH variable. The default is %AZUREKINECT_SDK%\sdk\windows-desktop\amd64\release\bin.

  • Add the path to the Body SDK bin folder to the PATH variable. The default is %AZUREKINECT_BODY_SDK%\sdk\windows-desktop\amd64\release\bin.

  • Add the path to the Body SDK tools folder to the PATH variable. The default is %AZUREKINECT_BODY_SDK%\tools.

    Path

  • Clone this repository in your openFrameworks addons folder.

  • You can then use the OF Project Generator to generate projects with the appropriate headers and libraries included. โœŒ๏ธ

  • Note that if you want to use body tracking, you will need to copy the cuDNN model file dnn_model_2_0.onnx from the Body SDK tools folder into your project's bin folder!

Linux

  • Configure the Linux Software Repository for Microsoft. Note that for Ubuntu you'll need to set up the repo for 18.04 even if you're running newer versions.
  • Install the Azure Kinect Sensor SDK packages: libk4a1.3 libk4a1.3-dev k4a-tools
  • Install the Azure Kinect Body Tracking SDK packages: libk4abt1.0 libk4abt1.0-dev
  • Setup udev rules by copying this file to /etc/udev/rules.d/99-k4a.rules.
  • Install libjpeg-turbo.
  • Clone this repository in your openFrameworks addons folder.
  • You can then use the OF Project Generator to generate projects with the appropriate headers and libraries included. ๐Ÿฃ

Compatibility

Tested with:

  • openFrameworks 0.10.x / 0.11.x
  • Windows 10, Visual Studio 2017 / 2019
  • Ubuntu 19.10, Qt Creator

Examples

Use the OF Project Generator to create the example project files. If everything is installed correctly, it should properly locate all required include and library files.

  • example-streams demonstrates how to get depth, color, infrared textures from the device.
  • example-scaled-depth demonstrates how to remap the depth data to a narrower (probably more useful) range.
  • example-pointCloud demonstrates how to draw the basic point cloud VBO from the device.
  • example-world-coord demonstrates how to get the world coordinate from the depth and depth to world data sets.
  • example-shader demonstrates how to reconstruct a point cloud using LUTs in a shader.
  • example-bodies demonstrates how to get the body tracking index texture and skeleton joint information in 3D.
  • example-bodies-projected demonstrates how to get the body tracking index texture and skeleton joint information in 2D.
  • example-multi demonstrates how to use multiple devices in a single app.
  • example-record demonstrates how to record and playback device streams.

ofxazurekinect's People

Contributors

prisonerjohn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ofxazurekinect's Issues

No Depth Camera and Limited IR Camera Streaming

Hi,

I am having an issue with getting the depth camera to work in the stream example. I have not edited the original code in any way. Upon running the example, I can clearly see the RGB camera capture clearly. However I can barely see the IR camera feed (does not appear the same way it does in the Azure Kinect Viewer application, and cannot see the depth camera at all.

To reproduce, navigate to the example-streams folder, and run the example-streams VS solution. Expected is that the live feed would look identical to the live feed from the Azure Kinect Viewer application, but this is not the case.

OF vs Azure Kinect Viewer:
Screenshot 2020-01-29 11 38 35
Screenshot 2020-01-29 11 39 00

Running:
Windows 10, of_v0.11.0, Visual Studio 2019

support for v1.2?

I tried this with v1.2 and its dropping lot of errors
something to do with conversion
i.e.
[ error ] ofxAzureKinect::Device::updateDepthInColorFrame: Failed to convert depth map to color camera geometry!

I am guess you are using version 1.1 will this be updated soon?

Thanks!

capturesync_drop... stuck in setup()

Hello,
I'm on windows 10 64 bits, openframeworks 0.11.0
Installed Azure kinect body tracking SDK 1.0 and Azure kinect SDK v1.4.1
I get this error continuously:
image
It never reaches the draw() function.
Any help would be really appreciated,
Thanks,
Antonio.

Body Tracking error

Hi @prisonerjohn,

Thanks for the addon! I am trying to use the body tracker example. I have the latest SDKs installed and the environment variables set up as your description. I have copied over the
dnn_model_2_0_op11.onnx file in the bin folder as well. I am getting the following errors. I am also not seeing any of the joints being drawn. The shader is drawing the depth image. Could you possibly know why this might happen?

Thanks a bunch!

ofxAzureKinect error1

ofxAzureKinect error2

Vbo missmatch - point cloud example error

The point cloud example uses:

kinectSettings.updateColor = true;

When this is true Device.cpp line 400 is:

if (this->bUpdateColor)
    {
	this->updatePointsCache(colorImg, this->colorToWorldImg);
    }
	else
    {
	this->updatePointsCache(depthImg, this->depthToWorldImg);
    }

This suggests it will create the points cache by iterating through the points in the colour frame and getting xyz values and texture coordinates from the pixlels in the full colour frame.

In the example however the full colour frame is not bound to the vbo, the colorInDepth tex is:

if (this->kinectDevice.getColorInDepthTex().isAllocated())
    {
	this->kinectDevice.getColorInDepthTex().bind();
    }

this->kinectDevice.getPointCloudVbo().draw( GL_POINTS, 0, this >kinectDevice.getPointCloudVbo().getNumVertices());

if (this->kinectDevice.getColorInDepthTex().isAllocated())
    {
	this->kinectDevice.getColorInDepthTex().unbind();
    }

Which would be appropriate if:
this->updatePointsCache(depthImg, this->depthToWorldImg);
were being called, but this will never be called when
kinectSettings.updateColor = true;
And to have the colorInDepthTex needed for the texturing kinectSettings.updateColor must be set to true;

If I manually change the Device.cpp to only use:
this->updatePointsCache(depthImg, this->depthToWorldImg);
Then the results are correct, however
this->updatePointsCache(colorImg, this->colorToWorldImg);
never returns the correct points, it should make a point cloud where the full colour texture can be bound and it would have the correct positions and texture coordinates.

I am not sure where the error comes from with the larger interpolated depth point cloud though.

Cheers

k4A doesn't reach 30fps

Hi prisonerjohn,

I am testing example-streams on a pc with Intel i7 GTX1060 running both Windows 10 + Visual Studio 2017 and Ubuntu 18.04 + Qt Creator. The Kinect grabbing frame rate doesn't reach 30 fps as it does in the Microsft SDK example, that is in the specs of the camera.

Windows: app 50 fps k4a: 15 fps.

the console gives first a list of "[warning] ofGLProgrammableRenderer: draw(): texture is not allocated"
the it gives "[warning] ofxAzureKinect::Stream::updatePixels: No Color capture found (358)!" once per second.

Ubuntu: app 60fps k4a: 19 fps.

Do you have any suggestion? It's a strong limitation...

Thanks a lot,

Paolo

Examples should be minimal.

I just finished teaching with the addon, and unless you throw away everything but the addons.make, src folder and bin folder before you run the Project Generator, it fails to properly link everything. I would reccomend stripping out the other files in the examples here.

body tracking latency compared to Body Tracking Viewer.

Hello,

I'm running the body tracking example and it's working OK apart from the latency.
Framerate is fixed at 60 and even so, there's a 1s delay between the image and movement.
This doesn't seem to be affected by number of bodies or computer performance.

That isn`t the case in the Body Tracking Viewer application, in which there is absolutely no delay.

Would anyone know what`s going on?

Thank you,

Antonio

Linking problem?

Heyo!

I'm trying to use your addon with openframeworks, but I think I got a linking problem and im not really sure what to do to fix it.

image

image

Any ideas how to fix this? Would appreciate it very much!

Thanks!!

libjpeg-turbo linking issues

I am in the process of getting everything to work in a Linux environment, and so far so good, but I'm having difficulty with the turbojpeg part of the build process.

Specifically, I have added the following in the addon_config.mk file

linux64: 
	ADDON_INCLUDE += libs/turbojpeg/include
	ADDON_INCLUDES += /usr/include/k4a
	ADDON_INCLUDES += /usr/include
	ADDON_LIBS += /opt/libjpeg-turbo/lib64/libjpeg.so
	ADDON_LIBS += /usr/lib/x86_64-linux-gnu/libk4a.so
	ADDON_LIBS += /usr/lib/libk4abt.so

And when I try to compile I get linker errors:

/home/random/of_v0.11.0_linux64gcc6_release/addons/obj/linux64/Release/ofxAzureKinect/src/ofxAzureKinect/Device.o:Device.cpp:function ofxAzureKinect::Device::Device(): error: undefined reference to 'tjInitDecompress'
/home/random/of_v0.11.0_linux64gcc6_release/addons/obj/linux64/Release/ofxAzureKinect/src/ofxAzureKinect/Device.o:Device.cpp:function ofxAzureKinect::Device::~Device(): error: undefined reference to 'tjDestroy'
/home/random/of_v0.11.0_linux64gcc6_release/addons/obj/linux64/Release/ofxAzureKinect/src/ofxAzureKinect/Device.o:Device.cpp:function ofxAzureKinect::Device::updateCameras(ofEventArgs&): error: undefined reference to 'tjDecompress2'

Is there a particular version (1.5? 2+?) of libjpeg-turbo I should be installing? I'm also not entirely sure how the compiling+linking of this was done for Windows so I'm not very clear on what needs to be changed?

Missing the sdk

fatal error C1083: Cannot open include file: 'k4a/k4a.hpp'
i installed the sdk, and configured the path in environnent variable

getDepthTex() won't draw

Trying to run example-streams and am unable to draw the texture returned from getDepthTex(). All of the other streams are working, and I have set my Windows environment variables properly. Any idea why that might be ?

I'm running the most recent openFrameworks environment on Visual Studio 2017

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.