OCRTesseractGetOrientation always returns 0

Discussions about machine vision support in GdPicture.
Post Reply
Kalgari
Posts: 3
Joined: Wed Jul 31, 2013 9:23 pm

OCRTesseractGetOrientation always returns 0

Post by Kalgari » Wed Jul 31, 2013 9:35 pm

Hello all,
I'm using GdPicture 9.0.0.12. In the example below I pass in a filePath to a TIFF file. The TIFF contains two lines of text upside down.
The value that comes out of oGdPictureImaging.OCRTesseractGetOrientation is always 0. Why is that?

At each stage GetStat() returns GdPictureStatus.OK.

Code: Select all

            var licManager = new LicenseManager();
            licManager.RegisterKEY(licenseKey);
            licManager.RegisterKEY(pdfLicenseKey);
            licManager.RegisterKEY(ocrLicenseKey);

            using (var oGdPictureImaging = new GdPictureImaging())
            {
                int imageId = oGdPictureImaging.CreateGdPictureImageFromFile(filePath);

                if (oGdPictureImaging.GetStat() != GdPictureStatus.OK)
                    throw new ApplicationException("Handle this 1.");

                var result = oGdPictureImaging.AutoDeskew(imageId);
                if (result != GdPictureStatus.OK)
                    throw new ApplicationException("Handle this 2.");

                oGdPictureImaging.OCRTesseractReinit();
                oGdPictureImaging.OCRTesseractClear();
                oGdPictureImaging.OCRTesseractSetPassCount(2);

                int rotation = oGdPictureImaging.OCRTesseractGetOrientation(imageId, dictionary,
                                                                                     dictionariesFolder.FullName);

                 if (oGdPictureImaging.GetStat() != GdPictureStatus.OK)
                        throw new ApplicationException("Handle this 3.");

                 ...


SamiKharma
Posts: 352
Joined: Tue Sep 27, 2011 11:47 am

Re: OCRTesseractGetOrientation always returns 0

Post by SamiKharma » Thu Aug 01, 2013 1:40 pm

Hi,

If the function OCRTesseractGetOrientation() unfortunately there is returning a wrong there is nothing we can do about it since it is developed by Google.
V10 will include a the newest version of Tesseract (3.02) and it might include a better result.

Best,
Sami

Kalgari
Posts: 3
Joined: Wed Jul 31, 2013 9:23 pm

Re: OCRTesseractGetOrientation always returns 0

Post by Kalgari » Thu Aug 01, 2013 3:10 pm

Has anyone ever used OCRTesseractGetOrientation detect page orientation successfully?
I've tried 9.0.0.12 and 9.4 - neither of which are detecting that a page is upside down.

znelson32
Posts: 1
Joined: Thu Aug 01, 2013 3:30 pm

Re: OCRTesseractGetOrientation always returns 0

Post by znelson32 » Thu Aug 01, 2013 4:03 pm

We have the same problem. Is there any other method call we can make to determine page/text orientation? GDPicture touts orientation detection as a major selling feature, so it doesn't sit well to hear "it's not our problem, there's nothing we can do".

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: OCRTesseractGetOrientation always returns 0

Post by Loïc » Thu Aug 01, 2013 6:53 pm

Hello,

To get further investigation such cases from our team we need that you share document + code snippet that reproduces the issue.

You can send such materials, if private, through our helpdesk located here: https://www.gdpicture.com/support/getting-support-from-our-team

With best regards,

Loïc

Kalgari
Posts: 3
Joined: Wed Jul 31, 2013 9:23 pm

Re: OCRTesseractGetOrientation always returns 0

Post by Kalgari » Thu Aug 01, 2013 7:41 pm

Hello Loïc,
Cédric from your team provided a working solution for my code snippet above.

The code works correctly only when the accuracy overload is used.

For example:

Code: Select all

int rotation = oGdPictureImaging.OCRTesseractGetOrientation(imageId, "eng", "C:\\Program Files (x86)\\GdPicture.NET 9\\Redist\\OCR", 10);
That extra "10" integer magically made it all work.

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: OCRTesseractGetOrientation always returns 0

Post by Loïc » Thu Aug 01, 2013 8:07 pm

Thank you for the quick return.

For other users experiencing similar non resolved issue feel free to contact our team to get further advice. We should be able to provide a solution by providing code or by improving our SDK.

so it doesn't sit well to hear "it's not our problem, there's nothing we can do".

znelson32, this is definitively not our philosophy. Just brows this forum or contact our support team to get an idea of how much we are involved in any problem resolutions. And by the way an introduction with "hello" is always appreciated ;)

With best regards,

Loïc

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests