| MIL 10 Reference
| Customize Help
| Save Settings

MimConvert



See also
Availability
Available in MIL-Lite
Available in MIL

Available on Windows
Available on Linux

Partially supported on:
Partially supported on Matrox GPU processing driver

Fully supported on:
Fully supported on Host system
Fully supported on Matrox CronosPlus
Fully supported on Matrox GigE Vision driver
Fully supported on Matrox IEEE 1394 IIDC driver
Fully supported on Matrox Iris GT
Fully supported on Matrox Morphis
Fully supported on Matrox Morphis QxT
Fully supported on Matrox Orion HD
Fully supported on Matrox Radient eCL
Fully supported on Matrox Radient eV-CXP
Fully supported on Matrox Solios eA/XA
Fully supported on Matrox Solios ecl/xcl/ev-cl
Fully supported on Matrox USB3 Vision driver (requires Update 19)
Fully supported on Matrox Vio

For any information regarding a MIL system added during a MIL Update, see the MIL system’s release note

Available on Non-Matrox computer
Available on Matrox 4Sight-X
Available on Matrox 4Sight GP
Available on Matrox Supersight
function map Function map
Examples
Synopsis
Perform a color conversion.
Syntax
void MimConvert(
MIL_ID SrcImageBufId, //in
MIL_ID DstImageBufId, //in
MIL_ID ArrayBufIdOrConversionType //in
)
Description

This function performs a color conversion on the source image and places the result in the destination buffer.

The values generated will 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.

Note that the values in a signed source buffer must be positive. For a floating-point destination buffer, the values generated will be normalized between 0 and 1.

If necessary, you can perform a mathematically optimal color-to-grayscale conversion using McolProject() with M_PRINCIPAL_COMPONENT_PROJECTION.

Note that this function reference has not been updated for a MIL system added during a MIL update. Refer to the MIL system's release note to see which MIL system’s documentation you should use in its place and any possible differences.
Parameters
This function is not supported on the selected boards.
This function reference has not been updated for the selected MIL system. To show the content of this page, choose a second MIL system; refer to the MIL system's release note to see which MIL system’s documentation to choose and any possible differences.
Parameters
SrcImageBufId

Specifies the identifier of the source image buffer. Source buffer values must be positive. If specifying a floating-point buffer, the values of the buffer must be normalized between 0 and 1 before calling this function.

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.

DstImageBufId

Specifies the identifier of the destination image buffer. If specifying a floating-point buffer, the values generated will be normalized between 0 and 1. This normalization does not apply to the MIL array buffer identifier conversion type.

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.

ArrayBufIdOrConversionType

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.

function map For specifying the type of conversion to perform
CollapseValue Description
MIL system-specific
tooltip (†)
Collapse M_HSL_TO_RGB

Specifies a HSL to RGB conversion. Both the source and destination image buffers must be 3-band image buffers.

(summarize)
a b c d e f g h i j k l m n o p q r s
MIL system specific

Only supports conversion from M_BGR32 packed to M_BGR32 packed buffers.

d
Collapse 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)
a b c d e f g h i j k l m n o p q r s
MIL system specific

Only supports conversion from M_BGR32 packed to unsigned monochrome 8- or 16-bit buffers.

d
Collapse 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)
a b c d e f g h i j k l m n o p q r s
Collapse 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)
a b c d e f g h i j k l m n o p q r s
MIL system specific

Only supports conversion from M_BGR32 packed to unsigned monochrome 8- or 16-bit buffers.

d
Collapse 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)
a b c d e f g h i j k l m n o p q r s
MIL system specific

Only supports conversion from M_BGR32 packed to M_BGR32 packed buffers.

d
Collapse 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)
a b c d e f g h i j k l m n o p q r s
MIL system specific

Only supports conversion from M_BGR32 packed to unsigned monochrome 8- or 16-bit buffers.

d
Collapse 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)
a b c d e f g h i j k l m n o p q r s
MIL system specific

Only supports conversion from M_BGR32 packed to unsigned monochrome 8- or 16-bit buffers or from M_BGR32 packed to the first band of M_BGR32 packed buffers.

d
Collapse 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)
a b c d e f g h i j k l m n o p q r s
MIL system specific

Supports conversion from M_BGR32 packed to unsigned monochrome 8- or 16-bit buffers for 3x1 matrices. Supports conversion from M_BGR32 packed to the first band of M_BGR32 packed buffers for 3x3 matrices.

d
Compilation information
Header Include mil.h.
Library Use mil.lib; milim.lib.
DLL Requires mil.dll; milim.dll.
PROC NONE PROC NONE HSL TO RGB L TO RGB RGB NORMALIZE RGB TO H RGB TO HSL RGB TO L RGB TO Y FLOAT