We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi all I am working on a project using Processing, Kinect and OpenNI.
I want to create a Kinect Depth Image to create a distance threshold. Ie. Pixels within 1m are white, any beyond that are black. I am new to Processing and I am struggling a bit to make the code work.
I found out one of the previous post asked similar problems (https://forum.processing.org/one/topic/kinect-depth-thresholdi.html) but the code wasn't working when I run it/modify it.
Does anyone has experience on this and can give me a hand? Thanks a lot!
Answers
You could start describing what errors you get in the code that you tried before. What changes did you make, or what did you try to debug it? I will suggest exploring more previous posts related to your device:
https://forum.processing.org/two/search?Search=openNI
https://forum.processing.org/two/search?Search=Kinect
Kf
Thanks for the advice, Kf!
Basically what I did is use the existing DepthMap3D example from OpenNI. The example gives me a visualization of 3D pointcloud. I then modify it with the method I learnt from Shiffman's tutorial on how to create Depth Threshold.
Shiffman's tutorial used on a different library (OpenKinect) which couldn't work with my kinect. So what I tried to do is copy Shiffman's code into the OpenNI example, then changed some of the code to match the OpenNI library. I'm guessing it's the process when I change the codes create errors.
Below is my code:
In the processing IDE (not here), you can press ctrl+T to autoformat your code.
For the record, what OS are you suing and Processing version?
I checked your code and I don't see anything wrong with it. It is similar to what I have seen in other kinect sketches. Mind I do not have any of these units, so I have never tested one. checking other posts, it seems you need to call kinect update. Check:
https://forum.processing.org/two/search?Search=SimpleOpenNI
Specifically:
https://forum.processing.org/two/discussion/comment/92270/#Comment_92270
https://forum.processing.org/two/discussion/comment/92214/#Comment_92214
Kf
I am currently using window 7, Processing 3.2.1 and kinect for windows Model 1517. When you say kinect update, Do u mean "update driver".? I just checked and my kinect is up to date. The error that processing gave me when i ran the code is"ArrayIndexOutBounds".
Do you know what does that mean and how could that be fixed?
I tried to run the code from the link you provided but it wasn't running properly on mine. It was shown as blank grey image on the pop up screen.
Thanks in advances!
No... if you study a previous example in one of the links, they call something like kinectObj.update() right before you access your depth data. The error in your previous post tells me you are not loading your data before you try to access it.
Kf