Page 1 of 1

Clean up license plates

Posted: 2016-05-08T22:49:56-07:00
by Amused23
Hello,
I am trying to use Tesseract as OCR for license plates. Here are a few examples:
https://www.dropbox.com/s/1ek33a1vrfa8gbv/LP3.JPG?dl=0
https://www.dropbox.com/s/izkz71t61rs84sj/LP4.jpg?dl=0
https://www.dropbox.com/s/6nahcjnw4o4fo0a/LP5.jpg?dl=0

I need to clear up the background and convert it to white while leaving the numbers thick black and bold. How can I accomplish this?
I am using ImageMagick-6.9.3-Q16 on Windows 7.

Re: Clean up license plates

Posted: 2016-05-08T23:28:15-07:00
by fmw42
The first one is very hard because the letters bleed together. The other two can be handled by measuring the approximate "black" color and converting all other colors to white and it to full black. Something like:

Code: Select all

convert LP4.jpg -auto-level -colorspace gray -fuzz 20% -fill white +opaque "gray(80)" -fill black +opaque white LPT4_proc1.png
You will need to play with the fuzz value and the gray value according to the histogram values of your image for the the dark letters.

The other image should be able to be processed similarly.

Alternately, find the fuzz value and the threshold value and do

Code: Select all

convert LP4.jpg -auto-level -fuzz XX% -threshold YY% LPT4_proc2.png

Re: Clean up license plates

Posted: 2016-05-08T23:56:55-07:00
by Amused23
The first one with fuzz 30% and gray 40 seems to work the best. Thanks you for your time.