March 2019
Intermediate to advanced
538 pages
13h 38m
English
To make sure there is at least a one-second gap between collecting new faces, we need to measure how much time has passed. This is done as follows:
// Check how long since the previous face was added. double current_time = (double)getTickCount(); double timeDiff_seconds = (current_time - old_time) / getTickFrequency();
To compare the similarity of two images, pixel by pixel, you can find the relative L2 error, which just involves subtracting one image from the other, summing the squared value of it, and then getting the square root of it. So if the person had not moved at all, subtracting the current face from the previous face should give a very low number at each pixel, but if they had just ...