Giter VIP home page Giter VIP logo

license_plate_recognition's Introduction

license_plate_recognition

Project for Image Processing Course. The goal of the project is to recognize polish license plate from an image. Final

Requirements about images:

  • the angle between horizontal surface and license plate is +- 45 degrees
  • longer edge of license plate is greater than 1/3 of image's width
  • license plate has 7 characters
  • images can have diffrent resolutions

Requriments about project:

  • written in Python 3.7 using OpenCV
  • there's an option to use other libraries (like scikit-image) but you cannot use external OCR modules or trained models that can read characters
  • maximum time for each image processing is 2 seconds

Results on private test set:

  • Bounding box accuracy of license plate: 96,42% (27/28)
  • Bounding box accuracy of characters in license plate: 91,32% (179/196)
  • Total score: 86,42% (Every correct read character on license plate -> 1 point. Correct read of whole license plate equals to 1 point for each character + 3 additional points.)

Results on final, unknown test set:

  • Total score: 63.70% (Every correct read character on license plate -> 1 point. Correct read of whole license plate equals to 1 point for each character + 3 additional points.)
  • execution time per image: 0.11s

Usage

  • Create virtual environment using python3 -m venv venv
  • Install requirements from requirements.txt
  • Run script with python main.py <path_to_folder_images> <path_to_json_results_file>

How it works?

Preprocess the image.

  • convert to gray scale
  • resize the image for faster processing
  • blur image and find image edges.

Find potential vertices of license plate using edge image.

  • find contours on the image
  • create bounding boxes from contours
  • skip bounding boxes that doesn't match license plate height to width ratio
  • get corners of potential license plate

Get bird's eye view for every potential license plate

  • construct destination points based on vertices
  • get perspective transform matrix
  • warp the perspective getting bird's eye view in a process

Find ROIs of potential characters on every potential license plate

  • find contours on the image contours
  • get bounding box of each contour
  • discard all small bounding boxes and bounding boxes that don't match character width to height ratio
  • discard contours in contours bnd

Recognize characters in given ROIs

  • sort potential characters ROIs from left to right
  • compare ROI of each potential character with reference characters and get closest matching
  • if there's more ROIs than maximum license plate length, delete character with weakest matching

Fill empty characters on license plate

  • if there is no maximum number of characters found, fill empty spaces with "?". "?" are filled in proper space based on distance between each character

Check number of characters in first part of license plate

  • compute distance between ROIs to determine number of characters in first part of license plate

Check if license plate match polish rules

  • change forbidden characters to theirs closest counterpart. For example 2 -> Z in first part of license plate

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.