I'm facing an issue with OCR where I'm attempting to extract the text XWBJA69VERA072632 from a photo, but the result I'm getting is XXWBJAGIVERAD7 2632
Here is the my source code in Python.
import cv2
import pytesseract
img = cv2.imread('./contents/testvin.png')
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
average_blur = cv2.blur(gray, (5, 5))
gaussian_blur = cv2.GaussianBlur(gray, (5, 5), 0)
median_blur = cv2.medianBlur(gray, 3)
bilateral_filter = cv2.bilateralFilter(gray, 15, 50, 50)
adaptive_gaussian = cv2.adaptiveThreshold(bilateral_filter, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY, 11, 9)
config_tesseract = '--tessdata-dir trained_data'
pytesseract.pytesseract.tesseract_cmd = r'D:/Program Files/Tesseract-OCR/tesseract.exe'
text = pytesseract.image_to_string(adaptive_gaussian, lang='eng', config=config_tesseract)
print(text)
cv2.imshow('adaptive_gaussian', adaptive_gaussian)
cv2.waitKey(0)
cv2.destroyAllWindows()

