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

Performs a direct secondary image conversion step, converting a color or grayscale image to a black-and-white (bi-tonal) one.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_REC_image_reduce_to_bitonal(
   HIG_REC_IMAGE hImageIn,
   enumIGRecImgConversion Conversion,
   AT_INT Brightness,
   AT_INT Threshold,
   enumIGRecImgResEnhancement resolenh,
   HIG_REC_IMAGE* phImageOut
);

Arguments:

Name Type Description
hImageIn HIG_REC_IMAGE Handle of the image to be converted (either grayscale or color).
Conversion enumIGRecImgConversion Image conversion mode to be applied during the conversion of the hImageIn image. Possible enumIGRecImgConversion values are IG_REC_IMG_CONVERSION_AUTO, IG_REC_IMG_CONVERSION_SET, IG_REC_IMG_CONVERSION_GLOBAL.
Brightness AT_INT Brightness of the image (range is 0 to 100, where 0 means the darkest and 100 means the lightest resulting image). This parameter has effect only if the Conversion parameter is set to IG_REC_IMG_CONVERSION_AUTO.
Threshold AT_INT Threshold value to be set. Its range should be between 0 and 255. This parameter has effect only if the Conversion parameter is set to IG_REC_IMG_CONVERSION_SET.
resolenh enumIGRecImgResEnhancement Resolution enhancement setting to be applied during the conversion (enumIGRecImgResEnhancement).
phImageOut HIG_REC_IMAGE* Handle of the bi-tonal image to be created.

Return Value:

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

Supported Raster Image Formats:

Indexed RGB - 8 bpp;
Grayscale - 8 bpp;
RGB - 24 bpp.

Example:

 
Copy Code
AT_ERRCOUNT ErrCount = 0;
HIGEAR higImage = 0;
HIG_REC_IMAGE higRecImage = 0;
HIG_REC_IMAGE higRecImageOut = 0;

ErrCount += IG_load_file("Image.tif", &higImage);
ErrCount += IG_REC_image_import(higImage, &higRecImage);
ErrCount += IG_REC_image_reduce_to_bitonal(higRecImage,
    IG_REC_IMG_CONVERSION_AUTO, 40, 100, IG_REC_IMG_RE_AUTO,
    &higRecImageOut);

//...

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

Remarks:

If the phImageOut image is no longer needed, it should be removed from the image management subsystem by invoking the IG_REC_image_delete function.

See Also

HIG_REC_IMAGE