Leaper Vision Toolkit
Public Member Functions
ILBlob Interface Reference

This interface holds single blob and provide functionalities of blob calculation, conversion and drawing. More...

Inheritance diagram for ILBlob:
ILObject LBlob

Public Member Functions

void AttachImage (ILImage *image)
 
int CountContour ()
 
int CountHole ()
 
void Draw (HDC hdc, LPVBlobDrawFlags drawFlags, double zoomX, double zoomY, double panX, double panY)
 
void FromRegion (ILRegion *region, ILImage *image)
 
double GetAngle (BOOL alwaysUp)
 
ILPointGetCenter ()
 
ILPolygonGetContour (int index)
 
double GetContrast (LPVAggregation aggType, double percentage)
 
ILPolygonGetConvexHull ()
 
double GetFeature (LPVBlobFeatures feature)
 
ILPolygonGetHole (int index)
 
double GetLuminance (LPVAggregation aggType, double percentage)
 
ILRectGetRect ()
 
ILRectGetRotRect ()
 
ILMaskRegionToRegion ()
 
- Public Member Functions inherited from ILObject
ILObjectCopy ()
 
LPVErrorCode Load (LString filename)
 
void Reset ()
 
LPVErrorCode Save (LString filename)
 
BOOL Valid ()
 

Detailed Description

This interface holds single blob and provide functionalities of blob calculation, conversion and drawing.

Usually you get the LBlob object from the ILBlobResults::Item() function. You can then use this interface to calculate the interested features, access to the detailed blob informations and draw the result on graphics windows.

Example Code

Member Function Documentation

◆ AttachImage()

void AttachImage ( ILImage image)

Attach the input image to the blob, used for image-related feature calculation, such as luminance, contrast, sharpness, etc..

Parameters
[in]imageThe input image

◆ CountContour()

int CountContour ( )

Get count of the external contours of the blob

See also
GetContour(), CountHole()

◆ CountHole()

int CountHole ( )

Get count of the external contours of the blob

See also
GetHole(), CountContour()

◆ Draw()

void Draw ( HDC  hdc,
LPVBlobDrawFlags  drawFlags,
double  zoomX,
double  zoomY,
double  panX,
double  panY 
)

Draw the blob onto provide device context.

Parameters
[in]drawFlagsFlags to control the blob drawing behavior, see LPVBlobDrawFlags for usage.
See also
Use Draw Functions
Remarks
This function is currently not available on Linux / MacOS platform.

◆ FromRegion()

void FromRegion ( ILRegion region,
ILImage image 
)

Construct the blob object from a region object.

Parameters
[in]regionThe input region object.
[in]imageThe input image to be attached to the blob. It is used for image-related feature calculation, such as luminance, contrast, sharpness, etc.. Pass in null if you don't want do that.

◆ GetAngle()

double GetAngle ( BOOL  alwaysUp)

Get the angle of the blob. It's the same direction as the blob's rotate bounding rectangle's longer axis, in range of (-90, 90).

Parameters
[in]alwaysUpIf it's on, return the angle of the up axis, it could either the longer axis or the shorter axis. It is useful when the difference between axes is not notable, for example, it's a square object, but the rotation is slight. An always-up angle is in range of (-135, -45).
Return values
valReturn the angle

◆ GetCenter()

ILPoint* GetCenter ( )

Get the center of gravity of the blob.

◆ GetContour()

ILPolygon* GetContour ( int  index)

Fetch one external contour of the blob with given index.

Parameters
[in]indexThe input index, it should be a 0-based number smaller than total count.
Return values
valReturn the external contour as polygon
See also
CountContour(), GetHole()

◆ GetContrast()

double GetContrast ( LPVAggregation  aggType,
double  percentage 
)

Calculate the aggregated contrast feature of the blob, only available when an image is attached to the blob.

Parameters
[in]aggTypeAggregation type, see LPVAggregation for usage.
[in]percentageSpecify the top/bottom percentage of pixels used in aggregation. A positive value indicates the top X% pixels sorted by their contrast value descendingly, a negative value use the bottom X%. Pass in 0 to use all pixels.
Return values
valReturn the aggregated contrast feature result.

◆ GetConvexHull()

ILPolygon* GetConvexHull ( )

Get the bounding convex hull of the blob

See also
GetRect(), GetRotRect().

◆ GetFeature()

double GetFeature ( LPVBlobFeatures  feature)

Calculate the specified numeric feature of the blob.

Parameters
[in]featureSpecify the required feature, see LPVBlobFeatures.
Return values
valReturn the feature result.

◆ GetHole()

ILPolygon* GetHole ( int  index)

Fetch one hole of the blob with given index.

Parameters
[in]indexThe input index, it should be a 0-based number smaller than total count.
Return values
valReturn the hole contour as polygon
See also
CountHole(), GetContour()

◆ GetLuminance()

double GetLuminance ( LPVAggregation  aggType,
double  percentage 
)

Calculate the aggregated luminance feature of the blob, only available when an image is attached to the blob.

Parameters
[in]aggTypeAggregation type, see LPVAggregation for usage.
[in]percentageSpecify the top/bottom percentage of pixels used in aggregation. A positive value indicates the top X% pixels sorted by their luminance value descendingly, a negative value use the bottom X%. Pass in 0 to use all pixels.
Return values
valReturn the aggregated luminance feature result.

◆ GetRect()

ILRect* GetRect ( )

Get the bounding rectangle of the blob

See also
GetRotRect(), GetConvexHull().

◆ GetRotRect()

ILRect* GetRotRect ( )

Get the rotated bounding rectangle of the blob

See also
GetRect(), GetConvexHull().

◆ ToRegion()

ILMaskRegion* ToRegion ( )

Convert the blob object to a mask region object.

Return values
regionReturn the result region object.