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.
Clean up license plates
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Clean up license plates
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:
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 -colorspace gray -fuzz 20% -fill white +opaque "gray(80)" -fill black +opaque white LPT4_proc1.png
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
The first one with fuzz 30% and gray 40 seems to work the best. Thanks you for your time.