Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Orientation and WritingDirection

See original GitHub issue

Thanks for all you do. I have successfully created a batch OCR application using your wrapper. However, I occasionally run into an image where the text does not read from left-to-right. I have tried scouring the web to find the best method for determining page/text orientation. These methods are not demonstrated in the sample applications.

Here is my current page level code…

                using (TesseractEngine engine = new TesseractEngine(System.Environment.GetEnvironmentVariable("TESSERACT_PREFIX"), "eng", EngineMode.Default))
                    Pix img = Pix.LoadFromFile(MyImgFilePath);
                    Page page = engine.Process(img);
                    //GetPageOrientation here
                    string text = page.GetText();
                    text = text.Replace("\n", "\r\n");
                    return text;

How would I “AutoRotate” to get the correct text? I have attached an image for testing. 00000001

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:31 (13 by maintainers)

github_iconTop GitHub Comments

charleswcommented, Dec 28, 2013

After a little light reading it looks like tesseract the default page segmentation option doesn’t support Orientation detection by default you’ll need to change it to PageSegMode.AutoOsd and include the Osd language files. However the ones for 3.02 don’t seem to be on google code at the moment however the ones provided for ubuntu should work as these are only data files (

Let me know if it works.

montaghem2commented, May 29, 2023

Hi I give this Exception Error when I use var properties = iter.GetProperties();

Exception thrown: ‘System.AccessViolationException’ in InteropRuntimeImplementer.TessApiSignaturesInstance An unhandled exception of type ‘System.AccessViolationException’ occurred in InteropRuntimeImplementer.TessApiSignaturesInstance Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

Please help me

Read more comments on GitHub >

github_iconTop Results From Across the Web

Values that describe the writing direction inside a text selection. ... Returns the layout orientation at the location you specify.
Read more >
text-orientation - CSS: Cascading Style Sheets - MDN Web Docs
The text-orientation CSS property sets the orientation of the text characters in a line. It only affects text in vertical mode (when ...
Read more >
Writing Direction Affects How People Map Space Onto Time
What determines which spatial axis people use to represent time? We investigate effects of writing direction. English, like Mandarin Chinese ...
Read more >
Orientation.WritingDirection Field
Writing direction. Namespace: Emgu.CV.OCR Assembly: Emgu.CV.Platform.NetStandard (in Emgu.CV.Platform.NetStandard.dll) Version:
Read more >
Writing Direction Influences Spatial Cognition
The world's languages make use of different writing system orientations, running from left to right, from right to left, or from top to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found