With the current global situation impacting many communities and businesses, I set out to build a scalable device that uses computer vision to provide real time information about social distancing practices in various locations. This technology will hopefully be used to inform decision making on where people decide to go.
Many restaurants and stores are beginning to reopen with limited capacities. This project is a low-cost yet effective solution to inform business owners if their social distancing protocols are being followed. It also can be used to inform potential customers about the number of people in the business, allowing them to make more informed decisions.
This project includes both a hardware and software component.
On the hardware side, I used a balenaFin with a USB webcam to record and process camera data and send it to the web application. I chose the balenaFin over a traditional Raspberry Pi due to its increased versatility and potential Power over Ethernet capabilities.
There are two main software components to this project. The first is the vision software used to detect people given a camera feed. The code for this section was largely based on PyImageSearch's Social Distance Detector project, modified slightly to run on the balenaFin. The project finds people within a camera feed and utilizes the distance between pixels to determine how far two people are from each other. I also added functionality to send the data to an AWS Lambda script with a REST API so that it can be accessible from the other software component of the project: the web application. For security purposes, the camera footage is not transmitted over the internet and never leaves the balenaFin. However, in the future this can be configured to act as a security camera in addition to serving the needs of this project.
I used the MERN stack to write a full stack web application to display the data received from the balenaFin. It takes in the data and allows the owner of the hardware setup to configure the device's coordinates so that users can know what location is being tracked.
The PyImageSearch code is available here: https://www.pyimagesearch.com/2020/06/01/opencv-social-distancing-detector/
I hope that this project can be utilized to help business owners and customers make more informed decisions.
Comments