ImageGear for C and C++ on Windows v19.1 - Updated
IG_REC_image_invert
API Reference Guide > Recognition Component API Reference > Recognition Component Functions Reference > Recognition Image Preprocessing Functions > IG_REC_image_invert

Performs immediate image inversion of the image.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_REC_image_invert(
   HIG_REC_IMAGE hImageIn,
   LPAT_RECT lpRect
);

Arguments:

Name Type Description
hImageIn HIG_REC_IMAGE Handle of the image to be inverted.
lpRect AT_RECT Pointer to the rectangular area to be inverted. If it is NULL the entire image is inverted.

Return Value:

Returns the number of ImageGear errors that occurred during this function call.

Supported Raster Image Formats:

See IG_REC_image_import.

Remarks:

This function ignores the image inversion mode setting. The inverted image replaces the original one and is available to the recognition engine and the application.

  1. For B/W images, the most usual inversion is from white-on-black to black-on-white, because the latter is needed for successful recognition.
  2. For grayscale images, each pixel value is transformed to its complementary value, e.g., for a 4-bit image, a value of 11 is inverted to 4.
  3. For color images, each color component is inverted to its complementary value.

Example:

 
Copy Code
AT_ERRCOUNT ErrCount = 0;
HIG_REC_IMAGE higRecImage = 0;
HIGEAR higImage = 0;
AT_RECT Rect; 

ErrCount += IG_load_file("Image.tif", &higImage); 
ErrCount += IG_REC_image_import(higImage, &higRecImage);

//...

memset(&Rect, 0, sizeof(Rect));
Rect.right = 100;
Rect.bottom = 100;
ErrCount += IG_REC_image_invert(higRecImage, &Rect);
ErrCount += IG_REC_image_recognize(higRecImage);

//...

ErrCount += IG_REC_image_delete(higRecImage);
ErrCount += IG_image_delete(higImage);

See Also

HIG_REC_IMAGE