OpenCV tracker

s.rozsa's picture

First off: cool Kineme stuff again :-) Just discovered the OpenCV patch and was playing a bit with the provided examples. Actually i rebuilt a process we are commonly using in our MultiTouch setups: take a snapshot of the camera while you don't have your fingers on the table. Substract that image from the video stream. Make some nice filtering to have your "blobs" as clear as possible black&white. Track the blobs using a CV algorithm...

I have fiddled around with the example compo from Chris and from Kris Harris. Theoretically it should work but in both compositions the tracked points are dropped after a very short time.

I'm upping a slightly modified version of the compo from Kris Harris which uses some prerecorded video instead of a live-stream.

Maybe one of you guys has an idea why this is not working...

Cheers,

Sandor

PreviewAttachmentSize
0_QC_TRACKER.zip1.62 MB

Comment viewing options

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

pixelnoizz's picture
Re: OpenCV tracker

in your optical flow patch the good points to track doesnt have find signal, and the find corner also doesnt have refine signal. cheers

d.

s.rozsa's picture
Re: OpenCV tracker

Köszi kedves Mr. Monkeypresso ;-) Translate: Thanks man! ;-) Yepp, that is one of the problems. But your right connecting that two signals (and also the load trackpoint signal in the optical flow patch) to the left mouse button makes the application work (somehow). So if we add a pulse signal (something that generates a pulse every "x" milliseconds) should do the job. But i think that even if that works it is not the right approach for hand/finger tracking...

I'm not quite sure, but if i understand the documentation from Chris, in the OpenCV Calc Optical Flow Pyr LK "Trackpoints are loaded once only." So it seems that the "old" trackpoints will be "carried" even if the tracked portion of the image is no more ther (the finger blob)... This and the "artificial" cleanup with the "black screen" and the JavaScript patch will slow down the tracking...

I had a quick look at the "OpenCV Load" patch: "This patch loads Haar Classifier Cascade information from an XML file. This is used for facial detection." After i have found some sample .xml files (only facial stuff unfortunately and not hands) i have made a short testing - and it is working quite good...

My idea would be to use a simple oval shape in the .xml file, since the blobs are mostly oval... Anybody a clue on how to make such an .xml file???

Of course it would be awesome if we could build the scenario with a "real" Haar Classifier Cascade for the whole hand. That would look like the attached picture...

Any ideas ? :-)

Cheers,

Sandor

PreviewAttachmentSize
hands_results.jpg
hands_results.jpg62.57 KB

dust's picture
haar Patch n Kit

here is a haar training kit, i found online a few years ago. put your background pic in the negative folder, and put your fingertip images in the positive folder. the more images the better. the QC patch is just the cascade structure run through optical flow. parse out the haar detect object to get for each recognition x2, y2, w, h, etc...

PreviewAttachmentSize
haar.zip15.87 MB

s.rozsa's picture
Re: haar Patch n Kit

Hey Dust,

thank you very much man! I will make a testrun later today with the stuff you have provided...

dust's picture
Re: haar Patch n Kit

no thank you bud, if you didn't mention you got the haar detect to work in QC, i would have still thought it was broken. actually the haar detect itself is a bit sketchy still in qc. it seems to work ok if you run haar detect structure through the optical flow tack points ? let me know if you have any problems. good lookin out on nuigroup ;)

s.rozsa's picture
Re: haar Patch n Kit

Hey Dust, the Haar detect patch is accordigly to Chrisw pretty buggy... I remember that he wrote somewhere the he allready has a new version that is working better, but i saw no news till than... I am pretty bussy with some other stuff right now, but i will try to get some time the next weeks. Will report here or on NUI if i have made some significant progress...

Cheers mate,

Sandor

Lango's picture
Re: OpenCV tracker

monkeypresso wrote:
in your optical flow patch the good points to track doesnt have find signal, and the find corner also doesnt have refine signal. cheers

d.

You will also need to connect the 'Add Trackpoints Signal' input to the 'Add Trackpoints Signal' in 'OpenCV Calc Optical Flow Pyr LK'.

I have it working once I do those three. Although you still need to click each time as when it goes all black the dots will dissapear.