I am trying to detect Date and time from the below image. Both easyOCR and Tessaract are not detecting correctly. I need to detect 2023/05/16 06:40:50 like in below image but easyOCR is detecting it as 2023/057716 06:40850 and Tessaract detecting it as 2623/05/16 66:46:58.
Please click here for the image I am using
I tried with below program
import pytesseract
import cv2
import easyocr
class Test:
def __init__(self):
self.text = ''
self.reader = easyocr.Reader(['en'], gpu=True)
def extract_time_easyOCR(self):
print("Inside easyOCR")
img = cv2.imread("videos\Cropped_Image.jpg")
result = self.reader.readtext(img)
for (bbox, text, prob) in result:
self.text+=text + ' '
**print("resultfromEasyOCR",self.text)**
return self.text
def extract_time_Tessaract(self):
print("Inside Tessaract")
image = cv2.imread("videos\Cropped_Image.jpg")
image_RGB = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
print("resultfromTessaract",pytesseract.image_to_string(image_RGB,config="--psm 6"))
easyOCRTEST = Test()
easyOCRTEST.extract_time_easyOCR()
easyOCRTEST.extract_time_Tessaract()
and the **output is
Inside easyOCR
resultfromEasyOCR cropped 2023/057716 06:40850
Inside Tessaract
resultfromTessaract 2623/05/16 66:46:58
Can someone please help me to detect correctly? Can I train own model to detect correctly in my requirement or please let me know if there is any other way to detect correctly?