Jump to content
Mark Williams

Floating point problems with external dlls

Recommended Posts

I'm trying to use the TesseractOCR4 wrapper from GitHub.

 

I have cloned the project and downloaded it. I get all the example projects to work as expected.

 

However, I run into floating point operation errors with the dlls when I try and use it in my own application.

 

I have all the necessary units included in my uses. I have copied all the necessary dlls to my application folder and also the test data.

 

My app runs and loads the library fine and I can call the recognize function to extract the text. However, it extracts as a single word (ie with no gaps between words). I assume this is the default setting (although I can't imagine why).

 

There is a PageSegMode property which can be used to change the way Tesseract recognizes the text. I can change this fine within the example apps, but whenever I try and set it in my own app to one of the pre-defined constants it causes a floating point violation within one of the dlls.

 

I assume there must be some project option which is set/unset in my app which is causing this issue. Can anyone please point me in the right direction?

 

 

Share this post


Link to post

That works in the sense that it masks the exception, but the operation basically stops early.

 

The example applications do not use masking of this error and yet they work for me. I assume it has to be a different configuration of the project option, but I could not find any differences that appeared significant in this context although I update my project optiosn to align just in case and no joy.

 

 

Share this post


Link to post
6 minutes ago, Mark Williams said:

I assume it has to be a different configuration of the project option

Doesn't sound likely to me at all. 

 

Do you understand why I suggest to mask floating point exceptions when calling into other code? 

Edited by David Heffernan

Share this post


Link to post

No you are right. I have created a new project and copied the main form from the example project to my new project and then pointed my project at the copied form. It works fine.

 

However, if I create a new project and replicate the form from the example folder, it keeps spitting out the floating point error. I have stripped back the example form so it consists of nothing more that a button and a TOpenDialog. I have pared back its code to about 20 lines and it still works okay.

 

But when I try to recreate (rather than copy) the example form in a new project it bums out again. Even if I copy and paste the entire .pas unit for the example form into my new .pas and even if I right click and view as text and then paste from the example to the new form.

 

So it seems to be something about the way the form is configured, but as to what that is I have no idea.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×