update ocr.py and yolo.ipynb
This commit is contained in:
parent
90b44a6581
commit
dadca174b8
25
ocr.py
25
ocr.py
@ -1,30 +1,5 @@
|
|||||||
import easyocr
|
import easyocr
|
||||||
import cv2 as cv
|
import cv2 as cv
|
||||||
import keras_ocr
|
|
||||||
import pytesseract
|
|
||||||
|
|
||||||
def keras_ocr_func():
|
|
||||||
pipeline = keras_ocr.pipeline.Pipeline()
|
|
||||||
images = [
|
|
||||||
keras_ocr.tools.read(img) for img in ['img0.png', ]
|
|
||||||
]
|
|
||||||
prediction_groups = pipeline.recognize(images)
|
|
||||||
car_numbers = ''
|
|
||||||
|
|
||||||
try:
|
|
||||||
for i in prediction_groups[0]:
|
|
||||||
car_numbers += i[0]
|
|
||||||
except:
|
|
||||||
print('no detection')
|
|
||||||
|
|
||||||
return car_numbers
|
|
||||||
|
|
||||||
def tesseract_ocr():
|
|
||||||
img = cv.imread('img0.png')
|
|
||||||
res = pytesseract.image_to_string(img,
|
|
||||||
lang='eng',
|
|
||||||
config='--oem 3 --psm 6 -c tessedit_char_whitelist=ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789')
|
|
||||||
return res
|
|
||||||
|
|
||||||
def get_text_from_image(img_path, cut=7):
|
def get_text_from_image(img_path, cut=7):
|
||||||
text = ''
|
text = ''
|
||||||
|
1198
yolo.ipynb
1198
yolo.ipynb
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user