AIRLegend / aitrack

6DoF Head tracking software
MIT License
1.03k stars 102 forks source link

Infrared face detection #170

Open ghost opened 1 year ago

ghost commented 1 year ago

Face detection works in general very good. But it is limited to when some of the light comes on the face.

For example when I try to track my head during ATS game at night in my room and also at night in the game, the picture is really dark and there isn't much light on my face from the screen. The face detection does not work anymore in such conditions (and that's understandable).

The idea would be to mount some infrared LEDs near the webcam to light my face in infrared.

We know that for example PS3 Eye does handle IR very well and if we mount the IR filter to block regular light, we can normally use it as part of the TrackIR clone with Opentrack.

I could not test (yet) if face detection is based on color image or not. If we shine some infrared on something, it is generally one color (say represented as black and white) because the IR light has one only 850-ish NM wave length and all objects do not reflect any usual colors like in daylight.

Do we need some in-app switch or filter or profile to tell the app that the face detection should be IR based (or black/white)?

What do you think about it? Good idea?

AIRLegend commented 1 year ago

Yeah, I think it's a very good idea!

Actually, the models here work with 1-channel images, so no changes would be necessary to be made on them.

The main issue is that they're trained with a specific normalization (mean/stds). I don't expect them to work well directly on infrared images. However, as you said, I think it could be possible to 1) Add some kind of video filter which transforms infrared images to "regular b&w" ones or 2) Train models on infrared images (assuming some kind of image processing could be made on regular b&w to simulate infrared).

Please, if you give it a try, update with your results of testing directly with infrared light :)

d-kleine commented 1 year ago

The good thing about using IR is that you can reconstruct a 3-dimensional model of the face/head from the image's color channels. This might improve the jittering of the size/position of the bounding box.

An alternative idea would be to convert the RGB image of a frame to a thermal image (see here, this will not be real IR oc) and then reducing its dimensions to an 1-channel black-white image for the models.