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:
hImageIn | Handle of the image to be inverted. |
lpRect | 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.
- 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.
- 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.
- 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); |