Leaper Vision Toolkit
中文 / English 2.x
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)
 
ILBlobExpand (int delta)
 
void ExpandTo (int delta)
 
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 ()
 
ILBlobIntersect (ILBlob *other)
 
void IntersectTo (ILBlob *other)
 
ILBlobShrink (int delta)
 
void ShrinkTo (int delta)
 
ILBlobSubtract (ILBlob *other)
 
void SubtractTo (ILBlob *other)
 
ILMaskRegionToRegion ()
 
ILBlobUnion (ILBlob *other)
 
void UnionTo (ILBlob *other)
 
ILBlobXOR (ILBlob *other)
 
void XORTo (ILBlob *other)
 
- Public Member Functions inherited from ILObject
ILObjectCopy ()
 
LPVErrorCode Load (LString filename)
 
void Reset ()
 
LPVErrorCode Save (LString filename)
 
BOOL Valid ()
 

Additional Inherited Members

- Properties inherited from ILObject
LString Name [get, set]
 Name of the object. By default, the object has no name.
In most cases, LPV classes don't make use of the names.
The name is drawn on canvas around the object if ILDrawable::SetDrawName() is enabled. More...
 

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.

◆ Expand()

ILBlob* Expand ( int  delta)

Offset the blob to the outer to create a inflated new blob.

Parameters
[in]deltaThe offset pixels
Return values
newBlobReturn a new result blob.
See also
ExpandTo(), Shrink(), LPolyClipper::Shrink()
Since
2.13.0

◆ ExpandTo()

void ExpandTo ( int  delta)

Offset the current blob to the outer to be inflated.

Parameters
[in]deltaThe offset pixels
See also
Expand(), Shrink(), LPolyClipper::Shrink()
Since
2.13.0

◆ 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().

◆ Intersect()

ILBlob* Intersect ( ILBlob other)

Intersect the current and provided blob, output a new one, \( P' = P \cap other \) .
Parts in both blobs are included. An empty blob intersects with any others result in an empty blob.

Parameters
[in]otherThe blob to be intersected.
Return values
newBlobReturn a new result blob.
See also
IntersectTo(), Subtract(), Union(), XOR().
Since
2.13.0

◆ IntersectTo()

void IntersectTo ( ILBlob other)

Intersect the current and provided blob, \( P = P \cap other \) .
Only the parts in both blobs are included. An empty blob intersects with any others result in an empty blob.

Parameters
[in]otherThe blob to be intersected.
See also
Intersect(), Subtract(), Union(), XOR().
Since
2.13.0

◆ Shrink()

ILBlob* Shrink ( int  delta)

Offset the blob to the inner to create a deflated new blob.

Parameters
[in]deltaThe offset pixels
Return values
newBlobReturn a new result blob.
See also
ShrinkTo(), Expand(), LPolyClipper::Shrink()
Since
2.13.0

◆ ShrinkTo()

void ShrinkTo ( int  delta)

Offset the current blob to the inner to be deflated.

Parameters
[in]deltaThe offset pixels
See also
Shrink(), Expand(), LPolyClipper::Shrink()
Since
2.13.0

◆ Subtract()

ILBlob* Subtract ( ILBlob other)

Subtract the provided blob from the current blob, output a new one, \( P' = P - other \).
A blob subtract an empty blob results a copy of itself, an empty blob subtract a blob results the inversion of the later.

Parameters
[in]otherThe blob to subtracted.
Return values
newBlobReturn a new result blob.
See also
SubtractTo(), Union(), Intersect(), XOR().
Since
2.13.0

◆ SubtractTo()

void SubtractTo ( ILBlob other)

Subtract the provided blob from the current blob, \( P = P - other \).
A blob subtract an empty blob does nothing, an empty blob subtract a blob results the inversion of the later.

Parameters
[in]otherThe blob to subtracted.
See also
Subtract(), Union(), Intersect(), XOR().
Since
2.13.0

◆ ToRegion()

ILMaskRegion* ToRegion ( )

Convert the blob object to a mask region object.

Return values
regionReturn the result region object.

◆ Union()

ILBlob* Union ( ILBlob other)

Union the current and provided blob, output a new one, \( P' = P \cup other \) .
Parts in either blobs are all included. A blob unions an empty blob results a copy of itself.

Parameters
[in]otherThe blob to be union-ed
Return values
newBlobReturn a new result blob.
See also
UnionTo(), Subtract(), Intersect(), XOR().
Since
2.13.0

◆ UnionTo()

void UnionTo ( ILBlob other)

Union the provided blob to the current, \( P = P \cup other \) .
Same as AddTo(), parts in either blobs are all included. A blob unions an empty blob does nothing.

Parameters
[in]otherThe blob to be union-ed
See also
Union(), Subtract(), Intersect(), XOR().
Since
2.13.0

◆ XOR()

ILBlob* XOR ( ILBlob other)

Calculate the symmetric difference of the current and provided blob, output a new one, \( P' = P \oplus other \) .
The parts in and only in one of blobs are included. An empty blob XOR with any others result in an empty blob.

Parameters
[in]otherThe blob to perform the XOR operation.
Return values
newBlobReturn a new result blob.
See also
XORTo(), Subtract(), Union(), Intersect().
Since
2.13.0

◆ XORTo()

void XORTo ( ILBlob other)

Calculate the symmetric difference of the current and provided blob, store the result in current blob object, \( P = P \oplus other \) .
The parts in and only in one of blobs are included. An empty blob XOR with any others result in an empty blob.

Parameters
[in]otherThe blob to perform the XOR operation.
See also
XOR(), Subtract(), Union(), Intersect().
Since
2.13.0