Image Preprocessing Sample - FlexiCapture Engine

FlexiCapture Engine
10, 11
Knowledge Base & Support
Code Samples Collection
image: icon_imagepreprocessing.gif

This sample includes a set of image preprocessing tools and allows you to watch how this or that tool influences recognition quality. You can use general preprocessing tools (like page orientation and skew correction), filter colors, use special preprocessing tools for photos, and enhance appearance of the images.


The sample processes specified image twice: once it process original image, and then corrected image. Then it compares recognized documents and shows the result of comparison together with the original and corrected image.

To view how it works:

  1. Select the image to process.
  2. Select the tools, which should be used for image preprocessing. You can restore default settings by clicking Restore defaults.
  3. If you want the image to be recognized, select the Document Definition, which should be used for recognition.

To run the sample, click Go.

The sample uses the following procedure of recognition:


  • Create the Engine object using the InitializeEngine function.
  • Create the ImageProcessingTools object using the CreateImageProcessingTools method of the Engine object.
  • Open an image file using the OpenImageFile method of the ImageProcessigTools object and access its page using the OpenImagePage method of the returned ImageFile object.
  • Preprocess the image using methods of the ImageProcessingTools object.
    Use the tools for digital photos:
    • Remove ISO noise
    • Remove motion blur
    • Correct 3D perspective distortions
    • Apply frequency domain transform

Color filtering tools for official documents:

  • Suppress color
  • Filter color
  • Use the FilterColor method.
  • Suppress security paper guilloche background

Common tools for image normalization:

  • Equalize brightness
  • Smooth image
    Smoothes the image by averaging either over the square neighborhood (SmoothImageBySquareAverage method) or by Gaussian kernel (SmoothImageByGaussianKernel method).
  • Invert image (region

Tools for preparing for recognition:

  • Conversion to black-and-white
  • Remove excess black dots
  • Change resolution
    Use the XResolutionToOverwrite and YResolutionToOverwrite properties of the ImageLoadingParams object.
  • Correct image skew


  • Create an instance of FlexiCapture processor using the CreateFlexiCaptureProcessor method of the Engine object.
  • Add required Document Definitions with the help of the AddDocumentDefinitionFile method of the FlexiCaptureProcessor object.
  • Add the preprocessed image to the processing queue using the AddImage method of the FlexiCaptureProcessor object.

Run the processing loop:

  • Recognize next document using the RecognizeNextDocument method of the FlexiCaptureProcessor object.
  • Check if an error occurs when accessing an image. Use the GetLastProcessingError method of the FlexiCaptureProcessor object.

Unload FlexiCapture Engine — use the DeinitializeEngine function.

Back To:

This website uses cookies which enable you to see pages or use other functions of our websites. You can turn off such cookies in your browser’s settings. If you continue to use these pages, you consent to the use of cookies.