Giter Site home page Giter Site logo

ofxmskinect's Introduction

ofxMSKinect addon for openFrameworks 0.3
Copyright (c) 2011 Matchbox Mobile Limited

See _License.txt for license and copyright information.

Feature list
~~~~~~~~~~~~
1. initialize multiple kinect devices
   a. Second kinect doesn't support player info in the depth data
   b. second kinect doesn't support skeleton tracking.
2. video data
3. depth Data
4. transform depth to video
5. multiple tracked skeleton data
6. skeleton data contains ofVec3f joint positions
7. transform joint position to depth position (used to help render in 2d)
8. Helpful methods to retrieve data as ofTexture, ofImage, ofPixels so you can manipulate.

Install
~~~~~~~
Please extract the zip file to the root directory of where you have openframeworks code.
For example, mine is:
	G:\Work\Projects\KinectOF\OFInstall\
The zip only contains our new files, it will not overwrite any of your existing install.

Once extracted, there will be a new folder in
	addons\ofxMSKinect\
And a new example in 
	apps\addonsExamples\msKinectExample\

The example project shows how to use all our currently exposed functionality.

How to use
~~~~~~~~~~
See msKinectExample for more details.

Initialize
~~~~~~~~~~
ofxMSKinect* kinect;
kinect = new ofxMSKinect();
kinect->Init(SINGLE_DEVICE); //Pass MULTIPLE_DEVICES if you intend to use more than 1 kinect.
       
if(kinect->HasKinectDevice())
{
       firstDevice = kinect->GetKinectDeviceDefault();

       // init the video feed
       firstDevice->StartRGB(IMAGE_RESOLUTION_640x480); 
       
       // init the depth buffer
       firstDevice->StartDepth(IMAGE_RESOLUTION_320x240); 
       
	// init skeleton tracking  
	firstDevice->StartSkeletonTracking();
}

Multiple Kinects
~~~~~~~~~~~
//Using multiple kinects has the same interface as single kinect
int count = kinect->GetKinectDeviceCount();
firstDevice = kinect->GetKinectDevice(1);


Camera Data
~~~~~~~~~~~

Get Video Data
~~~~~~~~~~~~~~
//First update the image
bool isOk = firstDevice->UpdateRGBVideo

//Now render it
firstDevice->DrawVidImage(x, y, w, h);


Get Depth Data 
~~~~~~~~~~~~~~
//First update the image
isOk = firstDevice->UpdateDepth() ;

//Now render it
firstDevice->DrawDepthTexture(x, y, w, h);



Get Player index from depth 
~~~~~~~~~~~~~~~~~~~~~~~~~~~                     
int player = ofxMSKinect::GetPlayerIndex(shortData[indexOfDepthData];

Get distance from depth data - millimetres
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
int distance = ofxMSKinect::GetDepthDistance(shortData[depthIndex]); 


Skeletons
~~~~~~~~~

Check if skeleton data exists
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if(firstDevice->HasSkeleton())

Get the first tracked skeleton data
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ofxMSKinectSkeleton skeletonData;

hasSkeleton = firstDevice->GetFirstTrackedSkeleton(&skeletonData);

Get a tracked skeleton by index
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ofxMSKinectSkeleton skeletonData;
skeletonData = firstDevice->skeletons[0];

Get Skeleton points
~~~~~~~~~~~~~~~~~~~
ofVec3f headPosition = skeletonData.SkeletonPositions[NUI_SKELETON_POSITION_HEAD];

Known issues
~~~~~~~~~~~~
1. Depth data has a 4 pixel bar on the left if transposed to image data
2. No Audio support



Development Environment and Compiler SUpport
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tested with the following IDE's:  MS Visual Studio 10,  CodeBlock (using Gcc compiler).

NOTE: !! Developers useing CobeBlock Gcc compiler who require multi device support please define the following in the defines pannel of your project
#define USING_CODE_BLOCKS_GCC_COMPILER

This is required to allow the code to include an additional Interface definition which allows Codeblocks Gcc compiler to correctly
confgure registers and stack in order the call into the MSKinetic.dll when addressing vtable entries which require access to the "this" ptr.

ofxmskinect's People

Stargazers

 avatar Nick K. avatar Mohammad Reza Taesiri avatar Jonghoon Seo avatar  avatar  avatar Mickey van Olst avatar  avatar  avatar Andreas Müller avatar  avatar anthony tran avatar Derek J. Kinsman avatar hojun avatar Anthony Tripaldi avatar kenfrederick avatar Mathias Kahl avatar spiceo avatar Adam Hinshaw avatar Jerome Maurey-Delaunay avatar Jay Choo avatar Brendan Oliver avatar Jason Van Cleave avatar Radamés Ajna avatar Filip Visnjic avatar

Watchers

 avatar Justin Eslinger avatar

Forkers

sleepybrett

ofxmskinect's Issues

running this on a mac

Hi,

This is most likely a scilly question to ask...
Can I run this project on a mac?

Thanks
S

cvImage memcpy problem

hi there!
thank you for sharing the wrapper first of all!
i try to save depth image to cvImage by setfrompixels (openCV) but keep getting access violation.

but i think
firstDevice->GetDepthPixels()

this will return bad ptr

and this is why it prevents memcpy.

looks like the thread is running to update depth pixel data but i still can't find why.

is this function working?

thank you!

GetFirstTrackedSkeleton() commented out

I'm taking a first glance at ofxMSKinect and I was trying to add skeleton data to the example. When I use the GetFirstTrackedSkeleton(ptr) method as you stated in the README, I get an error. I looked into the code in ofxMSKinectDevice.cpp and you actually have three skeleton retrieving methods commented out. I've uncommented them and I noticed that I can use GetSkeleton(index, ptr) but I can not get GetFirstTrackedSkeleton(ptr) because as the call passes through ofxMSKinectdevice.cpp and MS_NUI_Kinect_Interface.cpp, they require more arguments than just the pointer. Am I overlooking something or have you intentionally commented out the GetSkeleton functions. I would really like to use GetFirstTrackedSkeleton() if it's possible in this version.

getDepthPixels() and getofDepthPixels() not working correctly?

I'm an openFrameworks user ("irregular" in the openF forum) and I had made a thread there about a simple test I wanted to make. It is supposed to be a simple merge between the standard opencvExample that comes with oF 007 and msKinectExample that comes with the addon, so nothing fancy.
http://forum.openframeworks.cc/index.php/topic,8047.0.html

The problem is that I never managed to turn the Depth Information into information that openCV can read and turn to blobs, either using getDepthPixels() or getofDepthPixels() which is really weird and I tried many different approaches (using ofPixels, ofImage, ofTexture, Unsigned Chars).
The thread also describes my results (with screen captures) trying to change the resolutions from 320x240 to 640x480 and back. I am not aware if this is an issue or not but I've had no luck trying to find better documentation.

The following reply in the ofxMSKinect thread over at openF Forum has the source I had made, using Visual C++ 2010 Express and the Microsoft Kinect SDK as required, in a Windows 7 SP1 x64 computer:
http://forum.openframeworks.cc/index.php/topic,7282.msg38105.html#msg38105

I would describe this issue as being an unsuccesfull attempt at using what you describe in the Feature list as "4. transform depth to video" as image data, that can be ported to openCV for blob analysis. Only after many replies I have decided to post this here as an issue.

Also, I am very thankfull for ofxMSKinect and any support will be greatly appreciated.

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.