First commit OCR_earsing and Synthetics Handwritten Recognition awesome repo
This commit is contained in:
17
OCR_earsing/utils/easy_ocr_utils.py
Normal file
17
OCR_earsing/utils/easy_ocr_utils.py
Normal file
@@ -0,0 +1,17 @@
|
||||
import cv2
|
||||
import easyocr
|
||||
|
||||
|
||||
def easy_ocr_extraction(
|
||||
img_path: str
|
||||
) -> dict:
|
||||
org_img_bgr = cv2.imread(img_path)
|
||||
reader = easyocr.Reader(['fr', 'en'])
|
||||
result = reader.readtext(org_img_bgr)
|
||||
word_info = []
|
||||
for (bbox, text, _) in result:
|
||||
word_info.append(
|
||||
[bbox[0][0], bbox[0][1], bbox[2][0], bbox[2][1], text]
|
||||
)
|
||||
|
||||
return word_info
|
||||
Reference in New Issue
Block a user