Algorithm to generate license plates with an specific fonts. The algorithm works in the following way:
- Take a random background and take a crop from it with the dimensions
OUTPUT_SHAPE
. - Generate a license plate image using a random code.
- Perform an afin transformation of the plate over the background. It helps to rotate, and scale the image in a random way.
- Wrap the transformed plate over the background.
- Apply a random noise to the final plate.
This algorithm is based in the following repositroy with several changes for our use.
In this project, you can find different scripts, with different functionality according for generete license plates, usage is as follows:
-
./extractbgs.py SUN397.tar.gz
: Extract ~3GB of background images from the SUN database intobgs/
. (bgs/
must not already exist.) The tar file (36GB) can be downloaded here. This step may take a while as it will extract 108,634 images. -
If you can perform some test use
./mini_extract.py 1000
. It extracts a mini dataset of 1000 samples from the complete dataset ofbgs/
in a foldermini_bgs/
(mini_bgs/
must not already exist.) -
./gen.py --num-img 1000
: Generate 1000 test set images intest/
using the default settings. (test/
must not already exist.) This step requires fonts such asFE-FONT.ttf
orHelvetica.ttf
to be in thefonts/
directory.
You can also add some characteristics to ./gen.py
using some parse statements, such as
--num-img
: total number of plates generated.--dataset
: only name of the folder of the background dataset--font
: only name of the font to draw the plates from the fonts folder--format
: chose the format to return the plate. It can only be1
or2
for for format 1 or format 2--star-idx
: start to name the images from this index.
./annotation.py --initial_idx 1 final_idx 10
: Label the images from 1 to 10, creating aannotation.txt
where each line context the following information:crops/<img_number>.jpg <license_plate_code>
--img_path
: select the path where are the images.
In this project, we use two most known formats of chilean license plates. These format are:
-
Format 1:
BB-BB·10
(4 letters y 2 numbers)-
18 available letters: B, C, D, F, G, H, J, K, L, P, R, S, T, V, W, X, Y, Z.
-
Available numbers from 10 to 99
-
Font: FE-Schrift
-
-
Format 2:
AA·10-00
(2 letters y 4 numbers)- 23 available letters for the first letter: A, B, C, E, F, G, H, D, K, L, N, P, R, S, T, U, V, X, Y, Z, W y M
Extra: O for diplomatic representation
-
23 available letters for the second letter: A, B, C, D, E, F, G, H, I, J, K, L, N, P, R, S, T, U, V, X, Y, Z
-
Available numbers from 1000 to 9999
-
Font: Helvética Medium Condensed
- Oscar Guarnizo
- Diego Suntaxi