MIL_ID Src1ImageId, | //in |
MIL_ID Src2ImageOrArrayId, | //in |
MIL_ID DestImageOrArrayId, | //in |
MIL_ID DestMaskImageId, | //in |
MIL_INT64 Operation, | //in |
MIL_INT64 ControlFlag, | //in |
MIL_INT *StatusPtr | //out |
This function performs a color projection (transformation) of the source image, or returns a color projection matrix, which you can then apply to transform other images, using MimConvert(). McolProject() allows you to separate a selected color from a rejected one, or to convert color images to grayscale with minimal loss of information. You can also use this function to perform analytical tasks, such as calculating an image's covariance matrix or the principal components of an image's color information.
The calculated projection results are written in the specified destination buffer (DestImageOrArrayId). If the calculated projection results create an image, you can restrict the area to which results are written in the destination buffer using a mask image (DestMaskImageId).
Color projection is an operation that requires data defined in a Cartesian coordinate system (for example, RGB or CIELAB). A projection with HSL data would provide incoherent results.
This function is optimized for images with a width (X-size) greater than seven pixels.
Specifies the identifier of the source image buffer on which to perform the projection transformation. This must be a 3-band 8- or 16-bit unsigned image. Source images are interpreted per band, independently of the MIL buffer format.
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.
When separating colors (M_COLOR_SEPARATION) and using a MIL array buffer to specify the separation colors (Src2ImageOrArrayId), set this parameter to M_NULL. In this case, the destination buffer will contain the resulting projection matrix, rather than the transformed image.
Specifies the identifier of an image buffer or MIL array buffer that controls how the source pixels are interpreted.
See the Parameter associations section for possible values that can be specified.
Specifies the identifier of the destination buffer in which to write the color projection (transformation) results. The destination buffer can be either an image or a MIL array buffer.
Note that when the result is a matrix, you must set this parameter to a MIL array buffer, allocated using MbufAlloc...() with M_ARRAY.
See the Parameter associations section for possible values that can be specified.
Specifies the identifier of the destination mask image. The mask image must be monochrome. You can only specify a mask if the destination buffer is an image. If you do not require a mask, set this parameter to M_NULL.
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 destination mask determines where to write the result of the projection operation. Only masked pixels (non-zero) will be written to, in the destination image. The destination mask does not affect calculations.
Specifies the color projection operation.
See the Parameter associations section for possible values that can be specified.
Specifies the dynamic range on which the resulting projection is mapped. This is only applicable for M_PRINCIPAL_COMPONENT_PROJECTION.
Set this parameter to M_DEFAULT if not used.
See the Parameter associations section for possible values that can be specified.
Specifies the address of the variable in which to write the status of the color projection operation. If you do not require this information, set this parameter to M_NULL.
See the Parameter associations section for possible values that can be returned.
The table below lists possible values for the Src2ImageOrArrayId, DestImageOrArrayId, Operation, and ControlFlag parameters and possible values returned to the StatusPtr parameter.
Note that you should set any unused parameters to M_DEFAULT.
For implementing the color
projection
|
|||||||||||||||||||||||||||||||||||||||
Operation |
Description
|
||||||||||||||||||||||||||||||||||||||
Src2ImageOrArrayId | |||||||||||||||||||||||||||||||||||||||
DestImageOrArrayId | |||||||||||||||||||||||||||||||||||||||
ControlFlag | |||||||||||||||||||||||||||||||||||||||
StatusPtr - Possible values returned |
|||||||||||||||||||||||||||||||||||||||
M_COLOR_SEPARATION |
Removes a color from the source image. (more details...) |
||||||||||||||||||||||||||||||||||||||
Src2ImageOrArrayId |
Specifies the identifier of the buffer identifying the background, selected, and rejected pixel colors with which to perform the color separation. (more details...) |
||||||||||||||||||||||||||||||||||||||
Array buffer identifier |
Specifies the identifier of a 3x3 MIL array buffer, where each row defines, in the following order, the background, the selected, and the rejected colors, to use to compute the projection matrix. |
||||||||||||||||||||||||||||||||||||||
Image buffer identifier |
Specifies the identifier of a data identification image buffer. (more details...) |
||||||||||||||||||||||||||||||||||||||
DestImageOrArrayId |
Specifies the identifier of the destination buffer in which to write the color separation results. (more details...) |
||||||||||||||||||||||||||||||||||||||
Array buffer identifier |
Specifies the identifier of a 4x3 MIL array buffer, of type float, to store the resulting projection matrix. (more details...) |
||||||||||||||||||||||||||||||||||||||
Image buffer identifier |
Specifies the identifier of a 3-band color image buffer, to store the transformed (color separated) source image. (more details...) |
||||||||||||||||||||||||||||||||||||||
StatusPtr |
Returns the resulting status of the M_COLOR_SEPARATION operation. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_3_COLORS_COLLINEAR |
Specifies an unsatisfactory status, indicating that the selected, rejected, and background colors are collinear. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_NO_BACKGROUND_DEFINED |
Specifies an unsatisfactory status, indicating that no background color was defined with the Src2ImageOrArrayId parameter. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_NO_REJECTED_DEFINED |
Specifies an unsatisfactory status, indicating that no rejected color was defined with the Src2ImageOrArrayId parameter. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_NO_SELECTED_DEFINED |
Specifies an unsatisfactory status, indicating that no selected color was defined with the Src2ImageOrArrayId parameter. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_REJECTED_EQUAL_BACKGROUND |
Specifies an unsatisfactory status, indicating that the rejected color equals the background color. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_REJECTED_EQUAL_SELECTED |
Specifies an unsatisfactory status, indicating that the rejected color equals the selected color. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_SELECTED_EQUAL_BACKGROUND |
Specifies an unsatisfactory status, indicating that the selected color equals the background color. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_SUCCESS |
Specifies a successful operation. |
||||||||||||||||||||||||||||||||||||||
M_COVARIANCE |
Calculates the covariance matrix of the source image's color information. (more details...) |
||||||||||||||||||||||||||||||||||||||
Src2ImageOrArrayId |
Specifies the identifier of the buffer that controls how the source pixels are interpreted when performing the covariance calculation. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_NULL |
Specifies to use the entire source image to compute the covariance matrix. |
||||||||||||||||||||||||||||||||||||||
Image buffer identifier |
Specifies the identifier of a data identification image buffer. (more details...) |
||||||||||||||||||||||||||||||||||||||
DestImageOrArrayId |
Specifies the identifier of a 3x3 or 4x3 MIL array buffer, of type float, to store the resulting covariance matrix. (more details...) |
||||||||||||||||||||||||||||||||||||||
StatusPtr |
Returns the resulting status of the M_COVARIANCE operation. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_NO_SOURCE_DEFINED |
Specifies an unsatisfactory status, indicating that there was no pixel in the data identification image that was set to M_SOURCE_LABEL. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_SUCCESS |
Specifies a successful operation. |
||||||||||||||||||||||||||||||||||||||
M_PRINCIPAL_COMPONENT_PROJECTION |
Performs a principal component projection of the source image. (more details...) |
||||||||||||||||||||||||||||||||||||||
Src2ImageOrArrayId |
Specifies the identifier of the buffer that controls how the source pixels are interpreted to calculate the first principal component, which is used to perform the principal component projection. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_NULL |
Specifies to use the entire source image to perform the principal component projection. |
||||||||||||||||||||||||||||||||||||||
Image buffer identifier |
Specifies the identifier of a data identification image buffer. (more details...) |
||||||||||||||||||||||||||||||||||||||
DestImageOrArrayId |
Specifies the identifier of the destination buffer in which to write the principal component results. (more details...) |
||||||||||||||||||||||||||||||||||||||
Array buffer identifier |
Specifies the identifier of a 4x1 MIL array buffer, of type float, to store the resulting projection matrix. (more details...) |
||||||||||||||||||||||||||||||||||||||
Image buffer identifier |
Specifies the identifier of a 1-band image buffer, to store the transformed source image. (more details...) |
||||||||||||||||||||||||||||||||||||||
ControlFlag |
Specifies whether MIL should perform the projection according to the dynamic range (minimum and maximum pixel values) established from all the pixels in the source image, or according to the dynamic range established from only the specified source image pixels (M_SOURCE_LABEL) identified with the data identification image. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_DEFAULT |
Performs the projection according to the dynamic range of all the pixels in the source image. |
||||||||||||||||||||||||||||||||||||||
M_MASK_CONTRAST_ENHANCEMENT |
Performs the projection according to the dynamic range of the pixels identified with the data identification image. (more details...) |
||||||||||||||||||||||||||||||||||||||
StatusPtr |
Returns the resulting status of the M_PRINCIPAL_COMPONENT_PROJECTION operation. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_NO_SOURCE_DEFINED |
Specifies an unsatisfactory status, indicating that there was no pixel in the data identification image that was set to M_SOURCE_LABEL. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_SUCCESS |
Specifies a successful operation. |
||||||||||||||||||||||||||||||||||||||
M_UNSTABLE_POLARITY |
Specifies an unsatisfactory status, indicating that the polarity of the projection is unstable. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_PRINCIPAL_COMPONENTS |
Calculates the principal components of the source image's color information. (more details...) |
||||||||||||||||||||||||||||||||||||||
Src2ImageOrArrayId |
Specifies the identifier of the buffer that controls how the source pixels are interpreted to perform the principal component calculation. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_NULL |
Specifies to use the entire source image to calculate the principal components. |
||||||||||||||||||||||||||||||||||||||
Image buffer identifier |
Specifies the identifier of a data identification image buffer. (more details...) |
||||||||||||||||||||||||||||||||||||||
DestImageOrArrayId |
Specifies the identifier of the destination buffer in which to write the resulting data for each of the three principal components. (more details...) |
||||||||||||||||||||||||||||||||||||||
Array buffer identifier |
Specifies the identifier of a 3x3, 4x3, or 5x3 MIL array buffer, of type float, to store the resulting data. (more details...) |
||||||||||||||||||||||||||||||||||||||
StatusPtr |
Returns the resulting status of the M_PRINCIPAL_COMPONENTS operation. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_NO_SOURCE_DEFINED |
Specifies an unsatisfactory status, indicating that there was no pixel in the data identification image that was set to M_SOURCE_LABEL. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_SUCCESS |
Specifies a successful operation. |
||||||||||||||||||||||||||||||||||||||
M_UNSTABLE_POLARITY |
Specifies an unsatisfactory status, indicating that the direction of the first principal component is unstable. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_UNSTABLE_PRINCIPAL_COMPONENT_2 |
Specifies an unsatisfactory status, indicating that the direction of the third principal component (least important) is unstable. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_UNSTABLE_PRINCIPAL_COMPONENTS_12 |
Specifies an unsatisfactory status, indicating that the direction of the second and third principal components are unstable. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_UNSTABLE_PRINCIPAL_COMPONENTS_012 |
Specifies an unsatisfactory status, indicating that the direction of all principal components are unstable. (more details...) |
Header | Include mil.h. |
Library | Use mil.lib; milcolor.lib. |
DLL | Requires mil.dll; milcolor.dll. |