| Customize Help
| Save Settings

MbufCopyColor2d



Function Map
Synopsis
Copy a two-dimensional region of one or all bands of an image buffer to another buffer.
Syntax
void MbufCopyColor2d(
MIL_ID SrcBufId, //in
MIL_ID DstBufId, //in
MIL_INT SrcBand, //in
MIL_INT SrcOffX, //in
MIL_INT SrcOffY, //in
MIL_INT DstBand, //in
MIL_INT DstOffX, //in
MIL_INT DstOffY, //in
MIL_INT SizeX, //in
MIL_INT SizeY //in
)
Description

This function copies a two-dimensional region of one or all color bands of the specified source buffer to the specified color band(s) of the destination buffer. It can also be used to retrieve or replace a color component from a color buffer.

If the source is a monochrome buffer and the destination is a multi-band (color) buffer, the unique source buffer band is inserted into the specified band of the destination buffer. If the source is a multi-band buffer and the destination is a monochrome buffer, the specified source buffer band is extracted from the source buffer and written to the destination buffer. If both are multi-band buffers, the specified band(s) is copied from the source to the destination.

If the source buffer depth is greater than that of the destination, the most significant bits are truncated when the data is copied to the destination. If the destination depth is greater than that of the source, the source data is zero or sign-extended (depending on the type of the source) when copied to the destination. Also, the buffers must have the same number of bands if all bands are to be copied.

Note that when copying from a non-binary buffer to a binary destination buffer, all non-zero pixels in the source buffer are represented as ones (1) in the binary destination buffer. When copying a binary buffer to a buffer of a different depth, each bit is copied into the least-significant bit of a different destination pixel. The remaining bits of the destination pixel are set to 0; to propagate the bit value to all bits, use MimBinarize().

Note, if the source is a 1-band image buffer associated with a LUT buffer and the destination is a 3-band image buffer, the source data copied to destination is first mapped through the LUT.

Note that when copying into the U or V band of a YUV destination buffer, the dimensions of the U or V band of the destination buffer must not be smaller than the dimensions of the source buffer.

You can limit this function's results to a region of an image buffer using a region of interest (ROI) set using MbufSetRegion(). The ROI must be defined in raster format (M_RASTER or M_VECTOR_AND_RASTER). An error is generated if the ROI is only in vector format (M_VECTOR). If you specify multiple image buffers with an ROI, results are limited to the portion of the ROIs that intersect.

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 if there is complementary information.
Parameters
This function is not supported on the selected boards.
Parameters
SrcBufId

Specifies the identifier of the source data buffer.

If you specify an image buffer that has an ROI associated with it, the ROI must be in raster format; otherwise, you will get an error.

DstBufId

Specifies the identifier of the destination data buffer.

If you specify an image buffer that has an ROI associated with it, the ROI must be in raster format; otherwise, you will get an error.

SrcBand

Specifies the source color band from which to copy. SrcBand can be set to one of the following values:

function map For the source color band
Click to summarizeValue Description
Click to summarize M_ALL_BANDS

Specifies all color bands (for RGB, HSL, HSV, and YUV buffers).

Click to summarize M_BLUE

Specifies the blue color band (for RGB buffers).

Click to summarize M_GREEN

Specifies the green color band (for RGB buffers).

Click to summarize M_HUE

Specifies the hue band (for HSL and HSV buffers).

Click to summarize M_LUMINANCE

Specifies the luminance band (for HSL buffers).

Click to summarize M_RED

Specifies the red color band (for RGB buffers).

Click to summarize M_SATURATION

Specifies the saturation band (for HSL and HSV buffers).

Click to summarize M_U

Specifies the U band (for YUV buffers).

Click to summarize M_V

Specifies the V band (for YUV and HSV buffers).

Click to summarize M_Y

Specifies the Y band (for YUV buffers).

Click to summarize 0 <= Value <= 2

Specifies the index of the band to copy.

The relationship between index value and band for RGB, HSL, HSV, and YUV buffers is the following:

0

Corresponds to the red band for RGB buffers, the hue band for HSL and HSV buffers, or the Y band for YUV buffers.

1

Corresponds to the green band for RGB buffers, or the saturation band for HSL and HSV buffers, or the U band for YUV buffers.

2

Corresponds to the blue band for RGB buffers, or the luminance band for HSL buffers, or the V band for YUV and HSV buffers.

(summarize)
SrcOffX

Specifies the horizontal pixel offset of the region to read relative to the source buffer starting coordinate. The offset must be within the width of the source buffer.

SrcOffY

Specifies the vertical pixel offset of the region to read relative to the source buffer starting coordinate. The offset must be within the height of the source buffer.

DstBand

Specifies the destination color band in which to copy. DstBand can be set to the same values as SrcBand.

DstOffX

Specifies the horizontal pixel offset of the region to write relative to the destination buffer starting coordinate. The offset must be within the width of the destination buffer.

DstOffY

Specifies the vertical pixel offset of the region to write relative to the destination buffer starting coordinate. The offset must be within the height of the destination buffer.

SizeX

Specifies the width of the region to be copied, starting from the specified offset (SrcOffX, DstOffX).

SizeY

Specifies the height of the region to be copied, starting from the specified offset (SrcOffY, DstOffY).

Compilation information
Header Include mil.h.
Library Use mil.lib.
DLL Requires mil.dll.
VECTOR VECTOR ALL BANDS BLUE GREEN HUE LUMINANCE RED SATURATION U V Y ALL BANDS BLUE GREEN HUE LUMINANCE RED SATURATION U V Y