Leaper Vision Toolkit
中文 / English 2.x
Public Member Functions
ILImageConvert Interface Reference

This interface provide functionalities of image conversion between different color spaces or formats. More...

Inheritance diagram for ILImageConvert:
ILObject LImageConvert

Public Member Functions

void BGRMix (ILImage *bgrImg, double w0, double w1, double w2, ILImage *grayImg)
 
void BGRToGray (ILImage *bgrImg, ILImage *grayImg)
 
int BGRToGrayColor (LColor bgrColor)
 
void ColorMap (ILImage *img, LPVColorMap cmap, ILImage *bgrImg, BOOL inv, BOOL normalize, double minValue, double maxValue)
 
void Convert (LPVColorSpace fromColorSpace, enum LPVColorSpace toColorSpace, ILImage *srcColorImg, ILImage *dstColorImg)
 
struct LColor ConvertColor (LPVColorSpace fromColorSpace, enum LPVColorSpace toColorSpace, LColor srcColor)
 
void Depth16To8 (ILImage *img16Bit, int fromNthBit, ILImage *img8Bit)
 
void Depth8To16 (ILImage *img8Bit, int fromNthBit, ILImage *img16Bit)
 
void GrayToBGR (ILImage *grayImg, ILImage *bgrImg)
 
LColor GrayToBGRColor (int grayColor)
 
void NormalizeTo8 (ILImage *img, double minValue, double maxValue, ILImage *img8Bit)
 
- Public Member Functions inherited from ILObject
ILObjectCopy ()
 
LPVErrorCode Load (LString filename)
 
void Reset ()
 
LPVErrorCode Save (LString filename)
 
BOOL Valid ()
 

Detailed Description

This interface provide functionalities of image conversion between different color spaces or formats.

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

Example Code

Member Function Documentation

◆ BGRMix()

void BGRMix ( ILImage bgrImg,
double  w0,
double  w1,
double  w2,
ILImage grayImg 
)

Mix the 3 channels in the input BGR color image using the specified weight for individual channel, as:

\[ Gray = w0⋅B + w1⋅G + w2⋅R \]

Parameters
[in]bgrImg The input BGR color image
[in]w0The weight for the 1st(Blue) channel, in range -255 ~ 255
[in]w1The weight for the 2nd(Green) channel, in range -255 ~ 255
[in]w2The weight for the 3rd(Red) channel, in range -255 ~ 255
[out]grayImg Return the grayscale result image of the same size as the input.

◆ BGRToGray()

void BGRToGray ( ILImage bgrImg,
ILImage grayImg 
)

Convert a BGR color image to grayscale

\[ Gray = 0.114⋅B + 0.587⋅G + 0.299⋅R \]

Parameters
[in]bgrImg The input BGR color image
[out]grayImg Return the grayscale result image of the same size as the input.
See also
GrayToBGR(), BGRToGrayColor(), GrayToBGRColor()

◆ BGRToGrayColor()

int BGRToGrayColor ( LColor  bgrColor)

Convert a BGR color value to grayscale value

Parameters
[in]bgrColorThe input BGR color value
Return values
grayColorReturn the grayscale value
See also
BGRToGray(), GrayToBGRColor()

◆ ColorMap()

void ColorMap ( ILImage img,
LPVColorMap  cmap,
ILImage bgrImg,
BOOL  inv,
BOOL  normalize,
double  minValue,
double  maxValue 
)

Apply color map on the given image, to generate a pseudo color image for data visualization

Parameters
[in]imgThe input image
[in]cmapThe applied colormap, see LPVColorMap for details
[out]bgrImg Return the result color image
[in]invWhether to invert the colormap. By default, it's false.
[in]normalizeWhether to normalize the input image based on the minValue ~ maxValue range, before applying colormap. By default, it's false.
[in]minValueThe specified minimum value of interest for normalization. Pass in negative to use the minimum of current image.
[in]maxValueThe specified maximum value of interest for normalization. Pass in negative to use the maximum of current image.
Example
Convert16To8Bit.cpp/cs
Since
2.4.0

◆ Convert()

void Convert ( LPVColorSpace  fromColorSpace,
enum LPVColorSpace  toColorSpace,
ILImage srcColorImg,
ILImage dstColorImg 
)

Convert the color image from one color space to another, for example, from BGR to HSV.

Parameters
[in]fromColorSpaceThe current source color space
[in]toColorSpaceThe destination color space
[in]srcColorImg The input color image
[out]dstColorImg Return the conversion result image
See also
ConvertColor

◆ ConvertColor()

struct LColor ConvertColor ( LPVColorSpace  fromColorSpace,
enum LPVColorSpace  toColorSpace,
LColor  srcColor 
)

Convert the color value from one color space to another

Parameters
[in]fromColorSpaceThe current source color space
[in]toColorSpaceThe destination color space
[in]srcColorThe input color value
Return values
dstColorReturn the conversion result

◆ Depth16To8()

void Depth16To8 ( ILImage img16Bit,
int  fromNthBit,
ILImage img8Bit 
)

Convert a 16bit image to 8bit depth, extracting the continues 8 bits from the specified index.

Parameters
[in]img16Bit The input 16bit image
[in]fromNthBitThe starting index, in range -7 ~ 15 to ensure at least 1 valid bit
From Nth Bit Usage
0 Extract High 8bit
8 Extract Low 8bit
4 Extract Middle 8bit
[out]img8Bit Return the result 8bit image
Example
Convert16To8Bit.cpp/cs
Since
2.4.0

◆ Depth8To16()

void Depth8To16 ( ILImage img8Bit,
int  fromNthBit,
ILImage img16Bit 
)

Convert a 8bit image to 16bit depth, set the continues 8 bits from the specified index.

Parameters
[in]img8Bit The input 8bit image
[in]fromNthBitThe starting index, in range -7 ~ 15 to ensure at least 1 valid bit
From Nth Bit Usage
0 Set to High 8bit
8 Set to Low 8bit
4 Set to Middle 8bit
[out]img16Bit Return the result 16bit image
Since
2.4.0

◆ GrayToBGR()

void GrayToBGR ( ILImage grayImg,
ILImage bgrImg 
)

Convert a grayscale image to a BGR color image, all three channels are assigned to the same value.

\[ B = Gray, G = Gray, R = Gray \]

Parameters
[in]grayImg The input grayscale image
[out]bgrImg Return the BGR color image of the same size as the input
See also
BGRToGray(), BGRToGrayColor(), GrayToBGRColor()

◆ GrayToBGRColor()

LColor GrayToBGRColor ( int  grayColor)

Convert a grayscale value to a BGR color value, all three channels are assigned to the same value.

Parameters
[in]grayColorThe input grayscale value
Return values
bgrColorReturn the BGR color value
See also
GrayToBGR(), BGRToGrayColor()

◆ NormalizeTo8()

void NormalizeTo8 ( ILImage img,
double  minValue,
double  maxValue,
ILImage img8Bit 
)

Normalize the given image (of any depth) to 8bit depth, stretching the values between the given minimum and maximum value.

Parameters
[in]imgThe input image
[in]minValueThe specified minimum value of interest. Pass in negative to use the minimum of current image.
[in]maxValueThe specified maximum value of interest. Pass in negative to use the maximum of current image.
[out]img8Bit Return the result 8bit image
Example
Convert16To8Bit.cpp/cs
Since
2.4.0