Jump to content
Sign in to follow this  
dvarapala

ZoneMinder - OpenALPR Integration

Recommended Posts

For the past few weeks I've been playing around with OpenALPR (http://www.openalpr.com/) and integrating it with my ZoneMinder (http://www.zoneminder.com/) system with good results. I don't get much vehicle traffic near my house, so to get some sample data I set up a camera with a good zoom lens and aimed it at a busy intersection about a block away. Although the placement is far from optimal, with the view partially blocked by trees, there is still a small peephole where passing cars are visible and plates can be recognized. Despite this handicap, the recognition works surprisingly well.

 

Compiling the OpenALPR source was pretty straightforward; the hardest part was tracking down compatible versions of the various libraries that OpenALPR depends on. The result is a library and a C++ class that you can include in your own programs.

 

ZoneMinder provides a "trigger" process that external software can connect to and receive notifications whenever motion is detected on a camera. I wrote a small daemon that connects to ZoneMinder's trigger daemon and, when it receives a notification that motion has been detected on the LP camera, it retrieves the frames with motion from ZoneMinder's database and runs them through OpenALPR for analysis.

 

When you pass an image frame the OpenALPR it returns to you a list of possible matches along with a confidence estimate. For example, a plate like 5KNP922 might return 5XNP922, 5KMP922, 5KWP922, 5XNP922, 5KNP927, and 5KNP922 as potential matches, with no easy way to determine which one is correct. Obviously this would be problematic for a "big brother" type application which wants to track every passing vehicle. This was less problematic in my application because I have a database of "known" license plates that the software can query; if one of the candidates detected by OpenALPR exists in my database, it is considered a positive match and the presence of the vehicle is logged. While the possibility of a false positive exists (for example, if both "5KNP922" and "5XNP922" are present in my database, my log would contain entries for both vehicles even though only one of them was actually present), this probability is acceptably low for "hobbyist" purposes. And again, my camera setup is far from optimal; with proper placement there would undoubtedly be less fuzziness in the results.

 

OpenALPR takes significant CPU time to analyze a frame, so I run it in the background at low priority so as not to interfere with ZoneMinder's normal activity; frames with detected motion are queued up by a foreground thread. ZoneMinder's motion detection culls out most of the frames, so a passing vehicle might result in only a dozen or so frames being analyzed, which is quite manageable. It usually takes 5-10 seconds from the initial motion detection to determine a match.

 

My test camera has a view of an intersection where cars are making a left turn. The camera is focused on the apex of the turn, where the back of the car is parallel with the focal plane of the camera. Thus each passing car produces a series of frames where the plate is at various angles WRT to the camera, with a couple of straight-on frames in the middle of the sequence. From this setup it is very apparent that the recognition is sensitive to the angle of the plate with respect to the camera; there is a fairly narrow range outside of a straight-on view where the recognition will still work, but outside of that the recognition fails even though the plate is still perfectly legible to a human. In addition, OpenALPR seems to have an easier time with light-colored vehicles. This may be because the plates appear as dark characters on a white background, so a light-colored car may blend in to the background better.

 

My next step will be to optimize my camera placement.

Share this post


Link to post
Share on other sites

I've been looking for a long time to find a solution like yours. We want to register all vehicles leaving our premises.

Zoneminder is running under Ubuntu server, the camera's we want to use are Raspberry Pi with Cam Module.

Is there a way we can share your resources to achieve this? Any write up available how to make the both working together?

 

Your advise is much appreciated!!!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×