ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 CalcOrientation
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

jeffp

USA
42 Posts

Posted - Oct 01 2024 :  18:18:05  Show Profile  Reply
As the documentation states, CalcOrientation can only detect 0° or 90° orientation. The problem I have is that a document rotated 90% to the left AND 90% to the right both give me the same result, 90. I'm looking to do an Auto Rotate but I would need to know which one is 90% and which on is -90% to get it right. It would also be nice to know if the document was 180% too.

Is the a workaround or would you consider making this call a bit more powerful as described above?

jp

xequte

38609 Posts

Posted - Oct 01 2024 :  22:55:58  Show Profile  Reply
Hi Jeff

CalcOrientation uses an algorithm that is based on histogram density, without understanding the content of the document, so it can only detect 0° or 90° orientation. It cannot detect inverted text, and will give an inaccurate result for documents that are right-rotated.

For more accurate orientation detection use:

https://www.imageen.com/help/TIEVisionOCR.getOrientation.html


Note: Avoid using the helper method TIEBitmapHelper.OCR_GetOrientation which has an issue with skewed documents (or email us for the latest beta).

https://www.imageen.com/help/TIEBitmapHelper.OCR_GetOrientation.html


Nigel
Xequte Software
www.imageen.com
Go to Top of Page

jeffp

USA
42 Posts

Posted - Oct 02 2024 :  09:54:54  Show Profile  Reply

Nigel,

Before I buy the IEVision component can you make sure the Orientation call in IEVision gets these correct.

See attached zip file.

--Jeff

attach/jeffp/202410295315_Orientations.zip
74.22 KB

jp
Go to Top of Page

jeffp

USA
42 Posts

Posted - Oct 02 2024 :  12:01:32  Show Profile  Reply
Note: Avoid using the helper method TIEBitmapHelper.OCR_GetOrientation which has an issue with skewed documents (or email us for the latest beta).


I'd love to get on the beta here when I try IEVision. I do a ton with scanned documents so I deal a lot with OCR and Orientation, etc.

I'll have some good test docs for this.

jp
Go to Top of Page

xequte

38609 Posts

Posted - Oct 02 2024 :  17:21:30  Show Profile  Reply
Hi Jeff

The results are as follows:

Orientation90A.bmp: Fail
Orientation90B.bmp: OK
Orientation180A.bmp: Fail
Orientation180B.bmp: OK
Orientation270A.bmp: Fail
Orientation270B.bmp: OK

It looks like all the "A" images have too little text for it to calculate the orientation.


Nigel
Xequte Software
www.imageen.com
Go to Top of Page

jeffp

USA
42 Posts

Posted - Oct 02 2024 :  17:41:28  Show Profile  Reply
Interesting.

When will the Helper functions like TIEBitmapHelper.OCR_GetOrientation be working again?



jp
Go to Top of Page

jeffp

USA
42 Posts

Posted - Oct 02 2024 :  17:49:28  Show Profile  Reply
Also, as to my orientation issue, is there a way to calculate the orientation even on the files with little text by doing an OCR process and analyzing the coordinates of the Word or Line boxes?

jp
Go to Top of Page

jeffp

USA
42 Posts

Posted - Oct 02 2024 :  18:56:06  Show Profile  Reply
With all the document processing we do on new and existing images, we turn them into searchable PDFs by running an OCR process. In our current process, we always analyze the page orientation first, then rotate it straight up before running it through any of our OCR engines (we find the OCR is much better if the page is straight up going into the engine). So for for us, it's critical to have a reliable call to get an image's correct orientation. Again, 99% of what we do are text based images. I'm happy to work with you on this one if we can figure out a better way to get orientation. Happy to pay for some dev hours as well if needed.

jp
Go to Top of Page

xequte

38609 Posts

Posted - Oct 02 2024 :  20:21:58  Show Profile  Reply
Hi Jeff

You could certainly use methods to confirm that the result is as expected, such as checking the text boxes.

As you can see with your 90A image, OCR has failed because of the low quality of the text, but it still correctly gets the text box position:




The OCR_GetOrientation() fix is available in the current beta if you want to email me for it, alternatively just avoid using the helper (as the IEVision code itself is not affected).

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

jeffp

USA
42 Posts

Posted - Oct 03 2024 :  09:00:27  Show Profile  Reply
Just ordered IEVision, so I'd love for you to email me the beta so I can use the helper.

jp
Go to Top of Page

xequte

38609 Posts

Posted - Oct 03 2024 :  21:20:22  Show Profile  Reply
Hi Jeff

Just emailed it.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

jeffp

USA
42 Posts

Posted - Oct 03 2024 :  23:20:14  Show Profile  Reply
Got it. Thanks.

Also, what version on the Tesseract OCR engine is IEVision using?

jp
Go to Top of Page

jeffp

USA
42 Posts

Posted - Oct 04 2024 :  11:07:29  Show Profile  Reply
Ok. Now that I have IEVision I'm try to use the Helper function for IEBitmap. I'm trying this example out of the help.

deskewAngle := ImageEnView1.IEBitmap.OCR_GetOrientation();
if deskewAngle <> 0 then
ImageEnView1.Proc.Rotate( -deskewAngle, ierFast, clWhite );

However, I'm getting a error in the OCR_GetOrientation call.

Do I need to configure the OCR engine and set language files somewhere before I make this call?

Thanks.

jp
Go to Top of Page

jeffp

USA
42 Posts

Posted - Oct 04 2024 :  11:59:45  Show Profile  Reply
Is there a way to get progress information from the OCR process?
Go to Top of Page

xequte

38609 Posts

Posted - Oct 04 2024 :  19:30:35  Show Profile  Reply
Hi Jeff

We're looking at the documents provided above to see if we can get orientation information even for the sparse text ones. At this time there is no way to get progress information.

What is the error that you are getting with OCR_GetOrientation()?

Do you have ievision.dll, eng.TrainedData and osd.TrainedData in your current Windows folder?

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

jeffp

USA
42 Posts

Posted - Oct 04 2024 :  21:52:18  Show Profile  Reply
I have my TrainedData files in a subfolder off the main exe path. Is that a problem. It works with TIEVisionOCR since I can set the path there.

jp
Go to Top of Page

xequte

38609 Posts

Posted - Oct 05 2024 :  16:51:57  Show Profile  Reply
Hi

Are you passing this language path to: TIEBitmapHelper.OCR_GetOrientation()?

https://www.imageen.com/help/TIEBitmapHelper.OCR_GetOrientation.html

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

xequte

38609 Posts

Posted - Oct 07 2024 :  17:44:01  Show Profile  Reply
Hi Jeff

We've sent you an update that should work better at detecting the orientation in these sparse text images, however it may still fail if the text is too unclear to be read well.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

jeffp

USA
42 Posts

Posted - Oct 07 2024 :  17:54:29  Show Profile  Reply
Got it. Thanks.

jp
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: