Forum Discussion

TCUser's avatar
TCUser
New Contributor
16 years ago

Crop image for better OCR performance

Hello,

i want to read an image using OCR. Everything works fine, but the OCR method need 13-14 seconds to read the image.

I need only a little part of the image. Is it possible to crop the image to a smaller size? I create the image with the Regions.AddPicture() method.I read the image with the OCR.CreateObject("Object").GetText method.



Thanks for your help

Greetings TCUser
  • TCUser's avatar
    TCUser
    New Contributor
    Hello,

    i used the OnScreenObject.Picture for it.

    Greets
  • Hello TCUser,



    All you would need to do is clearly define the small portion of the image you need. That you can do by defining the coordinates of the rectangle of that small portion.

     

    If you can get that from the properties of other child objects that'll be great, else you could just hard code the coordinates by analyzing your picture a bit.





    XL = QObj.Left

    YT = QObj.Top

    XR = QObj.Width  

    YB = QObj.Height 

    Set Rect = Aliases.My_Process.My_Form.My_Frame.Picture(XL, YT, XR, YB, False) 


    Set OCRObj = OCR.CreateObject(Rect)



    Set OCROptions = OCRObj.CreateOptions

    TextToBeRecognised = OCRObj.GetText(OCROptions)




    If you are not able to get the coordinates as XL = QObj.Left, you could hard code it as XL = 202 if that is always the rectangle you want to perform your OCR on;




    Hope that makes sense




    Thankyou

    Syed