I am trying to read a character with pyTesseract but the orientation is not right so I put the image a loop every step the image is rotating 5 angles and Tesseract gives an estimated character. The problem is which character is the true one. How can I learn this? Can I use Tesseract confidence rate?
img_before = cv2.imread('test.jpg')
cv2.imshow("Before", img_before)
key = cv2.waitKey(0)
angles = []
median_angle = np.median(angles)
for i in range(0,360,5):
img_rotated = ndimage.rotate(img_before, i)
cv2.imshow('rato' , img_rotated)
msg = p.image_to_string(img_rotated,config='--psm 10')
if(len(msg) <= 1):
print(msg)
cv2.waitKey(0)