'How to improve the visibility of numbers on license plate for OCR
I am using easyocr
methods to recognize the text on the license plate but the results are not good.
I have developed deep learning model which detects license plates and crops them.
After that, I just want to detect the numbers on the license plate. What methods can be used to improve the cropped image?
Output from Easy ocr - ['KA51', 'AE-7007']
Output from Easy ocr - ['KLOB BK.7779']
Code:
import easyocr
import string
reader = easyocr.Reader(['en'])
img = "/mydrive/yolor/cropped/318_0.jpg"
#ALLOWED_LIST = string.ascii_uppercase+string.digits
#characters = reader.readtext(img, detail=0, allowlist=ALLOWED_LIST )
characters = reader.readtext(img, detail=0)
print(characters)}
Solution 1:[1]
You can use Pillow to adjust brightness, sharpness and/or contrast. Here is the documentation for the image enhance functions: https://pillow.readthedocs.io/en/stable/reference/ImageEnhance.html
You will have to find something that works well enough on all pictures. That's why I would recommend to do something like a gridsearch and evaluate it on your dataset to find the best settings for the pre processing.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Raavgo |