Build a security camera with Raspberry Pi and OpenCV
Tired of opening the refrigerator only to find that your favourite snack is missing? Get video evidence of sneaky fridge thieves sent to your phone, with Adrian Rosebeck’s Raspberry Pi security camera project.
Adrian loves hummus. And, as you can see from my author bio, so do I. So it wasn’t hard for me to relate to Adrian’s story about his college roommates often stealing his cherished chickpea dip.
“Of course, back then I wasn’t as familiar with computer vision and OpenCV as I am now,” he explains on his blog. “Had I known what I do at present, I would have built a Raspberry Pi security camera to capture the hummus heist in action!”
Raspberry Pi security camera
So, in homage to his time as an undergrad, Adrian decided to finally build that security camera for his fridge, despite now only needing to protect his hummus from his wife. And to build it, he opted to use OpenCV, a Raspberry Pi, and a Raspberry Pi Camera Module.
Adrian’s camera is an IoT project: it not only captures footage but also uses Twillo to send that footage, via a cloud service (AWS), to a smartphone.
Because the content of your fridge lives in the dark when you’re not inspecting it, the code for capturing video footage detects light and dark, and records everything that occurs between the fridge door opening and closing. “You could also deploy this inside a mailbox that opens/closes,” suggests Adrian.
Get the code and more
Adrian provides all the code for the project on his blog, pyimagesearch, with a full explanation of why each piece of code is used — thanks, Adrian!
For more from Adrian, check out his brilliant deep learning projects: a fully functional Pokémon Pokédex and Santa Detector.
A Pi that lives in the fridge? How cool ;-D
(although I guess using an LDR would have been easier than OpenCV? https://gpiozero.readthedocs.io/en/stable/api_input.html#lightsensor-ldr )
The pi looks too obvious in the picture. Inside a fake food container would help :)
Yeah, good article. But the processing speed sometimes seems slow for Raspberry Pi. You can check the OpenCV build steps here: https://www.life2coding.com/install-opencv-3-4-0-python-3-raspberry-pi-3