Adding Support for New OCR Engine in Studio

  1. Create a new C# project
  2. Add references to SE.Core.Automation.Interfaces and EV.AE.OCR DLLs available with the build.
    The locations where dlls need to be replaced:
  • AutomationStudio\bin\SE.Core.Automation.Interfaces.dll
  • AutomationStudio\bin\Plugins\OCR\EV.AE.OCR.dll
  1. Add a new class to the project and inherit from the abstract class TextExtractor present in the namespace EV.AE.OCR.
  2. Add the required configuration parameters as public properties so that they are editable in the property grid as displayed in the Tesseract engine image below.

Following methods are available in this class to override:

  • protected virtual Bitmap CaptureOCRArea(ControlImage controlImage)
    This method takes a screenshot of the desktop and calculates the area on which OCR is performed and returns the cropped area as a Bitmap. Override it to provide a custom implementation.
  • protected virtual Bitmap ApplyPreprocessingFilters(Bitmap rawInput,List<IImageFilter> filtersToApply)
    Any preprocessing filters configured during design time in Studio are applied on the Bitmap received from a call to Captu- reOCRArea by this method.
  • public abstract string ExtractText<T> (T imageData, out float confidence);
    This method is abstract and is overridden by the class.
    T is of type ControlImage. Perform the following steps inside this method.
    • Make a call to CaptureOCRArea passing imageData as a parameter to get the target bitmap.
    • Verify the AppliedFilters collection on imageData. If the collection is not empty, make a call to ApplyPreprocessingFilters passing bitmap and appliedfilters to receive the processed bitmap.
    • Make a call to override ExtractText with signature ExtractText(Bitmap bitmap, out float confidence) to get the extracted text and return the result. (See method d)
  • public override string ExtractText(Bitmap bitMap, out float confidence);
    This method is abstract and must be overridden by the class. The method receives a bitmap and returns the extracted text. In this method, use the API of the OCR engine for which support needs to be added and perform the OCR on the received bitmap. This method is also directly called by the “Configure Filters” screen from Studio to capture samples, apply filters and perform a OCR at design time to get a confidence of how well the text is extracted with the applied filters. If the OCR engine / API being used does not give a confidence value for the extracted text, assign 0 to the confidence variable.
  • public override string ToString()
    The value returned from this method is the display name used to show the available engines in the dropdown of the configure engine screen.
  1. Build the Project and place the compiled DLL in Plugins/OCR folder in Studio to make this engine available in Studio. To make this customization available in EPA/Robot, place the DLL in Plugins/OCR folder in EPA/Robot.