This is a proof of concept project for the Catana Security Camera project.
What this system does, is detect when a complex gate is open, retrieve a single picture, from an IP camera, then use License Plate Recognition software to determine the license plate number of the vehicle(s) that passed through the gate.
It was developed with the Raspberry pi 2 Model B (though other models should work) and uses the Open ALPR library.
- 1x Raspberry pi
- 2x Female pin connector wires (or 1x double female connector from an ATX power switch header connector, which is what I used)
- 1x Magnetic switch (I got mine from a R55 indoor door alarm/chime). The circuit should be closed when the magnet is close
- 1x Magnet. I recommend a strong magnet, such as an old hard drive magnet, which is what I used.
- 1x IP camera that is left unsecured (no authentication required), for development purposes. I used my Note 3 and the IP Webcam app to turn my phone into an IP camera.
- Something that you camera can take a picture of that has cars with license plates. It be an image of (or an actual) car with the camera's FoV set to be able to see the whole front of the car including headlamps, as capturing the license plate alone wont work.
- Any OS with a working Python interpreter on it and the RPi library. I used Raspbian
- Install Open ALPR. You will most probably need to install it 'the harder way' , (I.E: Compile dependencies), assuming you are using Linux.
- Download this project. You can use
git clone https://github.com/adampiskorski/lpr_poc.git
- Make sure the global variables at the start of
detect.py
are configured correctly: - Set
LPR_PIN
to the GPIO pin you are going to use. I used this for reference for my pi 2 Model B. - Set
SOURCE
to the web address to get a fresh still image from your IP camera (the default value there is for the IP Webcam app). - Set
FILE
to the path in which you want to store the captured image. Note that only one image will ever be saved as the previous one will be overwritten. - Solder the end of each wire with the female pin connectors to opposite ends of the magnetic switch.
- Connect one of the female pin connectors to a GPIO (21 is the default for this project) and the other to a GND pin.
- Place the magnet next to the magnetic switch, or even touching it.
- Place something in front of the camera for it to capture.
- Execute
detect.py
by executing the command:sudo python detect.py
(note that sudo is necessary in order to use the GPIO pins) - Move the magnet away from the magnetic switch. An image will be saved, the message
Gate has been opened!
will be displayed in the console, then the license plate number(s) that was in view of the camera. - Move the magnet back to it's original position next to the magnetic switch. You should
then observe the message:
The gate has now closed!
.
detect.py
was started off the very basic Burping Jelly Baby tutorial.lpr.py
is based on lukagabric's script.