This takes you way down the wrong rabbit hole, but maybe you can get the idea:
www.tomshardware.com/how-to/raspberry-pi-facial-recognition
But if it can recognize faces it has to separate them from the surroundings, and if t can discriminate friends from random strangers it should be able to discern relative velocities.