I would like to say I thoroughly enjoyed working on the Path II Programming training project. As someone who does FPGA design for a living with a different manufacturer it was refreshing learning the Ultrascale FPGA and Vivado tools from Xilinx. Initially, my project entailed entailed developing a video streaming solution. I planed to use Petalinux for the development until I cam across a post from another participant post about PYNQ ( PYNQ - Python productivity for Zynq - Home ).
PYNQ is an open-source project from Xilinx that makes it easy to design embedded systems with Xilinx Zynq Systems on Chips (SoCs).
Using the Python language and libraries, designers can exploit the benefits of programmable logic and microprocessors in Zynq to build more capable and exciting embedded systems.
PYNQ users can now create high performance embedded applications with
- parallel hardware execution
- high frame-rate video processing
- hardware accelerated algorithms
- real-time signal processing
- high bandwidth IO
- low latency control
I used the latest PYNQ image release for the Ultra96V2 (Avnet Ultra96-V2: v2.5 PYNQ image). In my investigation of PYNQ I came across the community projects and noticed that OpenCV has been implement in PYNQ. I used OpenCV several years ago in the the design of a License Plate Recognition product thought hmmm that would be a great idea. Therefore, I pivoted my project to creating a License Plate Recognition Device (LPR) platform using a webcam..
There are a few LPR algorithms available out there and most are open source. One of the most popular ones is OpenALPR. However I found that during a Xilinx PYNQ Hackaton in 2017 an LPR algorithm was created for PYNQ ( https://github.com/Xilinx/PYNQ_Hackathon/tree/master/teams/team_lynx/OpenCV/License%20Plate%20Recognition ). There was no need to re-invent the wheel. I purchased a Logitech HD C525 webcam.
The Xilinx PYNQ Hackaton project does LPR on static image files (the image below is the one used in their project):
I needed to input video from a webcam so that plates are actively captured in real time.
Therefore, I modified some exiting jupyter notebook code used for webcam capture to capture images and save to a location for analysis by the LPR algorithm.
from PIL import Image as PIL_Image
orig_img_path = '/home/xilinx/jupyter_notebooks/common/cary_webcam.jpg'
!fswebcam --no-banner -r 1000x600 --jpeg 95 --save {orig_img_path} -d /dev/video0 2> /dev/null
img = PIL_Image.open(orig_img_path)
img
I set the resolution to 1000x600 and the image quality because the C525 image quality was less than expected.
The jupyter code takes about a minute to run but works like a charm. I used an old Florida License plate I have and it was able to decipher the plate number: LTB E29