MIL_ID SrcImageBufId, | //in |
MIL_ID DstImageBufId, | //in |
MIL_ID ArrayBufIdOrConversionType | //in |
This function performs a color conversion on the source image and places the result in the destination buffer.
If necessary, you can perform a mathematically optimal color-to-grayscale conversion using McolProject() with M_PRINCIPAL_COMPONENT_PROJECTION.
When converting from sRGB (M_SRGB_...), your color data must adhere to standard RGB specifications (sRGB), as defined by the International Electrotechnical Commission (IEC) Project Team 61966-2-1. Conversions to sRGB (M_...SRGB) will also adhere to these standards. If converting from linear sRGB (M_SRGB_LINEAR_...), your color data must not be corrected (gamma corrected). Conversions to linear sRGB (M_...SRGB_LINEAR) will also not be corrected.
Specifies the identifier of the source image buffer.
This image buffer must not have a region of interest (ROI) associated with it. Using an image buffer with an ROI will cause an error.
Source buffer values must typically be positive, including the values in a signed source buffer. For LAB and LCH conversions, the full range of integer buffers is taken into account, including the negative values of signed buffers.
If specifying a floating-point buffer, the values of the buffer must be normalized between 0 and 1 before calling this function.
Specifies the identifier of the destination image buffer.
This image buffer must not have a region of interest (ROI) associated with it. Using an image buffer with an ROI will cause an error.
The values generated will typically be normalized to the possible range of values in the destination buffer. For example, the hue values from 0 to 360° will generate the values from 0 to 255 in an 8-bit destination buffer.
For a floating-point destination buffer, the values generated will typically be normalized between 0 and 1. This normalization does not apply to the MIL array buffer identifier conversion type.
For LAB conversions with a floating-point destination buffer, the L band values fall between 0 and 100 (inclusive), while the A and B band values are unbounded. However for most applications, A and B values fall between -150 and 150 (exclusive). When converting to LAB with an integer destination buffer, A and B values are saturated to fall within -128 and 127 (inclusive). MIL then scales the L, A, and B band values to fall within the range of the destination buffer. The L band is therefore subject to a larger scaling than the two other bands.
For LCH conversions with a floating-point destination buffer, the H band value is an angle, in degrees; otherwise, MIL rescales the angle to fall within the range of the destination buffer. When converting to LCH with an integer destination buffer, MIL clips the C value to the lower value between the maximum allowed in the destination buffer and 255. MIL then rescales the value to fit within the full range of the destination buffer.
Specifies the type of conversion to perform. The conversion can be specified with either a predefined or custom transformation matrix. This parameter can be set to one of the following.
For specifying the type of conversion to
perform
|
|||||||||||||||||||||||||||||||||||||||
Value | Description |
MIL system-specific tooltip (‡) |
|||||||||||||||||||||||||||||||||||||
M_HSL_TO_RGB |
Specifies an HSL to RGB conversion. Both the source and destination image buffers must be 3-band image buffers. (summarize)Specifies an HSL to RGB conversion. (more details...) |
‡ | a | c M10 |
g | h | i | j | k M10 |
l | m | o | p | r U27 |
t U28 |
u U36 |
v | y U75 |
aa | ||||||||||||||||||||
M_HSV_TO_RGB |
Specifies an HSV to RGB conversion. Both the source and destination image buffers must be 3-band image buffers. (summarize)Specifies an HSV to RGB conversion. (more details...) |
‡ | a | c M10 |
g | h | i | j | k M10 |
l | m | o | p | r U27 |
t U28 |
u U36 |
v | y U75 |
aa | ||||||||||||||||||||
M_LAB_TO_SRGB |
Specifies a LAB (CIELAB) to sRGB conversion. The LAB color space is based on the color's luminance (L), its position between red and green (A), and its position between yellow and blue (B). Both the source and destination image buffers must be 3-band image buffers. (summarize)Specifies a LAB (CIELAB) to sRGB conversion. (more details...) |
‡ | a | c M10 |
g | h | i | j | k M10 |
l | m | o | p | r U27 |
t U28 |
u U36 |
v | y U75 |
aa | ||||||||||||||||||||
M_LAB_TO_SRGB_LINEAR |
Specifies a LAB (CIELAB) to linear sRGB conversion. The LAB color space is based on the color's luminance (L), its position between red and green (A), and its position between yellow and blue (B). Both the source and destination image buffers must be 3-band image buffers. (summarize)Specifies a LAB (CIELAB) to linear sRGB conversion. (more details...) |
‡ | a | c M10 |
g | h | i | j | k M10 |
l | m | o | p | r U27 |
t U28 |
u U36 |
v | y U75 |
aa | ||||||||||||||||||||
M_L_TO_RGB |
Specifies an L (luminance) to RGB conversion. The luminance (intensity) is repeated in each color band of the destination buffer, creating a monochromatic (gray) RGB buffer. The source buffer must be a 1-band image buffer and the destination buffer must be a 3-band image buffer. (summarize)Specifies an L (luminance) to RGB conversion. (more details...) |
‡ | a | c M10 |
g | h | i | j | k M10 |
l | m | o | p | r U27 |
t U28 |
u U36 |
v | y U75 |
aa | ||||||||||||||||||||
M_LCH_TO_SRGB |
Specifies an LCH to sRGB conversion. The LCH color space is similar to the LAB color space, with an emphasis on polar coordinates (absolute black and absolute white). LCH is based on luminance (L), chroma (C), and hue (H). Both the source and destination image buffers must be 3-band image buffers. (summarize)Specifies an LCH to sRGB conversion. (more details...) |
‡ | a | c M10 |
g | h | i | j | k M10 |
l | m | o | p | r U27 |
t U28 |
u U36 |
v | y U75 |
aa | ||||||||||||||||||||
M_LCH_TO_SRGB_LINEAR |
Specifies an LCH to linear sRGB conversion. The LCH color space is similar to the LAB color space, with an emphasis on polar coordinates (absolute black and absolute white). LCH is based on luminance (L), chroma (C), and hue (H). Both the source and destination image buffers must be 3-band image buffers. (summarize)Specifies an LCH to linear sRGB conversion. (more details...) |
‡ | a | c M10 |
g | h | i | j | k M10 |
l | m | o | p | r U27 |
t U28 |
u U36 |
v | y U75 |
aa | ||||||||||||||||||||
M_RGB_NORMALIZE |
Specifies an RGB-to-normalized-RGB conversion. Each component of every pixel is scaled to a value between 0 and 1(inclusive), for example, the normalized R component is calculated according to R_Normalized = R / (R + G + B). To do so, the sum of the RGB components of each pixel is computed, and then, each component for that pixel is divided by that sum. If the destination buffer is an integer buffer, this value is then rescaled between 0 and the depth of the buffer. Both the source and destination image buffers must be 3-band image buffers. This normalizing of the RGB color space can help remove unwanted variations in shades from an image. (summarize)Specifies an RGB-to-normalized-RGB conversion. (more details...) |
‡ | a | c M10 |
g | h | i | j | k M10 |
l | m | o | p | r U27 |
t U28 |
u U36 |
v | y U75 |
aa | ||||||||||||||||||||
M_RGB_TO_H |
Specifies an RGB to H conversion, where H represents the hue of the HSL color space. The source image must be a 3-band image buffer and the destination buffer must be a 1-band image buffer. (summarize)Specifies an RGB to H conversion, where H represents the hue of the HSL color space. (more details...) |
‡ | a | c M10 |
g | h | i | j | k M10 |
l | m | o | p | r U27 |
t U28 |
u U36 |
v | y U75 |
aa | ||||||||||||||||||||
M_RGB_TO_HSL |
Specifies an RGB to HSL (hue, luminance (intensity), and saturation) conversion. Both the source and destination image buffers must be 3-band image buffers. The hue component (H) is stored in band 0, the luminance component (L) is stored in band 2, and the saturation component (S) is stored in band 1. (summarize)Specifies an RGB to HSL (hue, luminance (intensity), and saturation) conversion. (more details...) |
‡ | a | c M10 |
g | h | i | j | k M10 |
l | m | o | p | r U27 |
t U28 |
u U36 |
v | y U75 |
aa | ||||||||||||||||||||
M_RGB_TO_HSV |
Specifies an RGB to HSV (hue, saturation, and value) conversion. Both the source and destination image buffers must be 3-band image buffers. (summarize)Specifies an RGB to HSV (hue, saturation, and value) conversion. (more details...) |
‡ | a | c M10 |
g | h | i | j | k M10 |
l | m | o | p | r U27 |
t U28 |
u U36 |
v | y U75 |
aa | ||||||||||||||||||||
M_RGB_TO_L |
Specifies an RGB to L conversion, where L represents the luminance (intensity) of the HSL color space. The source image must be a 3-band image buffer and the destination buffer must be a 1-band image buffer. Note that M_RGB_TO_L and M_RGB_TO_Y produce similar results but not identical results because they are calculated to different color spaces. (summarize)Specifies an RGB to L conversion, where L represents the luminance (intensity) of the HSL color space. (more details...) |
‡ | a | c M10 |
g | h | i | j | k M10 |
l | m | o | p | r U27 |
t U28 |
u U36 |
v | y U75 |
aa | ||||||||||||||||||||
M_RGB_TO_Y |
Specifies an RGB to Y conversion, where Y represents the luminance of the YUV color space. The source buffer must have 3 bands. The destination buffer can have 1 or 3 bands. If it has 3 bands, only the first band is overwritten. Note that M_RGB_TO_L and M_RGB_TO_Y produce similar results but not identical results because they are calculated to different color spaces. (summarize)Specifies an RGB to Y conversion, where Y represents the luminance of the YUV color space. (more details...) |
‡ | a | c M10 |
g | h | i | j | k M10 |
l | m | o | p | r U27 |
t U28 |
u U36 |
v | y U75 |
aa | ||||||||||||||||||||
M_SRGB_LINEAR_TO_LAB |
Specifies a linear sRGB to LAB (CIELAB) conversion. The LAB color space is based on the color's luminance (L), its position between red and green (A), and its position between yellow and blue (B). Both the source and destination image buffers must be 3-band image buffers. (summarize)Specifies a linear sRGB to LAB (CIELAB) conversion. (more details...) |
‡ | a | c M10 |
g | h | i | j | k M10 |
l | m | o | p | r U27 |
t U28 |
u U36 |
v | y U75 |
aa | ||||||||||||||||||||
M_SRGB_LINEAR_TO_LCH |
Specifies a linear sRGB to LCH conversion. The LCH color space is similar to the LAB color space, with an emphasis on polar coordinates (absolute black and absolute white). LCH is based on luminance (L), chroma (C), and hue (H). Both the source and destination image buffers must be 3-band image buffers. (summarize)Specifies a linear sRGB to LCH conversion. (more details...) |
‡ | a | c M10 |
g | h | i | j | k M10 |
l | m | o | p | r U27 |
t U28 |
u U36 |
v | y U75 |
aa | ||||||||||||||||||||
M_SRGB_TO_LAB |
Specifies an sRGB to LAB (CIELAB) conversion. The LAB color space is based on the color's luminance (L), its position between red and green (A), and its position between yellow and blue (B). Both the source and destination image buffers must be 3-band image buffers. (summarize)Specifies an sRGB to LAB (CIELAB) conversion. (more details...) |
‡ | a | c M10 |
g | h | i | j | k M10 |
l | m | o | p | r U27 |
t U28 |
u U36 |
v | y U75 |
aa | ||||||||||||||||||||
M_SRGB_TO_LCH |
Specifies an sRGB to LCH conversion. The LCH color space is similar to the LAB color space, with an emphasis on polar coordinates (absolute black and absolute white). LCH is based on luminance (L), chroma (C), and hue (H). Both the source and destination image buffers must be 3-band image buffers. (summarize)Specifies an sRGB to LCH conversion. (more details...) |
‡ | a | c M10 |
g | h | i | j | k M10 |
l | m | o | p | r U27 |
t U28 |
u U36 |
v | y U75 |
aa | ||||||||||||||||||||
MIL array buffer identifier |
Specifies a general matrix multiplication transform will be used to modify the source image's color information. The matrix multiplication is performed using the provided 1-band, 32-bit floating-point buffer allocated using MbufAlloc2d() with M_ARRAY. You should use MbufPut() to define the values of the matrix. The source image buffer must be a 3-band buffer. The computation is shown below. When the provided array buffer is a 3x3 matrix or a 4x3 matrix (with optional offset values), the destination should be a 3-band buffer. When the provided array buffer is a 3x1 matrix or a 4x1 matrix (with an optional offset value), the destination should be a 1-band buffer. The final values are clipped (saturated) according to the destination buffer's bit depth. (summarize)Specifies a general matrix multiplication transform will be used to modify the source image's color information. (more details...) |
‡ | a | c M10 |
g | h | i | j | k M10 |
l | m | o | p | r U27 |
t U28 |
u U36 |
v | y U75 |
aa |
Header | Include mil.h. |
Library | Use mil.lib; milim.lib. |
DLL | Requires mil.dll; milim.dll. |