ANPR cameras are widely used throughout communities. A camera is used to acquire images, and through image processing, the system can detect and output the alphanumeric characters of a number plate on a vehicle using the process called optical character recognition (OCR).
Police may use such devices to detect insurance fraud or tax evasion by taking the alphanumeric characters detected and inputting them into a database for a vehicle check. Various car parks may use an ANPR camera to detect the duration of stay of a specific vehicle or to log who enters/leaves the car park.
This project uses a myRIO and also the NI Vision Development software to mimic the functionality of the ANPR camera described above. The image processing and OCR process are all deployed on the Real Time target whilst the Host PC deals with logging the detected number plates to a text file.
The project attached below can be run with the myRIO connected by WiFi.
This project was first created in Vision Assistant, before using the tools to create the corresponding LabVIEW VI. One of the functions in the image processing palette searches the image for a shape outlined by a template which outputs a shape report. Using this shape report, you can programmatically generate a ROI descriptor to input into the OCR process.
There are various methods of building the algorithm to perform the same functionality. The following section describes how this algorithm is applied.
Acquire image through USB Camera and put it into a buffer
Take a colour threshold to look for the colour yellow. This outputs a binary image as shown above
Remove all smaller objects
Remove all border objects
Fill all holes to get a rectangular shape
Use Shape Matching tool to find the rectangular shape (this determines the coordinates of the rectangular object which will come into use later)
Store this binary image into a buffer
Retrieve the original image from the buffer
Take a threshold to find all dark objects (now I am trying to look for the alphanumerics)
Remove all border objects
Retrieve the previous image from the buffer and take the absolute difference of the two images, which leaves us with the alphanumerics
Build a Character Set File using the OCR tools
After this is converted into LabVIEW code, the shape report output in step 6 is manipulated into a region of interest (ROI) and is then an input into the OCR stage of the code. This means that LabVIEW will only try and find alphanumeric characters in the ROI specified programmatically.
Steps to Implement or Execute Code
Open Project and connect the myRIO either by WiFi
Connect the USB camera to the myRIO and direct the camera at a number plate
FTP into the myRIO and enter the two files called 'template.png' and 'myANPR Character Set File.abc' into /C/ni-rt/startup/ located on the myRIO
Deploy the VI under the myRIO in the project, and run the Host PC VI
Once the VI has started running, a text file is generated under My Documents called 'myANPR<date>'.
(Please note: Logging to file still needs a bit of tweaking!)
A video of the project working can be found in the attachments.
NI Vision Development Software 14.0
Microsoft LifeCam HD 1700 or any USB Camera
Rechargeable Batter for the myRIO (optional)
Additional Images or Video
[UPCOMING VIDEO TO BE UPLOADED]
About the Developer
Role at NI: Applications Engineer (Intern)
University: Loughborough University
Course: MEng Mechanical Engineering
myRIO Project 2014-2015
Jinfone Applications Engineer National Instruments