• Some users have recently had their accounts hijacked. It seems that the now defunct EVGA forums might have compromised your password there and seems many are using the same PW here. We would suggest you UPDATE YOUR PASSWORD and TURN ON 2FA for your account here to further secure it. None of the compromised accounts had 2FA turned on.
    Once you have enabled 2FA, your account will be updated soon to show a badge, letting other members know that you use 2FA to protect your account. This should be beneficial for everyone that uses FSFT.

OCR numerical data from an image and insert into MySQL?

AngryJim

Limp Gawd
Joined
Apr 20, 2006
Messages
234
I mostly just do PHP, MySQL, and jQuery so anything beyond that isn't really in my scope of knowledge. I have a program called LICCON that produces data for crane lifts. Here's a screenshot. Basically what I'd like to do is feed these images into some kind of OCR program that could grab the data and insert it into a database, or at least give me some output that could easily be inserted. Typing the data in by hand is far too tedious, especially on projects where there could be hundreds (or even thousands) of these images.

The numbers are always in the same location and never jump around on the screen, so I'm hoping that makes this a feasible project.
 
It seems like it would be a lot easier to read them out of memory than try to scrape them off the screen, if it is a local program?
 
It is a local program, though that's something I'm not familiar with.

I know the way it works is that all the data for each crane is stored in a .bin file. It'd be fantastic if I could get the data out of that file, but every attempt I've ever made at opening it results in useless gibberish.
 
It is a local program, though that's something I'm not familiar with.

I know the way it works is that all the data for each crane is stored in a .bin file. It'd be fantastic if I could get the data out of that file, but every attempt I've ever made at opening it results in useless gibberish.

Try to save a bin file and back it up, then chance one value and save again. Then diff the two files using a hex editor and see if you can narrow down the location of that value. Rinse and repeat for the rest of the values.

You'd need to know if the values are stored in one, two, four, etc bytes, and if they are Big or Little Endian or not.
 
There really isn't any saving or editing of the bin files as far as I know. To add a crane to the program, you just toss the bin file in a specific folder and it shows up.

I added the folder to my Dropbox for the sake of making it easy to add across multiple computers, and Dropbox never does any updating when I am working in LICCON.
 
I'd still say reading the values out of memory would be the easiest. I haven't used any OCR libraries though, so that could be easy as well, but I am unsure.
 
You could use a free debugger like Cheatengine. It has a fairly simple method of searching for values that is able to continuously narrow the result set.

For example say the program is displaying 80.0 as a value on screen. Attach cheatengine to the process of your program. Begin a new exact value search in cheatengine and search for type of float, value = 80.0. It returns a list of offsets for everywhere it could find that exact value. Next say you make a minimal change in your program, and the value becomes 79.4. Now back in cheatengine you continue your search and seach by value changed, and enter 79.4. It will now narrow the previous result set, to only the locations where the value is now 79.4. Rinse and repeat until you have the offset you want.


Once you get a list of the offsets that you care about, you would write a program that reads those directly from memory and writes that data to the database.
 
Tried Cheatengine, went through the tutorial and understood it completely, but it doesn't seem to do the job. In your example, I have no problem finding the result for 80.0, but once I change it in the program to a new value, it can't find that new value in the subset. It almost seems like the offsets change?

To be specific, I can find 80.0, which shows up in a ton of locations. I can make a change in the program and do a completely new separate search for 79.4, and none of the offsets will be the same.
 
Last edited:
It very well could be the offsets are changing, so you may need to find a pointer.
 
Gotcha. I'm not at my normal computer so I can't run Cheatengine at the moment. Is it capable of finding pointers or do I need to look elsewhere?

EDIT: Nevermind, found some tutorials. I'm sure I'll be back later for more though.
 
Last edited:
Contact the program vendor and ask if the values are exposed in any way.
Is this a network enabled program?
If the program can load values out of the bin, see if you can just read them directly out of the bin.
 
Back
Top