auduno / headtrackr

Javascript library for headtracking via webcam and WebRTC/getUserMedia
3.69k stars 504 forks source link

Accuracy #3

Closed rafaelfaria closed 11 years ago

rafaelfaria commented 11 years ago

Hi mate,

sorry to bother you again with all these questions.

I notice that you are tracking the face but the neck is also being tracked. Is this being tracking by the contrast or something like that?

If I cover my neck and have only a small that gets from my schin to the top of my head what I want to do works just about right.

Any directions?

THanks

auduno commented 11 years ago

Yeah,

what is actually being tracked is areas in the image that have roughly the same color as the face, so you can experience that the tracker also includes the neck, hands and really anything that's skin colored.

Looking at just the color is a very fast way to do tracking, which is why I achieve real-time tracking, but there might be better ways to do it. For left-right movements it works reasonably well, but for up-down movements it's not so good. If you're wearing a low-cut top, you're going to have problems... :) In my experience the quality of the tracking depends a lot on lighting conditions as well - if your neck is in the shadows compared to the face, tracking will be more precise.

There isn't an easy fix to this problem, but I might have a look at better tracking mechanisms in the future, can't promise anything though.

rafaelfaria commented 11 years ago

Hey Mate.

So the good news is that I manage to get more accuracy on the up-down movements. Not perfect but it will do the job.

The problem I'm facing now is. I have a small canvas with the video. 128 x 96. Where the user can see its camera. Than I project a silhouette of the face on the screen, but on a bit screen. So basically I'm projecting whatever you have on that green box you have on the example on a scale of 3. Thing is, because I'm scaling to whatever proportion, the "tilt" is also scaling. So lets say if you are still, there is this little tilt of 1 or 2 pixels, that on the green box doesnt make too much difference, but when you scale, 1 or 2, becomes 3 or 6, and so on. So my silhouette projected on the screen even when I'm still keep showing little tilting up and down, left and right. I'm trying to smooth it out, even tried changing the values of detectionInterval and smoothingInterval, but it doesnt seem to works.

Any ideas of what I can do to smooth it out when I scale it?

Thank you very much.

auduno commented 11 years ago

I'm not sure I understand your problem correctly, but you can try setting the parameter calcAngles to "false" when you initalize the tracker. This means it won't calculate tilt/angles. I don't know if you're using only the camshift library of the headtrackr library, but in case of camshift it would be:

var camsh = new headtrackr.camshift.Tracker({calcAngles : false})

and if you're using the main headtrackr:

var htracker = new headtrackr.Tracker({calcAngles : false})

Of course, if you have any other parameters set, you'd have to pass along those as well.