Code Monkey home page Code Monkey logo

lpr_in_colab's Introduction

LPR_in_colab

Open In Colab (Executing with GPU)
Using morphological image processing and easyOCR to recognize license plates; Demonstrating the realtime detection with webcam in Google Colab.

  • colab_LPR.ipynb demonstrates the execution in Google Colab
  • anpr_easy.py (reference) and colab_cam.py (reference) are files needed to be uploaded in Colab when we execute colab_LPR.ipynb

License Plates Recognition

This question can be divided into two parts: object detection and optical character recognition (OCR).

  • Object detection
    I use morphological image processing to detect the license plates according to the article on PyImageSearch (reference). In the article, the author uses blackhat morphological operation to reveals dark characters against light backgrounds. Then, Sobel operator, blurring, and closing are used to find boundaries of the characters and fill the holes, which locates the characters. Next, after a series of iterative erosions and dilations, the author uses light regions as a mask to reveal the license plate candidates. The author restricts the aspect ratios of the candidates since the aspect ratio are usually in certain interval. To accelerate the filtering process, I add one restriction regarding the lower limit of $\frac{\text{Area of Contours}}{\text{Area of Bounding Box}}$, which filters out the candidates on messy backgrounds.
    *Note: In real life the restriction of y coordinate can be useful since the license plates are close to the ground.
  • OCR
    I use easyOCR to perform OCR, specifying the allow list of the result. The easyocr.Reader(['en']) is not written in anpr_easy.py because it takes a while to download the detection model.

Webcam and Realtime License Plates Recognition in Google Colab

According to Colab_Webcam_OpenCV repository (reference), I edit the realtime_process() function to draw LPR results on the screen.
The execution in Google Colab is main.ipynb. Demo video is as below...
*Note: anpr_easy.py and colab_cam.py must be uploaded to the current Colab environment before we run main.ipynb.

image

lpr_in_colab's People

Contributors

105304039 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.