MIL_DOUBLE Src1ImageBufIdOrConst, | //in |
MIL_DOUBLE Src2ImageBufIdOrConst, | //in |
MIL_ID DstImageBufId, | //in |
MIL_INT64 Operation | //in |
This function performs the specified point-to-point operation on two images, an image and a constant, an image, or a constant, storing results in the specified destination image 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.
Specifies the data source of the first operand. This parameter can be given an image buffer identifier or a constant. When using a constant, it will be considered to have the same type as the destination buffer unless M_FLOAT_PROC or M_FIXED_POINT has been added to the operation type. 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.
Note that logical operations (for example M_AND and M_OR) cannot be performed on a floating-point buffer.
Specifies the data source of the second operand. This parameter can be given an image buffer identifier or a constant. If the selected operation uses only one operand, set this parameter to M_NULL. When using a constant, it will be considered to have the same type as the destination buffer unless M_FLOAT_PROC or M_FIXED_POINT has been added to the operation type. 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.
Note that logical operations (for example M_AND and M_OR) cannot be performed on a floating-point buffer.
Specifies the identifier of the destination of the results. This parameter must be given an image buffer identifier. 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.
Specifies the operation to perform. This parameter should be set in accordance to the operands.
Operations using two image buffer operands are the following:
For specifying the type of operation
|
|||||||||||||||||||||||||||||||||||||||
Value | Description | ||||||||||||||||||||||||||||||||||||||
M_ABS_SUB + |
Subtracts the absolute values of the second image from the corresponding absolute values of the first image. |
||||||||||||||||||||||||||||||||||||||
M_ADD + |
Adds the values of the first image to the corresponding values of the second image. |
||||||||||||||||||||||||||||||||||||||
M_AND + |
Performs a bitwise AND operation between the values of the first and second images. |
||||||||||||||||||||||||||||||||||||||
M_ATAN2 |
Performs the two-argument arctangent function, atan2(x, y), using the first image for the X-coordinates and the second image for the Y-coordinates. This results in the counter-clockwise angle between the image's positive X-axis and each X- and Y-coordinate. MIL establishes the resulting angle according the type of the source image buffer, and its minimum and maximum values. For unsigned buffers, MIL maps 0° to the minimum value of the two images, and 360° to the maximum value plus 1 (for 8-bit buffers, a maximum possible value of 256 maps to 360°). For signed buffers, MIL maps -180° to the minimum value of the two images, and +180° to the maximum value plus 1. For float buffers, MIL expects values between 0 and 1, and maps them to angles between 0° and 360°. (summarize)Performs the two-argument arctangent function, atan2(x, y), using the first image for the X-coordinates and the second image for the Y-coordinates. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_AVG + |
Averages the values of the first and second images. |
||||||||||||||||||||||||||||||||||||||
M_DIV + |
Divides the values of the first image by the values of the second image. Note that dividing a value by 0 will generate a destination pixel with an unpredictable value. This will not generate an error. (summarize)Divides the values of the first image by the values of the second image. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_EXP + |
Raises the values of the first image to the power of the second image's values. |
||||||||||||||||||||||||||||||||||||||
M_LOG + |
Takes the logarithm of the values of the second image, to the base of the values of the first image. |
||||||||||||||||||||||||||||||||||||||
M_MAX |
Compares the values of the first image with the values of the second image, and takes the maximum of the two. |
||||||||||||||||||||||||||||||||||||||
M_MAX_ABS + |
Compares the absolute values of the first image with the absolute values of the second image, and takes the maximum of the two. |
||||||||||||||||||||||||||||||||||||||
M_MIN |
Compares the values of the first image with the values of the second image, and takes the minimum of the two. |
||||||||||||||||||||||||||||||||||||||
M_MIN_ABS + |
Compares the absolute values of the first image with the absolute values of the second image, and takes the minimum of the two. |
||||||||||||||||||||||||||||||||||||||
M_MULT + |
Multiplies the values of the first image with the values of the second image. |
||||||||||||||||||||||||||||||||||||||
M_NAND + |
Performs a bitwise NAND operation between the values of the first and second images. |
||||||||||||||||||||||||||||||||||||||
M_NOR + |
Performs a bitwise NOR operation between the values of the first and second images. |
||||||||||||||||||||||||||||||||||||||
M_OR + |
Performs a bitwise OR operation between the values of the first and second images. |
||||||||||||||||||||||||||||||||||||||
M_SUB + |
Subtracts the values of the second image from the values of the first image (for example, image 1 - image 2). |
||||||||||||||||||||||||||||||||||||||
M_SUB_ABS + |
Takes the absolute value of the result of subtracting the values of the second image from the values of the first image. |
||||||||||||||||||||||||||||||||||||||
M_XNOR + |
Performs a bitwise exclusive NOR operation between the values of the first and second images. |
||||||||||||||||||||||||||||||||||||||
M_XOR + |
Performs a bitwise exclusive OR operation between the first and second images. |
You can add the following value to the above-mentioned values to set the destination buffer to the source value of the selected pixel instead of the pixel's value used in the comparison.
For specifying to save the source value
|
|||||||||||||||||||||||||||||||||||||||
|
Description | ||||||||||||||||||||||||||||||||||||||
M_SOURCE_VALUE |
Specifies to write the source value of the selected pixel into the destination buffer. When corresponding pixels from the two source images are compared based on the specified operation, MimArith() writes the source value of the pixel from the selected image into the destination buffer instead of the value used during the comparison. For example, if combined with M_MAX_ABS, after finding the maximum absolute value between the corresponding pixels in the two source images, MimArith() writes the source value of the bigger absolute value in the destination buffer. (summarize)Specifies to write the source value of the selected pixel into the destination buffer. (more details...) |
For a signed or unsigned destination buffer, the following logical operations will result in either the highest unsigned buffer value (regardless if the buffer is signed) or 0. For a floating-point buffer, the result will either be 0 or 1. Logical operations using two image buffer operands include the following.
For logical operations using two image
buffers
|
|||||||||||||||||||||||||||||||||||||||
Value | Description | ||||||||||||||||||||||||||||||||||||||
M_EQUAL |
Determines if the values of the first and second images are equal. |
||||||||||||||||||||||||||||||||||||||
M_GREATER |
Determines if the values of the first image are greater than the second image. |
||||||||||||||||||||||||||||||||||||||
M_GREATER_OR_EQUAL |
Determines if the values of the first image are greater than or equal to the second image. |
||||||||||||||||||||||||||||||||||||||
M_LESS |
Determines if the values of the first image are less than the second image. |
||||||||||||||||||||||||||||||||||||||
M_LESS_OR_EQUAL |
Determines if the values of the first image are less than or equal to the second image. |
||||||||||||||||||||||||||||||||||||||
M_NOT_EQUAL |
Determines if the values of the first and second images are not equal. |
The following are operations that use an image buffer operand and a constant. If the operation is not commutative, you must pass the constant as either the first or second operand, as can be determined from the predefined operation name.
For operations using one image buffer and a
constant
|
|||||||||||||||||||||||||||||||||||||||
Value | Description | ||||||||||||||||||||||||||||||||||||||
M_ADD_CONST + |
Adds a constant to the values of an image. |
||||||||||||||||||||||||||||||||||||||
M_AND_CONST + |
Performs a bitwise AND operation on the image and a constant. |
||||||||||||||||||||||||||||||||||||||
M_CONST_DIV + |
Divides a constant by the values of an image (for example, constant / image). Note that dividing the constant by 0 will generate a destination pixel with an unpredictable value. This will not generate an error. (summarize)Divides a constant by the values of an image (for example, constant / image). (more details...) |
||||||||||||||||||||||||||||||||||||||
M_CONST_EXP + |
Raises a constant to the power specified by the values of an image. |
||||||||||||||||||||||||||||||||||||||
M_CONST_LOG + |
Takes the logarithm of the values of an image, to the base of a constant (for example LOG constant Image). |
||||||||||||||||||||||||||||||||||||||
M_CONST_PASS |
Copies the constant to each destination pixel. |
||||||||||||||||||||||||||||||||||||||
M_CONST_SUB + |
Subtracts the image from the constant (for example, constant - image). |
||||||||||||||||||||||||||||||||||||||
M_DIV_CONST + |
Divides the values of an image by a constant (for example, image / constant). Note that dividing a value by 0 will generate an error. (summarize)Divides the values of an image by a constant (for example, image / constant). (more details...) |
||||||||||||||||||||||||||||||||||||||
M_EXP_CONST + |
Raises the values of the image to the power specified by the constant. |
||||||||||||||||||||||||||||||||||||||
M_LOG_CONST + |
Takes the logarithm of a constant, to the base of the values of an image (for example LOG image Constant). |
||||||||||||||||||||||||||||||||||||||
M_MAX_CONST |
Compares the values of one image with a constant, and takes the maximum of the two. |
||||||||||||||||||||||||||||||||||||||
M_MIN_CONST |
Compares the values of one image with a constant, and takes the minimum of the two. |
||||||||||||||||||||||||||||||||||||||
M_MULT_CONST + |
Multiplies the values of the image by the constant. |
||||||||||||||||||||||||||||||||||||||
M_NAND_CONST + |
Performs a bitwise NAND operation with an image and a constant. |
||||||||||||||||||||||||||||||||||||||
M_NOR_CONST + |
Performs a bitwise NOR operation with an image and a constant. |
||||||||||||||||||||||||||||||||||||||
M_OR_CONST + |
Performs a bitwise OR operation with an image and a constant. |
||||||||||||||||||||||||||||||||||||||
M_SUB_CONST + |
Subtracts a constant from the values of an image (for example, image - constant). |
||||||||||||||||||||||||||||||||||||||
M_SUB_CONST_ABS + |
Takes the absolute value of the subtraction of a constant value from the values of the first image. |
||||||||||||||||||||||||||||||||||||||
M_XNOR_CONST + |
Performs a bitwise exclusive NOR operation with an image and a constant. |
||||||||||||||||||||||||||||||||||||||
M_XOR_CONST + |
Performs a bitwise exclusive OR operation with an image and a constant. |
You can add one of the following values to the above-mentioned values to specify that the operation is performed in fixed-point or floating-point format.
For specifying to perform operations in fixed-point
or floating-point format
|
|||||||||||||||||||||||||||||||||||||||
|
Description | ||||||||||||||||||||||||||||||||||||||
M_FIXED_POINT |
Forces the operation to be performed in a fixed point format. Operations using this attribute result in an 0.8 fixed-point format for an 8-bit destination. That is, the 8 bits comprise only the fractional portion of the value, and no integer portion. When the destination image buffer is 16-bit, operations that use the M_FIXED_POINT attribute result in an 8.8 fixed-point format (where the eight most-significant bits are the integer portion and the eight least-significant bits are the fractional portion). For a 32-bit destination, the result is in a 16.16 fixed-point format. Note that this attribute cannot be used when using a floating-point destination buffer and it can only be used with M_CONST_DIV, M_DIV and M_DIV_CONST. In addition, this attribute cannot be used in combination with M_FLOAT_PROC. (summarize)Forces the operation to be performed in a fixed point format. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_FLOAT_PROC |
Forces the operation to be performed in floating-point format. Note that, if the destination buffer is not a floating-point buffer, the resulting data of the operation will be truncated accordingly. This attribute cannot be used with M_DIV. In addition, this attribute cannot be used in combination with M_FIXED_POINT. (summarize)Forces the operation to be performed in floating-point format. (more details...) |
For a signed or unsigned destination buffer, the following logical operations will result in either the highest unsigned buffer value (regardless if the buffer is signed) or 0. For a floating-point buffer, the result will either be 0 or 1. Logical operations using one image buffer and a constant include the following.
For logical operations using one image buffer and a
constant
|
|||||||||||||||||||||||||||||||||||||||
Value | Description | ||||||||||||||||||||||||||||||||||||||
M_EQUAL_CONST |
Determines if the values of an image are equal to the specified constant. |
||||||||||||||||||||||||||||||||||||||
M_GREATER_CONST |
Determines if the values of an image are greater than the specified constant. |
||||||||||||||||||||||||||||||||||||||
M_GREATER_OR_EQUAL_CONST |
Determines if the values of an image are greater than or equal to the specified constant. |
||||||||||||||||||||||||||||||||||||||
M_LESS_CONST |
Determines if the values of an image are less than the specified constant. |
||||||||||||||||||||||||||||||||||||||
M_LESS_OR_EQUAL_CONST |
Determines if the values of an image are less than or equal to the specified constant. |
||||||||||||||||||||||||||||||||||||||
M_NOT_EQUAL_CONST |
Determines if the values of an image are not equal to the specified constant. |
Operations using only one image buffer operand are the following:
For operations using one image buffer
|
|||||||||||||||||||||||||||||||||||||||
Value | Description | ||||||||||||||||||||||||||||||||||||||
M_ABS |
Takes the absolute value of the image values. |
||||||||||||||||||||||||||||||||||||||
M_CUBE + |
Raises the image values to the power of 3 ( x 3 ). |
||||||||||||||||||||||||||||||||||||||
M_INTEGRAL + |
Takes the integral of the image. This computes the cumulative sum of the source image at the corresponding pixels in the destination. Each pixel in the destination buffer contains the total sum of the pixels in the rectangular sections delimited by the pixel at (0, 0) and itself, inclusively. (summarize)Takes the integral of the image. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_LN + |
Performs a natural logarithm on the image values. |
||||||||||||||||||||||||||||||||||||||
M_LOG2 + |
Performs a base-2 logarithm on the image values. |
||||||||||||||||||||||||||||||||||||||
M_LOG10 + |
Performs a base-10 logarithm on the image values. |
||||||||||||||||||||||||||||||||||||||
M_NEG |
Performs a unary negation operation (2's complement) on an image. For example, if a pixel has a binary value of 0x01000000 (corresponding to a decimal value of 64 in a signed buffer) and you perform an M_NEG operation on it, the resulting value will be 0x11000000 (corresponding to a decimal value of -64). This operation is buffer dependent. That is, a signed buffer with a value of 64 will be converted to -64, whereas an unsigned buffer with a value of 64 will be converted to 192. (summarize)Performs a unary negation operation (2's complement) on an image. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_NOT + |
Performs a bitwise NOT operation (1's complement) on an image. For example, if a pixel has a binary value of 0x01000000 (corresponding to a decimal value of 64 in an unsigned buffer) and you perform an M_NOT operation on it, the resulting value will be 0x10111111 (corresponding to a decimal value of 191). This operation is buffer dependent. That is, a signed buffer with a value of 64 will be converted to -63, whereas an unsigned buffer with a value of 64 will be converted to 191. (summarize)Performs a bitwise NOT operation (1's complement) on an image. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_PASS |
Copies the source buffer to the destination image buffer. |
||||||||||||||||||||||||||||||||||||||
M_SQUARE + |
Raises the image values to the power of 2 ( x 2 ). |
||||||||||||||||||||||||||||||||||||||
M_SQUARE_ROOT + |
Performs a square root operation on the image values. |
You can add the following value to the above-mentioned values to specify to use the logical operation rather than the bitwise operation.
For specifying to perform logical
operations
|
|||||||||||||||||||||||||||||||||||||||
|
Description | ||||||||||||||||||||||||||||||||||||||
M_LOGICAL |
Specifies to use the logical operation rather than the bitwise operation. The bitwise operation performs the specified operation on each binary digit. The logical operation determines the boolean state of the image pixel or constant based on whether it is equal to 0, and then performs the specified operation on that boolean state. In the destination buffer, a result of TRUE or FALSE is represented as 1 or 0, respectively. Specifies to use the logical operation rather than the bitwise operation. (more details...) |
You can add the following value to the above-mentioned values to specify that the operation result should be saturated if necessary.
For specifying to saturate results that overflow or
underflow
|
|||||||||||||||||||||||||||||||||||||||
|
Description | ||||||||||||||||||||||||||||||||||||||
M_SATURATION |
Forces the operation to saturate any resulting pixel values that overflow or underflow the possible range of the destination buffer. The pixel values are clipped to fit within the buffer's range, rather than wrapped around the range. If you do not specify M_SATURATION and there is an overflow or underflow, the resulting pixel values are either clipped (saturated) or wrapped around the buffer's range (not saturated), depending on which is faster for your hardware. (summarize)Forces the operation to saturate any resulting pixel values that overflow or underflow the possible range of the destination buffer. (more details...) |
Header | Include mil.h. |
Library | Use mil.lib; milim.lib. |
DLL | Requires mil.dll; milim.dll. |