Jump to content

OCR from a small area


Recommended Posts

9 minutes ago, ioa747 said:

it is not mine, it belongs to the UWPOCR function
, simply because it passes directly to the function I have added the relevant parameters.
I don't remember I have to look it up

 

Don't worry about it, I was trying to speed up my script to by doing it in memory instead of using  your _ScreenCapture function and relying on the filesystem, but with other optimisations I've managed to make it fast enough for my purposes.

Edited by Hashim
Link to comment
Share on other sites

Hi ioa747, I've run into a problem using the script (both V3 and V4) inside of my For loop over my whole dataset of a million numbers. Everything works fine (bitmap recognition is perfect) until it gets to exactly 9964 (possibly 9965 depending on my maths) in the loop, at which point it crashes with a fatal error (like a MsgBox with no data). This happens no matter what input number I start the loop, so the problem seems to be the 9964th iteration of the loop rather than the number itself. From my debugging it feels like this is something to do with GDIPlus and/or memory consumption, either in the script or in the custom _ScreenCapture function I am using to take the screenshot. Do you have any quick ideas about what might be causing this and how to solve it? If not I can post all of my code tomorrow.

Edited by Hashim
Link to comment
Share on other sites

I don't know what to say.
after each call to the custom _ScreenCapture function 
you release the GDIPlus  memory  with

_WinAPI_DeleteObject($hHBitmap)
_GDIPlus_BitmapDispose($hImage)
_GDIPlus_BitmapDispose($hBitmap)
_GDIPlus_GraphicsDispose($hImageCtxt)
_GDIPlus_Shutdown()

like I do in the function _ScreenCapture

 

one more thing
in the numbers you passed us each time there are three numbers in a row
follows that the total will be 999 numbers

there are more in each row?
why need dataset of a million numbers?

Edited by ioa747
add _GDIPlus_GraphicsDispose

I know that I know nothing

Link to comment
Share on other sites

You can monitor GDI handle usage in Task Manager:

    Open Task Manager, go to the "Details" tab, right-click on a column header, and select "Select columns."
    Enable "GDI object" to monitor the GDI object count for your script.

I know that I know nothing

Link to comment
Share on other sites

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
 Share

×
×
  • Create New...