Python OCR Text image auto detect angle skew/rotate

Viewed 649

I have been trying to get the text from a text based captcha image and have been able to edit the image to the point where it is readable by pytesseract, but the last part of rotating the skewed text automatically i have not been able to achieve.

If i manually rotate the image to the point where the text is aligned it will be readable by pytesseract.

here is the image before and after being edited

Before

After

if i manually add

im2 = im.rotate(-8, fillcolor = 'white')

the output would work and be detected, but how can i achieve this automatically? enter image description here

0 Answers
Related