1

I just found the solution to Detect and fix text skew and related article OpenCV - Rotation (Deskewing). But the solution is not work for some text rotated 90 degree.

I want to fix text rotated 90 degree like images below, Detect and fix text skew solution works for second image but first image is not work.

3
  • What is the rotation angle that you get when you run the code?? Commented Jun 27, 2017 at 5:10
  • @Mayank -89, I updated my question, the solution is not work for first image. Commented Jun 27, 2017 at 5:31
  • Possible duplicate of Detect text orientation Commented May 1, 2018 at 22:01

2 Answers 2

1

You can use the Python OCR (pytesseract) to read the text from image, once you extracted the string, then search for some specific keywords/Stopwords in the text. If they not exist rotate for 90 degree and run OCR again. If they exist stop rotation.

This can rotate 90,270,180 degree shifted images.

Note: This is only applicable for text images.

Sign up to request clarification or add additional context in comments.

Comments

0

this code rotates by multiples of 90 degrees angles

import pytesseract orientation = pytesseract.image_to_osd(tempname, output_type='dict')['orientation'] if orientation in [90, 180, 270]: image = image.rotate(int(orientation), expand=True) 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.