Kinect - Getting accurate and less noisy User Pixels (Green Screen Effect)

Hi All,

I recently came across this awesome project called “Woodland Wiggle” by Chirs O’Shea.

I am really interested to know how he has implemented the green screen effect. I guess it is more or less similar to OpenNI get user pixels method. However, the way he has implemented seems to be giving more accurate and nice looking contour/shape.

More pictures:

I even checked out the sample that comes with the official Kinect SDK. But, that gives very low quality results similar to this, (notice the missing pixels of head/hair).

Really interested to know some information on the implementation.


Hi Lahiru

I use ofxKinect and take the depth image, threshold it so you end up with just a black and white image of things that are close to the screen, then put that image through the contour finder in opencv (within openframeworks), to get the blobs.

Then I just turn each blob into an ofPolyline, so in my class definition I have:

vector contourPoly;

then in my update function…

// smooth blobs  
            for (int i = 0; i <blobFinder.getNumBlobs(); i++){  
                // does blob have any points?  
                    ofPolyline tempPoly;  
                    // smoothing is set to 200  
                    ofPolyline smoothTempPoly = tempPoly.getSmoothed(20, 0.5);  
            }// smooth blobs  

getSmoothed() basically smooths out the contour to remove most of the jagged edges, but you end up with other problems, like the small hands or head being cut out etc.

Anyway, give that a try and feel free to post any more questions here.

Hi Chris,

Many Thanks for the reply!

I also noticed the issue with small hands etc… apart from that it seems to give really good results. Will try this out.

Btw, were you able to handle gestures with ofxKinect? I am guessing you detect the hand regions in the coloring/painting app.

I actually want to use the user-pixels and gestures at the same time. Thought of using ofxOpenNI, but a previous version keep crashing at runtime. Would like to know if there is a way to handle gestures with ofxKinect.

Keep up the good work!

I’ve also used to get rid of the holes that can be caused by noise on the kinect feed itself. It’s worked pretty well. Drawing the user rep into a fading FBO works well too.

vector contourPoly; brings an error: Unknown type name ‘vector’: did you mean 'FVector?
When I change it to FVecter it comes up with another error.