Forum Discussion

poojat's avatar
poojat
New Contributor
15 years ago

OCR(optical character recognition)

Hi,

    I am using OCR(optical character recognition) for capturing text on screen.But some time it captures wrong text for e.g for A it captures ^ and for 1---->] etc.

I have sample script that i have tried....please suggest me some solution asap.......





OCRObj = OCR["CreateObject"](region);

  

   OCROptions = OCRObj["CreateOptions"]();


    Info = "Grayscale binarization: " + OCROptions["GrayScaleBinarization"] + "\r\n" +

         "Binarization threshold: " + OCROptions["BinarizationThreshold"] + "\r\n" +

         "Recognition autorejection: " + OCROptions["RecognitionRejectionAuto"] + "\r\n" +

         "Recognition rejection threshold: " + OCROptions["RecognitionRejection"] + "\r\n" +

         "Skip fragmentation: " + OCROptions["SkipFragmentation"];

  Log["Message"](Info);



  OCROptions["GrayScaleBinarization"]=true;

  OCROptions["BinarizationThreshold"]=110;

  OCROptions["RecognitionRejectionAuto"]=false;

  OCROptions["RecognitionRejection"]=0.30;

  OCROptions["SkipFragmentation"]=false;

  



  Font = OCROptions["Fonts"]["Add"]();

  Font["Name"] = "Verdana"; // Specify the font name

    Font["Sizes"]["Add"](8); // Add the 8 pt size

 

  

  Log["Message"]( OCR["CreateObject"](region)["GetText"](OCROptions));

  



  delay(5000);

   

  if(!OCRObj["FindRectByText"](text,OCROptions))

  {

       Log["Message"]("Text not found on current screen.");

     }

  else

  {

    var x_cord=OCRObj["FoundX"];

    var y_cord=OCRObj["FoundY"];                                                       

     Log["Message"]("X-Y coordinates for click are:"+x_cord+" and "+y_cord);

    region["Click"](x_cord, y_cord);

    }





where region is rectangular portion where we have to search for text and text is text to be search in specified portion

1 Reply