using the KInect for mouse painting program

CliffSchwarz's picture

I need some help I am using the kinect for a simple painting program. I have replaced the mouse with the kinect camera without much problem however I am having some issues because the kinect does not always track as one would expect. I need the nearest point to the kinect camera to be the point that is assigned as the cursor of the mouse. I am sure this can be done it is just beyond my current Knowledge. I am sure that with the Depth camera it is possible to find the closest object in the fields of view and track it and use it as the cursor. any help would be greatly appreciated.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

dust's picture
Re: using the KInect for mouse painting program

here is a single centroid tracker you can use with the kinect. it is set to threshold of about .9 or so. it will track the blob closest to the camera. you can mess with the threshold depending on how far you are from the camera. this is set up to be the closest point to the cam. meaning you need to be about 2+ feet from the device and it will track your extended hand. adjust the threshold accordingly to how far away you are from the device.

PreviewAttachmentSize
dust_centroid_kinect.qtz35.4 KB

CliffSchwarz's picture
Re: using the KInect for mouse painting program

Thanks once again your the man, I will check this out.

offonoll's picture
Re: using the KInect for mouse painting program

@ Dust: In order to track a hand or blob and then get the centroid. what do you think is best? I have seen your technique (A) and the 'Mask Alpha' Color TrackingCI technique (B).

A. Your way of tracking is very cool but it needs a minimum 'resolution' to get a nice movement. To me is the best way I have seen til now. Another similar way I found made by 'carasuelo' http://kineme.net/composition/benoitlahoz/BoundingBoxMaskforPixelS This have a limitation of one single tracking object.

B. Color tracking CI is a nice technique but the plugin isn't working (at least to me) http://parmanoir.com/How_Core_Image_Color_Tracking_works and the samples on the other threads, (using pixelz2 plugin and one single px reduction) aren't very much working. This is a good way to work with multiple hands with kinect. But in this case, how is possible to get two different colors from same gray??

OpenCV Option: to have a OpenCV LIB (with centroid and ID for each centroid) like Nui Group http://nuicode.com/ this app works very good.

cheers!

gtoledo3's picture
Re: using the KInect for mouse painting program

I'm not Dust but,

...Which app in particular on the NUI site? I dl'ed some stuff, and it's all hodge-podged w/ a bunch of OFX code.

offonoll's picture
Re: using the KInect for mouse painting program

dust's picture
Re: using the KInect for mouse painting program

well there are various ways to do these things in concatenation with qc. meaning there are various other programs that you can use with qc at the moment to do this as well. at nui there are a ton of blob tracking algorithms. community core vision nui's multi-touch app uses open frameworks but there are a ton of other software libs based on open cv that could be used for this.

my personal favorite codes are from martin at tuio.org and ben at xtuio.org. opentouch is bens tracker made with obj-c. im thinking i might have a look and see if i can not make a plugin out of his code.

http://code.google.com/p/opentouch/source/checkout

other than me messing around in openCL trying to make my own computer vision based things with the kinect.

i suggest. tryplex for qc based skeleton tracking with osceleton.

i have got some use out of martins...

tuio kinect at https://code.google.com/p/tuiokinect/

and check out this nui KinectCoreVision for finger tracking... http://www.patriciogonzalezvivo.com/blog/?cat=118

then there is openNI that does hand tracking as well with various gestures. i have been messing around with some of them with amir in unity.

you can try my most recent blob tracker

http://www.patriciogonzalezvivo.com/blog/?cat=118

i got multiple blobs tracking and its ready to index out a centroid. a centroid being just the average mean of all the tracked pixel positions of the blob. still lots of work to do like contours etc..

so there are a ton of solutions. actually you can send your qtz file to most blob trackers in the form of a virtual camera with cam twist then use like ccv and send the data back to the qtz file via tuio.

the problem with using programs outside of qc is that you then do not have access to the rgb and depth images in qc. if tracking is all you need there are plenty of solutions.

so far the only qc based solutions are either my cl centroid or smorkis and jstrekers ci centroid trackers. which require various solutions of ties's pixelS.

offonoll's picture
Re: using the KInect for mouse painting program

Very interesting. Probably mixing another external app between compositions is a good way too... until there is no better plugin for this. I will study about it when I got more time.

Thank you dust.

Daniel's picture
Re: using the KInect for mouse painting program

hi, your idea is quite unique, and it caught my attention. However, I can't really help you, my knowledge on kinects is not that good, maybe yours is more advanced :) I will just subscribe on this to see future posts of yours.. I am really interested on this.. you can visit this site, I hope this will help you. http://www.intechopen.com/books/show/title/object-tracking

dust's picture
Re: using the KInect for mouse painting program

nice link daniel. seems like a bunch of good papers or books on that site. there is a lot of kinect code out there now. when kinect first came out open NI wasn't released so i had to make up some of my own algorithms.

there really isn't much difference between pre kinect computer vision algorithms and post kinect algorithms. so most of the topics covered in the object tracking book you linked to will apply for the kinect. really its the depth image that makes the kinect special.

there is an apple dev example that shows you how to derive a depth image from stereo imaging. i'm attaching it to this post. there is some useful info included in the patches source link in regards to depth computations and its a nice look at.

im thinking we may see more stereo devices in the near future. check http://www.minoru3d.com/ being the first(?) consumer stereo cam for pc ;(. to me it seems that movies / televisions etc.. are jumping on the 3d stereo bandwagon. now nintendo has a stereo cam on its ds plus augmented reality. so i bet we are going to see some sort of stereo kinect camera in the near future.

it also seems augmented reality will be a reality so there should be a bright future for people that understand computer vision. there are a lot of people working on the mouse pointer object tracking and stuff right now so i would think that if you want to stand out in the computer vision field you will need to focus on doing new and interesting things with it.

check out the predator http://www.youtube.com/watch?v=1GhNXHCQGsM predator deploys optical flow machine learning algorithms to track things very accurately using nothing more than a web cam. its now been ported to the mac in matlab ;) it seems mouse pointer object tracking is all sorted out.