Tesseract provides a parameter to set the page segmentation mode (-- psm)
.
Below are all the modes, as shown in the documentation:
Page segmentation modes:
0 Orientation and script detection (OSD) only.
1 Automatic page segmentation with OSD.
2 Automatic page segmentation, but no OSD, or OCR.
3 Fully automatic page segmentation, but no OSD. (Default)
4 Assume a single column of text of variable sizes.
5 Assume a single uniform block of vertically aligned text.
6 Assume a single uniform block of text.
7 Treat the image as a single text line.
8 Treat the image as a single word.
9 Treat the image as a single word in a circle.
10 Treat the image as a single character.
11 Sparse text. Find as much text as possible in no particular order.
12 Sparse text with OSD.
13 Raw line. Treat the image as a single text line,
bypassing hacks that are Tesseract-specific.
Does -- psm 1
have the same effect as deskewing the image and then using e.g. -- psm 3
?
Based on my experience, PSM 1 and PSM 3 deskew the text by 90, 180, 270 degrees even though it's written that PSM 1 only does so. However, you may notice in some conditions that PSM 1 may miss some text during the segmentation. This may happen if the text is not aligned in lines and when font sizes vary. But in general, don't expect from Tesseract that it detects the orientation of text that is not in 0, 90, 180, or 270 degrees. Also, you'll need a characters count that is usually >= 50 chars. :)