MIL_ID GraphContId, | //in |
MIL_ID ContextOrResultId, | //in |
MIL_ID DestImageBufId, | //in |
MIL_INT64 DrawOperation, | //in |
MIL_INT AreaLabel, | //in |
MIL_INT SampleIndexOrLabel, | //in |
MIL_INT64 ControlFlag | //in |
This function draws specific features of a selected color-sample (defined in a specified color matching or relative color calibration context), color element (defined in a specified color-sample), or of a color matching result, in the destination image buffer. Drawing operations for color matching results are only available after calling McolMatch().
Color-samples or color elements are drawn using either their triplet values (M_TRIPLET) or their estimated values (for example, the average) taken from a source image (M_IMAGE), depending on how you defined them (McolDefine()).
Specifies the identifier of the 2D graphics context to use when drawing. Set this parameter to one of the following values:
For specifying the 2D graphics context
|
|||||||||||||||||||||||||||||||||||||||
Value | Description | ||||||||||||||||||||||||||||||||||||||
M_DEFAULT |
Specifies that the default 2D graphics context of the current MIL application is used. Note that there is a different default 2D graphics context for each thread. (summarize)Specifies that the default 2D graphics context of the current MIL application is used. (more details...) |
||||||||||||||||||||||||||||||||||||||
MIL 2D graphics context identifier |
Specifies a valid 2D graphics context identifier, which you have allocated using MgraAlloc(). |
Specifies the context or result buffer for which to perform the drawing operation. The context or result buffer must have been previously allocated on the system using McolAlloc() (with M_COLOR_MATCHING or M_COLOR_CALIBRATION_RELATIVE) or McolAllocResult(), respectively.
Specifies the identifier of the destination image buffer in which to draw. The buffer can be any supported MIL image buffer. By drawing into its display's overlay buffer, you can also annotate the image non-destructively.
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 required format and size of the destination image depends on the drawing operation. For a color element, you can retrieve the required format and size using McolInquire() (for example, M_SAMPLE_IMAGE_SIZE_X). For a color matching result, you can retrieve this information using McolGetResult() (for example, M_AREA_IMAGE_SIZE_X). When drawing the mosaic of all color elements within a color-sample, you can retrieve the required information using McolInquire() (for example, M_SAMPLE_MOSAIC_SIZE_X).
The bit depth of the image buffer must accommodate all the color-sample or color element data drawn, including the background color, the outlier color, and the outlier label (when applicable).
The numerical value of the color-sample labels, the background pixels, and the outlier pixels and labels should be different so you can easily identify them if they are drawn (M_DRAW...). To modify these values, use McolControl() with M_SAMPLE_LABEL_VALUE, M_BACKGROUND_DRAW_COLOR, M_OUTLIER_DRAW_COLOR and M_OUTLIER_LABEL. Note that a pixel is considered background when it is outside the target areas, while outlier pixels are pixels inside a target area that did not match with any color-sample.
For a color matching result, the background of the destination image is set to the background color (McolControl() with M_BACKGROUND_DRAW_COLOR) that is in effect when you call McolMatch(). If you set a transparent background, the image background remains untouched.
Specifies the type of drawing operation to perform.
For a selected color-sample, set this parameter to one of the following values:
For drawing specific features of a
color-sample
|
|||||||||||||||||||||||||||||||||||||||
Value | Description | ||||||||||||||||||||||||||||||||||||||
M_DRAW_SAMPLE_MOSAIC |
Draws the mosaic of all the color elements found in the specified color-sample. If there is only one color element in the sample, M_DRAW_SAMPLE_MOSAIC will essentially perform the same operation as M_DRAW_SAMPLE. (summarize)Draws the mosaic of all the color elements found in the specified color-sample. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_DRAW_SAMPLE_MOSAIC_DONT_CARE |
Draws a mosaic mask of all "don't care" pixels in the specified color-sample. All non-zero destination pixels correspond to either a region in-between color data or to a color data mask. All destination pixels set to zero correspond to non-masked color data. (summarize)Draws a mosaic mask of all "don't care" pixels in the specified color-sample. (more details...) |
For a selected color element (of a selected color-sample), set this parameter to one of the following values:
For drawing specific features of a color
element
|
|||||||||||||||||||||||||||||||||||||||
Value | Description | ||||||||||||||||||||||||||||||||||||||
M_DRAW_SAMPLE |
Draws the internal image of the specified color element in the destination image buffer. If you defined a triplet color element, M_DRAW_SAMPLE fills the destination image buffer with the color of the triplet. The triplet values are saturated according to the destination buffer depth. If you do not specify the index or label of a specific color element, the first color element in the specified color-sample will be drawn. (summarize)Draws the internal image of the specified color element in the destination image buffer. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_DRAW_SAMPLE_MASK |
Draws the mask image of the specified color element in the destination image buffer. You can only perform this operation on M_IMAGE color-samples masked with McolMask(). To inquire if a color-sample has a mask, use McolInquire() with M_SAMPLE_MASKED. If you do not specify the index or label of a specific color element, the first color element in the specified color-sample will be drawn. (summarize)Draws the mask image of the specified color element in the destination image buffer. (more details...) |
For a color matching result buffer, set this parameter to one of the following values.
For drawing specific features of a color matching
result
|
|||||||||||||||||||||||||||||||||||||||
Value | Description | ||||||||||||||||||||||||||||||||||||||
M_DRAW_AREA |
Draws the specified area(s) (AreaLabel) of the area identifier image. If you specify a single target area, the background of the destination image (DestImageBufId) is untouched; if you specify M_ALL, the whole area identifier image, including a 0 background, is copied to the destination image. To perform this drawing operation, you must have first enabled McolControl() with M_SAVE_AREA_IMAGE, and called McolMatch(). (summarize)Draws the specified area(s) (AreaLabel) of the area identifier image. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_DRAW_AREA_MATCH_USING_COLOR + |
Draws, for each target area, the color of the best-matched color-sample. The background color and outlier color are also drawn; to modify these values, use McolControl() with M_BACKGROUND_DRAW_COLOR and M_OUTLIER_DRAW_COLOR, respectively. To perform this drawing operation, you must have first enabled McolControl() with M_SAVE_AREA_IMAGE and M_GENERATE_SAMPLE_COLOR_LUT, and called McolMatch(). (summarize)Draws, for each target area, the color of the best-matched color-sample. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_DRAW_AREA_MATCH_USING_LABEL |
Draws, for each target area, the label of the best-matched color-sample. The background color and outlier label are also drawn; to modify these values, use McolControl() with M_BACKGROUND_DRAW_COLOR and M_OUTLIER_LABEL, respectively. To perform this drawing operation, you must have first enabled McolControl() with M_SAVE_AREA_IMAGE, and called McolMatch(). (summarize)Draws, for each target area, the label of the best-matched color-sample. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_DRAW_DISTANCE |
Draws the distance between the estimated color (average color) of the target area (for an M_STAT_MIN_DIST operation mode) or the color of the target pixel (for an M_MIN_DIST_VOTE operation mode), and the color of its best-matched color-sample. Operation modes are set with McolSetMethod(). The background color and outlier color are also drawn; to modify these values, use McolControl() with M_BACKGROUND_DRAW_COLOR and M_OUTLIER_DRAW_COLOR, respectively. To perform this drawing operation, you must have first enabled McolControl() with M_GENERATE_DISTANCE_IMAGE, and called McolMatch(). To draw normalized distances, use McolControl() with M_DISTANCE_IMAGE_NORMALIZE before drawing. The outlier color, which is also drawn with M_DRAW_DISTANCE, can be difficult to identify if it is similar to the resulting distance. For example, if the outlier color is 0.0, you wouldn't be able to distinguish it if the resulting distance is also 0.0. In this case, you can use M_DRAW_..._USING_LABEL, which draws the outlier label. M_DRAW_DISTANCE is not available if the operation mode is set to M_HISTOGRAM_MATCHING or M_HISTOGRAM_VOTE (McolSetMethod()). (summarize)Draws the distance between the estimated color (average color) of the target area (for an M_STAT_MIN_DIST operation mode) or the color of the target pixel (for an M_MIN_DIST_VOTE operation mode), and the color of its best-matched color-sample. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_DRAW_PIXEL_MATCH_USING_COLOR + |
Draws, for each pixel in each target area, the color of the color-sample for which each pixel voted. The background color and outlier color are also drawn; to modify these values, use McolControl() with M_BACKGROUND_DRAW_COLOR and M_OUTLIER_DRAW_COLOR, respectively. To perform this drawing operation, you must have first enabled McolControl() with M_GENERATE_PIXEL_MATCH and M_GENERATE_SAMPLE_COLOR_LUT, and called McolMatch(). You must have also used McolSetMethod() with M_MIN_DIST_VOTE. (summarize)Draws, for each pixel in each target area, the color of the color-sample for which each pixel voted. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_DRAW_PIXEL_MATCH_USING_LABEL |
Draws, for each pixel in each target area, the label of the color-sample for which each pixel voted. The background color and outlier label are also drawn; to modify these values, use McolControl() with M_BACKGROUND_DRAW_COLOR and M_OUTLIER_LABEL, respectively. To perform this drawing operation, you must have first enabled McolControl() with M_GENERATE_PIXEL_MATCH, and called McolMatch(). You must also use have used McolSetMethod() with M_MIN_DIST_VOTE. (summarize)Draws, for each pixel in each target area, the label of the color-sample for which each pixel voted. (more details...) |
For either a color matching context or color matching result, set this parameter to the following value:
For drawing specific features of either a
color-sample or a color matching result (for color
matching)
|
|||||||||||||||||||||||||||||||||||||||
Value | Description | ||||||||||||||||||||||||||||||||||||||
M_DRAW_SAMPLE_COLOR_LUT + |
Draws the 3-band color-sample label LUT, where the label value of each color-sample is associated with its average color. The average colors are calculated using the color data that you provided when defining the color-sample (McolDefine()). The calculation takes into account all three bands, regardless of the setting of McolControl() with M_BAND_MODE. To perform this operation for color matching results, you must have first enabled McolControl() with M_GENERATE_SAMPLE_COLOR_LUT, and called McolMatch(). M_DRAW_SAMPLE_COLOR_LUT requires that you set the SampleIndexOrLabel parameter to M_ALL or M_DEFAULT. When using M_DRAW_SAMPLE_COLOR_LUT, the destination image buffer (DestImageBufId) must be a 3-band, 8-bit unsigned LUT buffer, with a size of N x 1, where N is equal to the M_SAMPLE_LUT_SIZE_X inquire type (McolInquire()). You can associate this color-sample label LUT to either a display using MdispLut(), or to an image buffer using MbufControl() with M_ASSOCIATED_LUT. (summarize)Draws the 3-band color-sample label LUT, where the label value of each color-sample is associated with its average color. (more details...) |
You can add the following value to the above-mentioned values to specify whether to invert colors.
For specifying whether to invert colors
|
|||||||||||||||||||||||||||||||||||||||
Combination value | Description | ||||||||||||||||||||||||||||||||||||||
M_INVERTED_COLORS |
Inverts the color of the best-matched color-sample in the specified image. |
Specifies the label of the target area for which to perform the drawing operation, for color matching contexts. For a relative color calibration context, there are no target areas; you must specify M_DEFAULT.
Set this parameter to one of the following values:
For specifying the target area's label or index (for
color matching)
|
|||||||||||||||||||||||||||||||||||||||
Value | Description | ||||||||||||||||||||||||||||||||||||||
M_DEFAULT |
Specifies the default. For a color matching context, the default is the same as M_ALL. For a relative color calibration context, the default indicates that this information is not required. (summarize)Specifies the default. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_ALL |
Specifies all target areas. You should specify M_ALL if you did not use an area identifier image (M_NULL) with McolMatch(). This value is only available for color matching contexts. (summarize)Specifies all target areas. (more details...) |
||||||||||||||||||||||||||||||||||||||
Value > 0 |
Specifies the label of the target area, as it appears in the area identifier image. When specifying a specific target area's label, you must use McolControl() with M_SAVE_AREA_IMAGE set to M_ENABLE. This value is only available for color matching contexts. (summarize)Specifies the label of the target area, as it appears in the area identifier image. (more details...) |
Specifies the color-sample or color element therein for which to perform the drawing operation. Unless otherwise specified, values apply to both color matching and relative color calibration contexts. Set this parameter to one of the following values:
For specifying the color-sample or color
element
|
|||||||||||||||||||||||||||||||||||||||
Value | Description | ||||||||||||||||||||||||||||||||||||||
M_DEFAULT |
Same as M_ALL. |
||||||||||||||||||||||||||||||||||||||
Specifies the index of a color element (item), relative to the reference color-sample. This value only applies to relative color calibration contexts (ContextOrResultId). (summarize)Specifies the index of a color element (item), relative to the reference color-sample. (more details...) |
|||||||||||||||||||||||||||||||||||||||
Parameters | |||||||||||||||||||||||||||||||||||||||
Specifies the index of a color element (item). The index value must be greater than or equal to 0. |
|||||||||||||||||||||||||||||||||||||||
Specifies the color-sample's index, in a color context or result. (summarize)Specifies the color-sample's index, in a color context or result. (more details...) |
|||||||||||||||||||||||||||||||||||||||
Parameters | |||||||||||||||||||||||||||||||||||||||
Specifies an index value greater than or equal to 0. |
|||||||||||||||||||||||||||||||||||||||
Specifies the index of a color element (item), relative to a color-sample index. (summarize)Specifies the index of a color element (item), relative to a color-sample index. (more details...) |
|||||||||||||||||||||||||||||||||||||||
Parameters | |||||||||||||||||||||||||||||||||||||||
Specifies the index of the color-sample that holds the color element (item). The index must be greater than or equal to 0. |
|||||||||||||||||||||||||||||||||||||||
Specifies the index of the color element (item). The index value must be greater than or equal to 0. |
|||||||||||||||||||||||||||||||||||||||
Specifies the label of a color-sample. To use this value, you must typically enable McolControl() with M_GENERATE_PIXEL_MATCH. However, you need not do this when performing an M_DRAW_AREA_MATCH_USING_LABEL or M_DRAW_AREA_MATCH_USING_COLOR drawing operation. (summarize)Specifies the label of a color-sample. (more details...) |
|||||||||||||||||||||||||||||||||||||||
Parameters | |||||||||||||||||||||||||||||||||||||||
Specifies a label value greater than 0. |
|||||||||||||||||||||||||||||||||||||||
Specifies the index of a color element (item), relative to a color-sample label. (summarize)Specifies the index of a color element (item), relative to a color-sample label. (more details...) |
|||||||||||||||||||||||||||||||||||||||
Parameters | |||||||||||||||||||||||||||||||||||||||
Specifies the label of the color-sample that holds the color element (item). The label value must be greater than 0. |
|||||||||||||||||||||||||||||||||||||||
Specifies the index of the color element (item). The index value must be greater than or equal to 0. |
|||||||||||||||||||||||||||||||||||||||
M_ALL |
Specifies all color-samples. When specifying a color matching context, you can only use M_ALL with M_DRAW_SAMPLE_COLOR_LUT. When specifying a specific color-sample (in either a color matching or relative color calibration context), you can only use M_ALL with M_DRAW_SAMPLE and M_DRAW_SAMPLE_MASK. You can use M_ALL with any operation that a color matching result buffer supports. (summarize)Specifies all color-samples. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_REFERENCE_SAMPLE |
Specifies the reference color-sample. This value only applies to relative color calibration contexts. (summarize)Specifies the reference color-sample. (more details...) |
Header | Include mil.h. |
Library | Use mil.lib; milcolor.lib. |
DLL | Requires mil.dll; milcolor.dll. |