ImageGear for C and C++ on Windows v19.10 - Updated
IG_IC_clean_borders_ex
API Reference Guide > ImageClean Component API Reference > ImageClean Component Functions Reference > IG_IC_clean_borders_ex

This function detects and removes large black regions that are placed near the borders of a 1-bit image and have characteristics set by parameters of this function.

Declaration:

 
Copy Code
AT_ERRCOUNT IG_IC_clean_borders_ex (
        HIGEAR hIGear, 
        UINT nMaxLeftBorder, 
        UINT nMaxRightBorder, 
        UINT nMaxTopBorder, 
        UINT nMaxBottomBorder, 
        UINT nMinLinesNum, 
        UINT nMinLineWidth
);

Arguments:

Name Type Description
hIGear HIGEAR HIGEAR handle of image.
nMaxLeftBorder UINT Maximal size of left border.
nMaxRightBorder UINT Maximal size of right border.
nMaxTopBorder UINT Maximal size of top border.
nMaxBottomBorder UINT Maximal size of bottom border.
nMinLinesNum UINT Minimal number of lines with width not less than nMinLineWidth in one border block.
nMinLineWidth UINT Minimal width of lines in one border block. Those blocks that have not less than nMinLinesNum number of lines with nMinLineWidth width or wider will be removed from image.

Return Value:

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

Supported Raster Image Formats:

Indexed RGB – 1 bpp.

Remarks:

Black borders can appear as a result of scanning an image that was reproduced with a copier onto paper that was larger than the image itself.

First 4 parameters set maximal size of all borders. It means the pixels that lie outside of the borders will not be deleted. But it doesn't mean that all pixels in the borders will be deleted. Last two parameters serve for informing the function which objects in the borders should be deleted - only black objects that have not less than nMinLinesNum lines with width not less than nMinLineWidth will be deleted. As for the left and right borders, objects lines are actually parts of screen lines but as for top and bottom borders those lines are screen columns.

This function can be applied several times. The first time, large values can be set for all parameters and thus large borders will be removed without removing actual image parts. Then setting small values for the parameters will cause removing of small spots near the edges of the image.

Refer to the Component Manager API section.