Leaper Vision Toolkit
中文 / English 2.x
Public Member Functions | Properties
ILImageMorph Interface Reference

This interface provide functionalities of morphology operations. More...

Inheritance diagram for ILImageMorph:
ILObject LImageMorph

Public Member Functions

void BottomHat (ILImage *img, ILImage *result)
 
void Close (ILImage *img, ILImage *result)
 
void Dilate (ILImage *img, ILImage *result)
 
void Erode (ILImage *img, ILImage *result)
 
void Gradient (ILImage *img, ILImage *result)
 
void Open (ILImage *img, ILImage *result)
 
void SetMorphShape (LPVMorphShape shape, int kWidth, int kHeight)
 
void TopBottomHat (ILImage *img, ILImage *result)
 
void TopHat (ILImage *img, ILImage *result)
 
- Public Member Functions inherited from ILObject
ILObjectCopy ()
 
LPVErrorCode Load (LString filename)
 
void Reset ()
 
LPVErrorCode Save (LString filename)
 
BOOL Valid ()
 

Properties

int MorphHeight [get]
 The height of the structuring element size. More...
 
LPVMorphShape MorphShape [get]
 The shape of the structuring element. More...
 
int MorphWidth [get]
 The width of the structuring element size. More...
 

Detailed Description

This interface provide functionalities of morphology operations.

Morphology is a set of operations based on the predefined structuring elements. For each pixel, the operator compares its value with its neighbors, then assign the comparison result to output image. Structuring elements define the region of neighbors and specifically which ones should be compared. Dilate and erode is the basic morphology operation, all others are combination of them. Dilate takes the maximum as result, while erode does the exactly opposite.

To use this interface, you should create a LImageMorph object.

Example Code

Member Function Documentation

◆ BottomHat()

void BottomHat ( ILImage img,
ILImage result 
)

Erase small elements and details from given images. Bottom-hat operation is the equivalent of subtracting the input image from the result of performing a morphological closing operation on the input image.

\[ I' = close( I, element ) - I \]

Parameters
[in]imgThe input image
[out]resultReturn result image

◆ Close()

void Close ( ILImage img,
ILImage result 
)

Close operation, reduces or completely removes dark areas of the image. Close operation is a dilation followed by an erosion.

\[ I' = erode(dilate( I, element ) \]

Parameters
[in]imgThe input image
[out]resultReturn result image

◆ Dilate()

void Dilate ( ILImage img,
ILImage result 
)

Dilate operation. The value of the output pixel is the maximum value of all the pixels that fall within the structuring element's size and shape.

\[ I'(x,y) = \max _{(i,j): , \texttt{element} (i,j) \ne0 } I (x+i,y+j) \]

Parameters
[in]imgThe input image
[out]resultReturn result image

◆ Erode()

void Erode ( ILImage img,
ILImage result 
)

Erode operation. The value of the output pixel is the minimum value of all the pixels that fall within the structuring element's size and shape.

\[ I'(x,y) = \min _{(i,j): , \texttt{element} (i,j) \ne0 } I (x+i,y+j) \]

Parameters
[in]imgThe input image
[out]resultReturn result image

◆ Gradient()

void Gradient ( ILImage img,
ILImage result 
)

Gradient operation, output a morphological gradient image. Gradient operation is the equivalent of subtracting and erosion from a dilation.

\[ I' = dilate( I, element ) - erode( I, element ) \]

Parameters
[in]imgThe input image
[out]resultReturn result image

◆ Open()

void Open ( ILImage img,
ILImage result 
)

Open operation, slightly decreased overall brightness, removing small amounts of bright pixels and enhancing the remaining bright features. Open operation is an erosion followed by a dilation.

\[ I' = dilate(erode( I, element ) \]

Parameters
[in]imgThe input image
[out]resultReturn result image

◆ SetMorphShape()

void SetMorphShape ( LPVMorphShape  shape,
int  kWidth,
int  kHeight 
)

Set the structuring element used in morphology operations of specified shape and size.

Parameters
[in]shapeThe structuring element's shape.
[in]kWidthThe width of the element size, should be an odd number, say, 3, 5, 7, etc.
[in]kHeightThe height of the element size, should be an odd number, say, 3, 5, 7, etc.

◆ TopBottomHat()

void TopBottomHat ( ILImage img,
ILImage result 
)

Each output pixel represents the maximum value of TopHat or BottomHat.

Parameters
[in]imgThe input image
[out]resultReturn result image

◆ TopHat()

void TopHat ( ILImage img,
ILImage result 
)

Extracts small elements and details from given images. Top-hat operation is the equivalent of subtracting the result of performing a morphological opening operation on the input image from the input image itself.

\[ I' = I - open( I, element ) \]

Parameters
[in]imgThe input image
[out]resultReturn result image

Property Documentation

◆ MorphHeight

int MorphHeight
get

The height of the structuring element size.

See also
SetMorphShape()

◆ MorphShape

LPVMorphShape MorphShape
get

The shape of the structuring element.

See also
SetMorphShape()

◆ MorphWidth

int MorphWidth
get

The width of the structuring element size.

See also
SetMorphShape()