auduno / headtrackr

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

support for multiple faces #37

Open matt-cook opened 9 years ago

matt-cook commented 9 years ago

Is it possible to modify the library to support simultaneously tracking multiple faces?

alexiskattan commented 9 years ago

+1

auduno commented 9 years ago

Well, I guess it's possible to modify headtrackr to do this, but in practice I think it would take a lot of work to get it to work properly. First of all, headtrackr is based on the "camshift" algorithm, which tracks faces purely by color. This algorithm is very quick, but also pretty imprecise, so it's likely that if two faces (of similar color) were somewhat close to each other, the camshift algorithm would get confused and mix up the faces. Second, if the tracker lost track of one of the faces, it would need to be able to detect the "correct" face when re-initializing tracking. This is a bit tricky and I can't think of an immediate solution to it.