Checking if face was in previous frame
To avoid false positives or unknowns which only happens in 1 frame (and quick oscillations between predictions), i thought i could do something like this and make sure it happens at least in 2 frames.
prototype code:
int framenumber; // global framecounter
for {
framenumber++;
{ // face loop
//prediction
if(framenumber==usernode.framenumber { // if in sync we got face for at least 2 contigious frames, so show it
showprediction
usernode.framenumber++; // per user framecounter
The above would work fine if there was only 1 face and if the face showed up every frame. Which is not realistic (and in that case i wouldn't have a problem to worry about). I need some formula that would incorporate the differing amount of recognitions as shown below (400x20x1) and multiply that by the amount of times we have seen that person.
I'm thinking maybe uses a modulus ? I'm not great at math and it seems like a simple thing but it seems to elude me all afternoon as to what the best approach is.
frames persons instances of person
400 peterx20recognitions 1
400 annax16recognitions 4
I have no idea what you're actually doing. I understand the problem, that you want to avoid false detections, but I don't know what information you have, what the code is supposed to be doing, or what that table means.
If you could try to clarify that, I'll try to help.
i also have no idea, what you're doing there. is it "tracking" ?
To
track
faces inside subsequently frames you need a tracking framework, something like Kalman filter or Parrticle Filtering. Start with googling on those terms. No good to reinvent the wheel.It's not tracking, i think that would be to much overkill for what i need.
The basic idea is: As i sometimes get false positives where something is mistakenly detected as a face (but it only appears for a second or so) i thought i would put in a basic check if that face was still there in the subsequent frame
Ignore the column, that was just something i used to illustrate for myself (400 frames, peter was 20 times recognized in that 400 frames, and instances is a dynamic value that counts how many times peter is on screen (so i could factor that in as a multiplier).
I'm keeping a linked list of recognized users, so i could keep track of the user that way. The code displayed is your run of the mill facerecognizer code, with a for loop for getting the frames, and another to processtheface
I just need a simple way by way of a marker if the user appeared in 2 contiguous frames. I could tune detectmultiscale but i don't want to loose any precision in detecting faces.
How about something like this: