closest object

Dec 7, 2010 at 4:33 PM

Which is te fastest way to get an image representing the closest object and an arbitray threshold ? let's say a depththreshodeldimage, where the minimum is represented byt the minimum value in depths ?

Dec 7, 2010 at 4:34 PM

From my tests, I've seen that the minimum distance that the Kinect detects is about ~65-80cm. ie, set MinDistance = 65, MaxDistance = 80. That should do the trick.

Dec 7, 2010 at 5:45 PM

i was intending something like that :


Dec 7, 2010 at 5:55 PM



Well, you could use the DepthsCalculated event, and then iterate through the array searching for the minimum distance that is higher than 0. This is important because some points get returned as -33.33 or so.

Dec 7, 2010 at 6:50 PM

I'm just new to c# and c++, so i take a long time to figure out everything, anyway, i  used the mainloop into CLKinect to get the closest depth then I use it to draw an image grabbing only a selected range , starting from closest point backward till an arbitray depth; this way can be easily set up th hands grabbing.

What i want to do now is to use the hands image to perform fingers finding, shouldnt be hard to do, and I already have it in vvvv prototype, in fact still dunno why i'm doing that :D

Dec 7, 2010 at 10:34 PM

i've modiefied the event for image call back like this :


 private void KinectThresholdColorImageUpdated(object sender, CameraImageEventArgs e) {
            if (Mode != 3)

            Image<Gray, Byte> frame = new Image<Gray, byte>(e.CameraImage);

            imgDisplay.Image = e.CameraImage;


where  Image<Gray, Byte> frame  is  Emgu.CV.Image    ->  it slow down totally and sadly :)  how else could I handle that bitmap into an EMGU image container ?

Dec 7, 2010 at 10:57 PM

Why do you want to use a Emgu.CV.Image? Not criticizing, just wondering.

Dec 7, 2010 at 11:03 PM
Edited Dec 7, 2010 at 11:04 PM

cos I have tried the code of this : 

It's quietly robust and working and done with EMGU, I was wondering to implement it just to see how it works, but dunno why framerate drops down as i perform that image operation

Dec 7, 2010 at 11:04 PM

They might be using safe code. To use high-performance bitmaps in .NET you have to go native. :(

Dec 7, 2010 at 11:06 PM
Edited Dec 7, 2010 at 11:08 PM

I don't even know  which is the difference :D

and the code of that that EMGU is performing a lot of these operation , running very fast.

could u point me somewhere ?

Dec 7, 2010 at 11:07 PM

Sure. Give a read.

Dec 7, 2010 at 11:11 PM

mmmh, ok but why this runs fast and is performing a lot of Image operations ?

Dec 9, 2010 at 3:01 PM

solved , i use a lockbits to ensure the reading of frame, not clean but working

Btw, how come processes are not locked and unlocked to perfomr operation within  ?

Dec 9, 2010 at 3:02 PM
Where? NKinect?
Dec 9, 2010 at 3:34 PM

where what  ? :)

Dec 9, 2010 at 3:35 PM
"how come processes are not locked and unlocked" Where are they not locked? Do you mean NKinect?
Dec 9, 2010 at 3:43 PM

yes i mean in the main loop that handle the events dispatched then to listeners, anyway, the first time i apporached the locked/unlocked , safe/unsafe was 24 hours ago, just happy it works finally, locking the e.cameraImage into a bitmap so i can use it, then unlock, framerate is kinda normal now :)

Dec 9, 2010 at 3:46 PM
They are locked - but I moved that logic to a different class. See BitmapDataArray :) Or something like that
Dec 9, 2010 at 3:47 PM

oj ok, i will take a look to that later, thank u for pointing me :)