L_BinaryObjectCount

#include "l_bitmap.h"

LTIMGCOR_API L_INT L_BinaryObjectCount(pBitmap, pphRgn, pNumLabels)

pBITMAPHANDLE pBitmap;

/* pointer to the bitmap handle */

L_HRGN* * pphRgn;

/* array of regions */

L_INT * pNumLabels;

/* pointer to the variable to be updated */

Obtains the number of 8-connented binary object pixels and places each object in region structure.

Parameter

Description

pBitmap

Pointer to the bitmap handle that references the bitmap containing objects.

pphRgn

Array of regions to store objects in. Index of regions is zero-based.

 

If NULL is passed, the number of objects is returned in pNumLabels without storing objects.

pNumLabels

Pointer to a variable to be updated with the number of elements of pphRgn array.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

This function scans for a group of 8-connected object pixels (pixes surrounded by other pixels).

This function is useful in image segmentation and morphological operations such as dilate and erode, used in image and text pre-processing to improve recognition and deskew results.

This function does not support signed data images. It returns the error code ERROR_SIGNED_DATA_NOT_SUPPORTED if a signed data image is passed to this function.

This function works only on 1-bit black and white images.

Object pixels must be white in color, with a background black in color, otherwise the function will fail.

This function does not support 32-bit grayscale images. It returns the error code ERROR_GRAY32_UNSUPPORTED if a 32-bit grayscale image is passed to this function.

Required DLLs and Libraries

LTIMCOR

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

Platforms

Win32, x64.

See Also

Functions:

L_GetBitmapStatisticsInfo, L_AutoBinaryBitmap, L_MinFilterBitmap, L_MaxFilterBitmap, L_IntensityDetectBitmap

Topics

Raster Image Functions: Filtering Images

 

Removing Noise

Example