iDRS™ SDK 16
Loading...
Searching...
No Matches
CBinarize_interface.h File Reference

Interface for CBinarize wrapper. More...

Go to the source code of this file.

Functions

CBinarize CBinarize_Create (const CIDRS argIDRS, idrs_exception *pargException)
 Creates a new CBinarize object.
 
CImage CBinarize_Binarize (CBinarize argCBinarize, const CImage argImage, idrs_exception *pargException)
 
CImage CBinarize_Binarize2 (const CIDRS argIDRS, const CImage argImage, idrs_exception *pargException)
 
void CBinarize_SetBinarizationType (CBinarize argCBinarize, enum BinarizationType const evBinarizationType, idrs_exception *pargException)
 Set the type of binarization to use.
 
enum BinarizationType CBinarize_GetBinarizationType (const CBinarize argCBinarize, idrs_exception *pargException)
 Get the type of binarization to use.
 
void CBinarize_SetSmoothingLevel (CBinarize argCBinarize, IDRS_INT const iSmoothingLevel, idrs_exception *pargException)
 Sets the strength of the smoothing operation applied during binarization.
 
IDRS_INT CBinarize_GetSmoothingLevel (const CBinarize argCBinarize, idrs_exception *pargException)
 Gets the strength of the smoothing operation applied during binarization.
 
void CBinarize_SetGlobalThreshold (CBinarize argCBinarize, IDRS_INT const iGlobalThreshold, idrs_exception *pargException)
 Sets the global threshold to be use during binarization.
 
IDRS_INT CBinarize_GetGlobalThreshold (const CBinarize argCBinarize, idrs_exception *pargException)
 Gets the global threshold to be use during binarization.
 
void CBinarize_SetBrightness (CBinarize argCBinarize, IDRS_INT const iBrightness, idrs_exception *pargException)
 Sets the brightness adjustment to apply during binarization.
 
IDRS_INT CBinarize_GetBrightness (const CBinarize argCBinarize, idrs_exception *pargException)
 Gets the brightness adjustment to apply during binarization.
 
void CBinarize_SetContrast (CBinarize argCBinarize, IDRS_INT const iContrast, idrs_exception *pargException)
 Sets the contrast adjustment to apply during binarization.
 
IDRS_INT CBinarize_GetContrast (const CBinarize argCBinarize, idrs_exception *pargException)
 Gets the contrast adjustment to apply during binarization.
 
void CBinarize_SetUndithering (CBinarize argCBinarize, IDRS_BOOL const bUndithering, idrs_exception *pargException)
 Sets the automatic undithering when binarizing a page.
 
IDRS_BOOL CBinarize_GetUndithering (const CBinarize argCBinarize, idrs_exception *pargException)
 Gets a flag indicating if the automatic undithering correction will be applied before OCR.
 
void CBinarize_SetBinarizeCallback (CBinarize argCBinarize, IBinarizeCallback pBinarizeCallback, idrs_exception *pargException)
 Sets the callback object used to indicate which color to drop out.
 
IBinarizeCallback CBinarize_GetBinarizeCallback (const CBinarize argCBinarize, idrs_exception *pargException)
 Gets the callback object used to indicate which color to drop out.
 
void CBinarize_Destroy (CBinarize argCBinarize, idrs_exception *pargException)
 Destroys a CBinarize handle.
 

Detailed Description

Interface for CBinarize wrapper.

Function Documentation

◆ CBinarize_Binarize()

CImage CBinarize_Binarize ( CBinarize  argCBinarize,
const CImage  argImage,
idrs_exception *  pargException 
)

Binarize the provided color/greyscale image.

Parameters
argCBinarizeCBinarize handle
argImageThe image to binarize
pargExceptionPointer to exception structure that will be filled if an exception occurs
Returns
The binarized image

◆ CBinarize_Binarize2()

CImage CBinarize_Binarize2 ( const CIDRS  argIDRS,
const CImage  argImage,
idrs_exception *  pargException 
)

Binarize the provided color/greyscale using default parameters:

  • Adaptive binarization
  • Smoothing level 248
  • Undithering desactivated
Parameters
argIDRSThe iDRS
argImageThe image to binarize
pargExceptionPointer to exception structure that will be filled if an exception occurs

◆ CBinarize_Create()

CBinarize CBinarize_Create ( const CIDRS  argIDRS,
idrs_exception *  pargException 
)

Creates a new CBinarize object.

Parameters
argIDRSThe iDRS
pargExceptionPointer to exception structure that will be filled if an exception occurs
Returns
The newly created CBinarize object.
Remarks
Instances created by this method can also be provided to CImageOperation methods

◆ CBinarize_Destroy()

void CBinarize_Destroy ( CBinarize  argCBinarize,
idrs_exception *  pargException 
)

Destroys a CBinarize handle.

Parameters
argCBinarizeCBinarize handle to destroy
pargExceptionPointer to exception structure that will be filled if an exception occurs

◆ CBinarize_GetBinarizationType()

enum BinarizationType CBinarize_GetBinarizationType ( const CBinarize  argCBinarize,
idrs_exception *  pargException 
)

Get the type of binarization to use.

Remarks
Default value is BinarizationType::Adaptive.
Returns
The type of binarization to use.
Parameters
argCBinarizeCBinarize handle
pargExceptionPointer to exception structure that will be filled if an exception occurs

◆ CBinarize_GetBinarizeCallback()

IBinarizeCallback CBinarize_GetBinarizeCallback ( const CBinarize  argCBinarize,
idrs_exception *  pargException 
)

Gets the callback object used to indicate which color to drop out.

Returns
The callback pointer
Parameters
argCBinarizeCBinarize handle
pargExceptionPointer to exception structure that will be filled if an exception occurs

◆ CBinarize_GetBrightness()

IDRS_INT CBinarize_GetBrightness ( const CBinarize  argCBinarize,
idrs_exception *  pargException 
)

Gets the brightness adjustment to apply during binarization.

Remarks
Default value is 128.
Returns
The brightness
Parameters
argCBinarizeCBinarize handle
pargExceptionPointer to exception structure that will be filled if an exception occurs

◆ CBinarize_GetContrast()

IDRS_INT CBinarize_GetContrast ( const CBinarize  argCBinarize,
idrs_exception *  pargException 
)

Gets the contrast adjustment to apply during binarization.

Remarks
Default value is 40.
Returns
The contrast
Parameters
argCBinarizeCBinarize handle
pargExceptionPointer to exception structure that will be filled if an exception occurs

◆ CBinarize_GetGlobalThreshold()

IDRS_INT CBinarize_GetGlobalThreshold ( const CBinarize  argCBinarize,
idrs_exception *  pargException 
)

Gets the global threshold to be use during binarization.

Remarks
Default value is 128.
Returns
The binarization global threshold
Parameters
argCBinarizeCBinarize handle
pargExceptionPointer to exception structure that will be filled if an exception occurs

◆ CBinarize_GetSmoothingLevel()

IDRS_INT CBinarize_GetSmoothingLevel ( const CBinarize  argCBinarize,
idrs_exception *  pargException 
)

Gets the strength of the smoothing operation applied during binarization.

Remarks
Default value is 248.
Returns
The smoothing level
Parameters
argCBinarizeCBinarize handle
pargExceptionPointer to exception structure that will be filled if an exception occurs

◆ CBinarize_GetUndithering()

IDRS_BOOL CBinarize_GetUndithering ( const CBinarize  argCBinarize,
idrs_exception *  pargException 
)

Gets a flag indicating if the automatic undithering correction will be applied before OCR.

Remarks
Default value is IDRS_FALSE.
Returns
IDRS_TRUE if automatic undithering is activated
Remarks
IDRS_FALSE is set by default
Parameters
argCBinarizeCBinarize handle
pargExceptionPointer to exception structure that will be filled if an exception occurs

◆ CBinarize_SetBinarizationType()

void CBinarize_SetBinarizationType ( CBinarize  argCBinarize,
enum BinarizationType const  evBinarizationType,
idrs_exception *  pargException 
)

Set the type of binarization to use.

Parameters
argCBinarizeCBinarize handle
evBinarizationTypeThe type of binarization to use.
pargExceptionPointer to exception structure that will be filled if an exception occurs

◆ CBinarize_SetBinarizeCallback()

void CBinarize_SetBinarizeCallback ( CBinarize  argCBinarize,
IBinarizeCallback  pBinarizeCallback,
idrs_exception *  pargException 
)

Sets the callback object used to indicate which color to drop out.

Parameters
argCBinarizeCBinarize handle
pBinarizeCallbackCallback pointer to set
pargExceptionPointer to exception structure that will be filled if an exception occurs

◆ CBinarize_SetBrightness()

void CBinarize_SetBrightness ( CBinarize  argCBinarize,
IDRS_INT const  iBrightness,
idrs_exception *  pargException 
)

Sets the brightness adjustment to apply during binarization.

Remarks
Valid range goes from 0 to 255; values outside of this range will be clamped to it.
Higher values will darken the resulting image
Parameters
argCBinarizeCBinarize handle
iBrightnessThe brightness.
pargExceptionPointer to exception structure that will be filled if an exception occurs

◆ CBinarize_SetContrast()

void CBinarize_SetContrast ( CBinarize  argCBinarize,
IDRS_INT const  iContrast,
idrs_exception *  pargException 
)

Sets the contrast adjustment to apply during binarization.

Remarks
Valid range goes from 0 to 255; values outside of this range will be clamped to it.
Lower values will darken the resulting image
Parameters
argCBinarizeCBinarize handle
iContrastThe contrast.
pargExceptionPointer to exception structure that will be filled if an exception occurs

◆ CBinarize_SetGlobalThreshold()

void CBinarize_SetGlobalThreshold ( CBinarize  argCBinarize,
IDRS_INT const  iGlobalThreshold,
idrs_exception *  pargException 
)

Sets the global threshold to be use during binarization.

Remarks
Adaptive and Automatic-Threshold binarizations do not use this value.
Valid range goes from 0 to 255; values outside of this range will be clamped to it.
Parameters
argCBinarizeCBinarize handle
iGlobalThresholdThe binarization global threshold.
pargExceptionPointer to exception structure that will be filled if an exception occurs

◆ CBinarize_SetSmoothingLevel()

void CBinarize_SetSmoothingLevel ( CBinarize  argCBinarize,
IDRS_INT const  iSmoothingLevel,
idrs_exception *  pargException 
)

Sets the strength of the smoothing operation applied during binarization.

Remarks
Valid range goes from 0 to 255; values outside of this range will be clamped to it.
Parameters
argCBinarizeCBinarize handle
iSmoothingLevelThe smoothing level.
pargExceptionPointer to exception structure that will be filled if an exception occurs

◆ CBinarize_SetUndithering()

void CBinarize_SetUndithering ( CBinarize  argCBinarize,
IDRS_BOOL const  bUndithering,
idrs_exception *  pargException 
)

Sets the automatic undithering when binarizing a page.

Dithering is a scanning technique which consists in representing a color or greyscale image using only a limited color palette. This allows to reduce file size while maintaining the general aspect of the image.

This technique is known to create images more difficult to handle for OCR technology; this is why specific image preprocessing is needed to detect and revert it.

Parameters
argCBinarizeCBinarize handle
bUnditheringIDRS_TRUE to activate automatic undithering
pargExceptionPointer to exception structure that will be filled if an exception occurs
Remarks
Automatic undithering will be applied only if smoothing is also activated