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

This interface provide functionalities of basic and advanced image operations, such as resizing, rotation, arithmetic, blending, tiling, etc. More...

Inheritance diagram for ILImageOp:
ILObject LImageOp

Public Member Functions

void Add (ILImage *img1, ILImage *img2, ILImage *result)
 
void AddWeighted (ILImage *img1, ILImage *img2, double alpha, double beta, ILImage *result)
 
void Blend (ILImageList *imgList, LPVAggregation aggType, ILImage *result)
 
void Diff (ILImage *img1, ILImage *img2, ILImage *result)
 
void Divide (ILImage *img1, ILImage *img2, ILImage *result)
 
void Flip (ILImage *img, LPVFlipType flipType, ILImage *result)
 
void GainOffset (ILImage *img, ILImage *result, double gain, double offset)
 
void Invert (ILImage *img, ILImage *result)
 
void Log (ILImage *img, double base, ILImage *result)
 
void Max (ILImage *img1, ILImage *img2, ILImage *result)
 
void Min (ILImage *img1, ILImage *img2, ILImage *result)
 
void Multiply (ILImage *img1, ILImage *img2, ILImage *result)
 
void Pow (ILImage *img, double power, ILImage *result)
 
LArray< double > ProjectX (ILImage *img, LPVAggregation aggType)
 
LArray< double > ProjectY (ILImage *img, LPVAggregation aggType)
 
void Resize (ILImage *img, double zoomX, double zoomY, LPVInterpolationMethod interMethod, ILImage *result)
 
void ResizeTo (ILImage *img, int w, int h, LPVInterpolationMethod interMethod, ILImage *result)
 
void Rotate (ILImage *img, double angle, LPVInterpolationMethod interMethod, ILImage *result)
 
void ScaleRotate (ILImage *img, double angle, double zoomX, double zoomY, double pivotImgX, double pivotImgY, double pivotResultX, double pivotResultY, LPVInterpolationMethod interMethod, ILImage *result)
 
void Sub (ILImage *img1, ILImage *img2, ILImage *result)
 
void TileX (ILImageList *imgList, int columnCount, BOOL compactMode, ILImage *result)
 
void TileY (ILImageList *imgList, int rowCount, BOOL compactMode, ILImage *result)
 
void Transform (ILImage *img, ILTransform *tf, LPVInterpolationMethod interMethod, ILImage *result)
 
- Public Member Functions inherited from ILObject
ILObjectCopy ()
 
LPVErrorCode Load (LString filename)
 
void Reset ()
 
LPVErrorCode Save (LString filename)
 
BOOL Valid ()
 

Properties

LColor BGColor [get, set]
 The background color, used to fill the uncovered part in operation such as Rotate(), TileX(). By default, it's black.
 
double ResultGain [get, set]
 Scale the final result of the operation with the gain value. It should be a non-zero value, by default, it's 1, aka no scale.
 
double ResultOffset [get, set]
 The offset value added to the final result of the operation, after scaled by ResultGain. Default to 0, aka no offset.
 

Detailed Description

This interface provide functionalities of basic and advanced image operations, such as resizing, rotation, arithmetic, blending, tiling, etc.

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

Example Code

Member Function Documentation

◆ Add()

void Add ( ILImage img1,
ILImage img2,
ILImage result 
)

Add the two input images pixel by pixel, output a new result image, @math_eq{I' = I_{1} + I_{2}} . The two input image should have the same size.

Parameters
[in]img1The first input image
[in]img2The second input image
[out]resultReturn result image

◆ AddWeighted()

void AddWeighted ( ILImage img1,
ILImage img2,
double  alpha,
double  beta,
ILImage result 
)

Add the two input images pixel by pixel, output a new result image, @math_eq{I' = I_{1} * alpha + I_{2} * beta} . The two input image should have the same size.

Parameters
[in]img1The first input image
[in]img2The second input image
[in]alphaThe weight of the first input image
[in]betaThe weight of the second input image
[out]resultReturn result image

◆ Blend()

void Blend ( ILImageList imgList,
LPVAggregation  aggType,
ILImage result 
)

Multi-frame image blending allows user to accumulate a number of acquired images of the same scene and generate one blending image. Different aggregation type may be used for different purposes.

Aggregation Type Usage
Average Reduce image noise, generate a reliable image where lighting can be erratic.
Min Reduce light areas, for example, the overexposed parts.
Max Reduce shadows
Standard deviation Lighter pixels indicate a higher degree of variation between images.

Note: other aggregation types are not supported.

Parameters
[in]imgListThe input image list for blending.
[in]aggTypeThe aggregation method used for blending.
[out]resultOutput the blending result.
Example
ImageBlend.cpp/cs

◆ Diff()

void Diff ( ILImage img1,
ILImage img2,
ILImage result 
)

Calculate the difference of the two input images pixel by pixel, output a new result image, @math_eq{I' = abs(I_{1} - I_{2})} . The two input image should have the same size.

Parameters
[in]img1The first input image
[in]img2The second input image
[out]resultReturn result image

◆ Divide()

void Divide ( ILImage img1,
ILImage img2,
ILImage result 
)

Divide the first input image by the second input image pixel by pixel, output a new result image, @math_eq{I' = I_{1} / I_{2}} . The two input image should have the same size.

Parameters
[in]img1The first input image
[in]img2The second input image
[out]resultReturn result image

◆ Flip()

void Flip ( ILImage img,
LPVFlipType  flipType,
ILImage result 
)

Flip an image horizontally or/and vertically.
If the pass-in result image object is empty, then we'll use the same size as the input. Otherwise, the original size is kept and the border pixels are filled with background color(default to black).

Parameters
[in]imgThe input image
[in]flipTypeThe type of flip
[out]resultReturn result image Otherwise, the original size is kept.

◆ GainOffset()

void GainOffset ( ILImage img,
ILImage result,
double  gain,
double  offset 
)

Scale an image with the given gain value, then add the given offset value, \( I' = I * gain + offset \).

Parameters
[in]imgThe input image
[out]resultReturn result image
[in]gainThe gain value
[in]offsetThe offset value

◆ Invert()

void Invert ( ILImage img,
ILImage result 
)

Invert an image, \( I' = 255 - I \) for 8bit images, and \( I' = 65535 - I \) for 16bit images.

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

◆ Log()

void Log ( ILImage img,
double  base,
ILImage result 
)

Calculate the logarithm of the input image pixel by pixel, output a new result image, @math_eq{I' = \log_{base}{I}} .

Parameters
[in]imgThe input image
[in]baseThe input base, should be a positive value
[out]resultReturn result image

◆ Max()

void Max ( ILImage img1,
ILImage img2,
ILImage result 
)

Calculate the minimum of the two input images pixel by pixel, output a new result image, @math_eq{I' = \max (I_{1}, I_{2})} . The two input image should have the same size.

Parameters
[in]img1The first input image
[in]img2The second input image
[out]resultReturn result image

◆ Min()

void Min ( ILImage img1,
ILImage img2,
ILImage result 
)

Calculate the maximum of the two input images pixel by pixel, output a new result image, @math_eq{I' = \min (I_{1}, I_{2})} . The two input image should have the same size.

Parameters
[in]img1The first input image
[in]img2The second input image
[out]resultReturn result image

◆ Multiply()

void Multiply ( ILImage img1,
ILImage img2,
ILImage result 
)

Multiply the two input images pixel by pixel, output a new result image, @math_eq{I' = I_{1} \cdot I_{2}} . The two input image should have the same size.

Parameters
[in]img1The first input image
[in]img2The second input image
[out]resultReturn result image

◆ Pow()

void Pow ( ILImage img,
double  power,
ILImage result 
)

Calculate the power(exponentiation) of the input image pixel by pixel, output a new result image, @math_eq{I' = I^{power}} .

Parameters
[in]imgThe input image
[in]powerThe input exponent or power
[out]resultReturn result image

◆ ProjectX()

LArray<double> ProjectX ( ILImage img,
LPVAggregation  aggType 
)

Projects an image horizontally, aggregating pixels on each row

Parameters
[in]img The input image
[in]aggTypeThe aggregation method used for projection.
Return values
resultReturn the projection result vector, it's a list of double values.

◆ ProjectY()

LArray<double> ProjectY ( ILImage img,
LPVAggregation  aggType 
)

Projects an image vertically, aggregating pixels on each column

Parameters
[in]img The input image
[in]aggTypeThe aggregation method used for projection.
Return values
resultReturn the projection result vector, it's a list of double values.

◆ Resize()

void Resize ( ILImage img,
double  zoomX,
double  zoomY,
LPVInterpolationMethod  interMethod,
ILImage result 
)

Resize an image by the given scale factor, using the image center as the pivot point.
If the pass-in result image object is empty, then we'll use the same size as the input. Otherwise, the original size is kept and the border pixels are filled with background color(default to black).

Parameters
[in]imgThe input image
[in]zoomXFactor for zooming in or out in the x-coordinate direction.
[in]zoomYFactor for zooming in or out in the y-coordinate direction. Setting to 0 means same zoom factor as zoomX, aka. isotropic scaling.
[in]interMethodThe interpolation method used in resizing
[out]resultReturn result image
See also
ResizeTo(), Rotate(), ScaleRotate(), Transform()

◆ ResizeTo()

void ResizeTo ( ILImage img,
int  w,
int  h,
LPVInterpolationMethod  interMethod,
ILImage result 
)

Resize an image to the given new size.
If the pass-in result image object is empty, then we'll use the same size as the input. Otherwise, the original size is kept and the border pixels are filled with background color(default to black).

Parameters
[in]imgThe input image
[in]wThe width of the new size
[in]hThe height of the new size
[in]interMethodThe interpolation method used in resizing
[out]resultReturn result image
See also
Resize(), Rotate(), ScaleRotate(), Transform()

◆ Rotate()

void Rotate ( ILImage img,
double  angle,
LPVInterpolationMethod  interMethod,
ILImage result 
)

Rotate an image by the given degree clockwise, using the image center as the pivot point.
If the pass-in result image object is empty, then we'll use the same size as the input. Otherwise, the original size is kept and the border pixels are filled with background color(default to black).

Parameters
[in]imgThe input image
[in]angleThe rotation angle
[in]interMethodThe interpolation method used in rotation
[out]resultReturn result image
See also
ScaleRotate()

◆ ScaleRotate()

void ScaleRotate ( ILImage img,
double  angle,
double  zoomX,
double  zoomY,
double  pivotImgX,
double  pivotImgY,
double  pivotResultX,
double  pivotResultY,
LPVInterpolationMethod  interMethod,
ILImage result 
)

Scale and rotate an image, using the user-defined pivot points.
If the pass-in result image object is empty, then we'll use the same size as the input. Otherwise, the original size is kept and the border pixels are filled with background color(default to black).

Parameters
[in]imgThe input image
[in]angleThe clockwise rotation angle in degrees
[in]zoomXFactor for zooming in or out in the x-coordinate direction.
[in]zoomYFactor for zooming in or out in the y-coordinate direction. Setting to 0 means same zoom factor as zoomX, aka. isotropic scaling.
[in]pivotImgXThe x-coordinate of the pivot point on the input image. The pivot point is used as the center of the scale and rotation.
[in]pivotImgYThe y-coordinate of the pivot point on the input image.
[in]pivotResultXThe x-coordinate of the pivot point on the result image. It's the "same" pixel as the pivot point in the input image.
[in]pivotResultYThe y-coordinate of the pivot point on the result image.
[in]interMethodThe interpolation method used in resizing
[out]resultReturn result image
See also
ResizeTo(), Rotate(), ScaleRotate(), Transform()

◆ Sub()

void Sub ( ILImage img1,
ILImage img2,
ILImage result 
)

Subtract two input images pixel by pixel, output a new result image, @math_eq{I' = I_{1} - I_{2}} . The two input image should have the same size.

Parameters
[in]img1The first input image
[in]img2The second input image
[out]resultReturn result image

◆ TileX()

void TileX ( ILImageList imgList,
int  columnCount,
BOOL  compactMode,
ILImage result 
)

Tile a list of images into a large image horizontally.

Parameters
[in]imgListThe input image list
[in]columnCountThe number of images in one row. Pass in 0 or negative value to tile into one line.
If the total count of the inputs is not a multiple of the specified column count, the last row are filled with background color.
[in]compactModeIn compact mode(True), images of different sizes in a horizontal row are copied contiguously. Otherwise(False), result size is determined by the maximum width and height, and the smaller images are copied to the center of the respective tile.
[out]resultOutput the result image.
Example
TileImage.cpp/cs
See also
TileY()

◆ TileY()

void TileY ( ILImageList imgList,
int  rowCount,
BOOL  compactMode,
ILImage result 
)

Tile a list of images into a large image vertically.

Parameters
[in]imgListThe input image list
[in]rowCountThe number of images in one column. Pass in 0 or negative value to tile into one line.
If the total count of the inputs is not a multiple of the specified row count, the last column are filled with background color.
[in]compactModeIn compact mode(True), images of different sizes in a vertical column are copied contiguously. Otherwise(False), result size is determined by the maximum width and height, and the smaller images are copied to the center of the respective tile.
[out]resultOutput the result image.
Example
TileImage.cpp/cs
See also
TileX()

◆ Transform()

void Transform ( ILImage img,
ILTransform tf,
LPVInterpolationMethod  interMethod,
ILImage result 
)

Transform the image via the given transformation and return a new image.
If the pass-in result image object is empty, then we'll use the same size as the input. Otherwise, the original size is kept and the border pixels are filled with background color(default to black).

Parameters
[in]imgThe input image.
[in]tfThe transformation.
[in]interMethodThe interpolation method used in resizing
[out]resultReturn result image.
Example
LinearTransform.cpp/cs
See also
Resize(), ResizeTo(), Rotate(), ScaleRotate()