Skip to content

zoumson/LicensePlateDetection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LinkedIn

Detection of a car license plate in a parking lot

image

Table of Contents
  1. About The Project
  2. Files Structure
  3. Getting Started
  4. Usage
  5. Roadmap
  6. Contributing
  7. License
  8. Contact
  9. Acknowledgements

About The Project

LPR (License Plate Recognition), also known as ANPR (Automatic Number-Plate Recognition) is an image-processing technology used to identify vehicles by their license plates.

The system uses illumination and an infrared camera to take the image of the front or rear of the vehicle, then an image-processing software analyzes the images and extracts the license plate information.

Here's why LDR is valuable:

  • First of all, safety: the license plate serves as a virtual ticket, and grants free-flow access, preventing stolen cars or ticket swapping. Since ticket and license plate have to match at entry and exit, it is almost impossible to pursue fraudulent behaviors. With LPR you can also easily manage black lists and be in control of all the events and movements at entrance and exit.

  • LPR is highly reliable: in case of lost tickets, it is easy to determine the actual entry time from the license plate number.

  • In addition, LPR also allows multiple integrations and customizations, especially for contract parking where the recurrent user can smoothly access and egress the car park without any titles other than the vehicle license plate.

  • With LPR, it is also possible to enter with a pre-paid ticket, or use cashless solutions. Another benefit offered by LPR at entries/exits is the possibility to book a parking space in advance, to ensure the driver a hassle-free experience.

  • Last but not least, LPR can be retrofitted and added to existing solutions.

A list of commonly used resources that I find helpful are listed in the acknowledgements.

Built With



File Structure

Folders

Entire Files Structure

.
├── CMakeLists.txt
├── include
│   ├── ConstantsDetectChars.h
│   ├── ConstantsDetectPlates.h
│   ├── ConstantsIdentifyPlate.h
│   ├── ConstantsPreprocess.h
│   ├── DetectChars.h
│   ├── DetectPlates.h
│   ├── IdentifyPlate.h
│   ├── PossibleChar.h
│   ├── PossiblePlate.h
│   ├── Preprocess.h
│   └── ShowLicensePlateArgs.h
├── README.md
├── ressource
│   ├── image
│   │   ├── image10.png
│   │   ├── image11.png
│   │   ├── image12.png
│   │   ├── image13.png
│   │   ├── image14.png
│   │   ├── image15.png
│   │   ├── image16.png
│   │   ├── image1.png
│   │   ├── image2.png
│   │   ├── image3.png
│   │   ├── image4.png
│   │   ├── image5.png
│   │   ├── image6.png
│   │   ├── image7.png
│   │   ├── image8.png
│   │   ├── image9.png
│   │   ├── imgOriginalScene.png
│   │   ├── test2.png
│   │   └── test.png
│   └── xml
│       ├── classifications.xml
│       └── images.xml
└── src
    ├── demo
    │   ├── CMakeLists.txt
    │   └── Demo.cpp
    └── lib
        ├── CMakeLists.txt
        └── plate
            ├── DetectChars.cpp
            ├── DetectPlates.cpp
            ├── IdentifyPlate.cpp
            ├── PossibleChar.cpp
            ├── PossiblePlate.cpp
            └── Preprocess.cpp

8 directories, 43 files

Getting Started

This is a sample code of how you may detect a license plate on a image. To get a local copy up and running follow these simple steps.

Prerequisites

This is an example of how to list things you need to use the software and how to install them.

  • cmake
    sudo apt-get install cmake
  • CPP standard: CMAKE_CXX_STANDARD 17
  • Install gtk and gtk3 module to access canberra-gtk-module used by opencv imshow
sudo apt install libcanberra-gtk-module libcanberra-gtk3-module

Installation

  1. Install first opencv4 cpp libraries at https://opencv.org/
  2. Clone the repo
    git clone https://github.com/zoumson/LicensePlateDetection.git
  3. Go to the project directory source
    cd LicensePlateDetection
  4. Create empty directories build, lib, result and bin
    mkdir build && mkdir lib && mkdir bin && mkdir result && cd result && mkdir image && cd ..
  5. Generate the library libplate.so and move it to lib and the exectutable demo and move it to bin
    cd build && cmake .. && make && cd ..
  6. Install the library libplate.so to /usr/lib
    cd build && sudo make install && cd ..

Usage

  1. Command line arguments

Car license plate detection
Usage: demo [params] 

        -?, -h, --help, --usage (value:true)
                show help message
        -c, --classifier (value:./ressource/xml/classifications.xml)
                input classifier path
        --ext, -n (value:png)
                save image detected with detected plate extension
        -i, --image (value:<none>)
                input image path
        --name, -p (value:image)
                save image detected with detected plate name
        -p, --path (value:./result/image/)
                save image detected with detected plate path
        -s, --show (value:false)
                show detection steps
        --save, -v (value:false)
                save image with detected plate
        -t, --train (value:./ressource/xml/images.xml)
                input trained images path


  1. Run with an image in ./ressource/image
./bin/demo -i=./ressource/image/image6.png -v=true

Before detection

image6


After detection: image saved as image_29_05_2021_16_25_27

image_29_05_2021_16_25_27


License plate number NYSJ

  1. Back to the initial file structure configuration
    rm -r bin build lib result 

Roadmap

All the headers files are well docummented, read through the comments

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Adama Zouma - - stargue49@gmail.com

Project Link: https://github.com/zoumson/LicensePlateDetection

Acknowledgements