Skip to content
Openfl Native Extension for Microsoft Kinect for Windows SDK
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Color
Depth
DepthUserTracking
IR
Interaction
KinectGraphics
OpenFLKinect
Skeleton
.README.md.swp
.gitignore
README.md

README.md

OpenFlKinect

Openfl / Haxe native extension for Microsoft Kinect for Windows SDK

To build ndll library:

haxelib run hxcpp Build.xml

To compile samples:

[haxelib run] openfl build project.xml windows

Copy KinectInteraction180_32.dll from %KINECT_TOOLKIT_DIR%/bin into same directory as .exe

xcopy "%KINECT_TOOLKIT_DIR%\Redist\x86\KinectInteraction180_32.dll" "./Export/Windows/cpp/bin" /Y /C

Usage

// Set options
d = new DeviceOptions();
d.depthEnabled = true;
d.depthResolution = ImageResolution.NUI_IMAGE_RESOLUTION_640x480;

// Create a Kinect references
k = new Kinect(d);
k.start();

// Add the image stream display list
addChild(k.bmDepth);

// call update each frame
addEventListener(Event.ENTER_FRAME, function(e)
{
  k.update();
});

Dependencies

Depth Stream

d = new DeviceOptions();
d.depthEnabled = true;
d.depthResolution = ImageResolution.NUI_IMAGE_RESOLUTION_640x480;
d.userColor = false;
d.userTrackingEnabled = false

k = new Kinect(d);
k.start();

addChild(k.bmDepth);;

Colour Stream

d = new DeviceOptions();
d.irEnabled = false;
d.colorEnabled = true;
d.colorResolution = ImageResolution.NUI_IMAGE_RESOLUTION_640x480;
     
k = new Kinect(d);
k.start();
tilt = k.tilt;
addChild(k.bmColor);

IR Stream

d = new DeviceOptions();
d.irEnabled = true;
d.irResolution = ImageResolution.NUI_IMAGE_RESOLUTION_640x480;

k = new Kinect(d);
k.start();

addChild(k.bmIr);

User Tracking

d = new DeviceOptions();
d.depthEnabled = true;
d.depthResolution = ImageResolution.NUI_IMAGE_RESOLUTION_320x240;
d.userTrackingEnabled = true;
//d.binaryMode = true;
//d.inverted = true;
d.removeBackground = true;
d.userColor = true;

k = new Kinect(d);
k.start();
addChild(k.bmDepth);

Skeleton Stream

d = new DeviceOptions();
d.depthEnabled = true;
d.irEnabled = false;
d.colorEnabled = false;
d.nearModeEnabled = false;
d.skeletonTrackingEnabled = true;
d.userTrackingEnabled = true;
//d.depthResolution = ImageResolution.NUI_IMAGE_RESOLUTION_320x240;
d.flipped = false;

k = new Kinect(d);
k.start();


for ( i in k.skeletons )
{
    if ( i.isTracked )
    {
        k.adjustBonesToColor(i);
        
        var c = k.userColor(col);
        s.graphics.beginFill( c );
        s.graphics.lineStyle(2, c, .75);
        
        for ( j in i.joints.keys() )
        {
            var b = i.joints[j];
            s.graphics.drawCircle(b.position.x, b.position.y, 5);
            
            var start = i.joints[b.startJoint];
            s.graphics.moveTo(start.position.x, start.position.y); 
            s.graphics.lineTo(b.position.x, b.position.y);
        }
        
        bmdSkel.draw(s);
        s.graphics.endFill();
        bmdSkel.draw(s);
        
    }
    col++;
}

Interactions

class Navigation extends KinectRegion
addInteractiveChild(s);
s.addEventListener(TouchEvent.TOUCH_OVER, handOver);
s.addEventListener(TouchEvent.TOUCH_BEGIN, handDown);
s.addEventListener(TouchEvent.TOUCH_END, handUp);
s.addEventListener(TouchEvent.TOUCH_MOVE, handDrag);
s.addEventListener(TouchEvent.TOUCH_TAP, handTap);
You can’t perform that action at this time.