Social Distancing Detector

Our hack for hths.hacks() 2020 is an algorithm that compares the distance between people in a photo with their height and the average human height to determine how far away they are in real life units. Using OpenCV, our hack recognizes humans, then feeds the resultant data into an algorithm that converts it into a distance in centimeters -- how far away the two people are. Our original idea was to determine how far each person was from the camera, draw a triangle, and use trigonometry to figure out the distance between them, but that proved problematic and unnecessarily complicated because the camera isn't just a single point. Then we experimented with a smaller triangle using only the distance each person was relative to each other, but that didn't work because we still needed distance from the camera, which we were unable to calculate. We also ran into the issue of human heights varying, but eventually settled on an average value of 170cm.

Built With

Share this project: