i work on a car plate recognition project i did some preprocessing before passing cropped image to tesseract but there still lot of unwanted noise and lines that affect the plate number recognition for example i have this original image
after aplying this code
#----------------------------OCR---------------------------------------------------------------
#cropping detected objects and passing into tesseract OCR
A = []
for i in indices:
i = i[0]
box = boxes[i]
x = box[0]
y = box[1]
w = box[2]
h = box[3]
crop_img = image[y:y+h, x:x+w]
cv2.imwrite("Crop/crop__" + str(i) + ".jpg",crop_img)
#Resize the image
img = cv2.resize(crop_img, None, fx=5, fy=5, interpolation=cv2.INTER_CUBIC)
#Convert image to grayscale
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
#Convert image to black and white
roi = cv2.adaptiveThreshold(gray, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY, 69, 1)
#saving the roi regions
cv2.imwrite("Crop/roi__" + str(i) + ".jpg",roi)
roi = cv2.threshold(roi,0,255,cv2.THRESH_BINARY_INV + cv2.THRESH_OTSU)[1]
#bluring
roi = cv2.GaussianBlur(roi, (7, 7), 8)
#passing to tesseract
c = py.image_to_string(roi, config = ' --psm 13 ')
#c = py.image_to_string(roi)
for x in c:
if x.isdigit():
A.append(x)
cv2_imshow(roi)
i get this result which is affecting badly tesseract (output is 13 0 cs3405)} )
Any suggestions to get the cropped image to a perfect state suitable for the plate recognition ?