MimArith()函数

MimArith()函数

Synopsis

Perform a point-to-point arithmetic operation.

Format

void MimArith(Src1ImageBufId, Src2ImageBufId, DestImageBufId, Operation)

double Src1ImageBufId;??? Source 1 image buffer identifier or a constant
double Src2ImageBufId;??? Source 2 image buffer identifier or a constant
MIL_ID DestImageBufId;??? Destination image buffer identifier
long Operation;??? Operation to perform

Description

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.
The Src1ImageBufId parameter 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.
The Src2ImageBufId parameter 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.

The DestImageBufId parameter specifies the identifier of the destination of the results. This parameter must be given an image buffer identifier.
The Operation parameter specifies the operation to perform. This parameter should be set in accordance to the operand types. Operations using two image buffer operands are the following:

M_ADD??? M_SUB??? M_AND
M_NAND??? M_OR??? M_XOR
M_NOR??? M_XNOR???? M_MIN
M_MAX??? M_MAX_CONST??? M_MULT
M_DIV??? M_SUB_ABS??? M_DIV+M_FIXED_POINT
The following are operations that use an image buffer operand and a constant. If the operation is not commutative, you must give the constant as either the first or second operand, as can be determined from the predefined operation name.

M_ADD_CONST??? M_SUB_CONST??? M_CONST_SUB
M_AND_CONST??? M_NAND_CONST??? M_OR_CONST
M_XOR_CONST??? M_NOR_CONST??? M_XNOR_CONST
M_MIN_CONST??? M_MAX_CONST??? M_MULT_CONST
M_DIV_CONST??? M_CONST_DIV??? M_DIV_CONST+M_FIXED_POINT
M_CONST_DIV+M_FIXED_POINT
Operations using only one image buffer operand are the following:

M_NOT??? M_NEG??? M_ABS??? M_PASS
The operation using only a constant is the following:

M_CONST_PASS??? (fills the destination with a constant).
Operations with extension “.abs” give the absolute value of the operation result. Operations combined with M_FIXED_POINT provide the 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 16-bit destination. For a 32-bit destination, the result is in a 16.16 fixed-point format.
Logical operations (listed below) cannot be performed on a floating-point buffer.

M_OR??? M_AND??? M_XOR
M_NOR??? M_NAND??? M_XNOR
M_OR_CONST??? M_AND_CONST??? M_XOR_CONST
M_NOR_CONST??? M_NAND_CONST??? M_XNOR_CONST
M_NOT??? M_CONST_DIV+M_FIXED_POINT
M_DIV+M_FIXED_POINT??? M_DIV_CONST+M_FIXED_POINT
To force certain operations to saturate when the resulting value overflows or underflows add M_SATURATION to the operation name (for example, M_ADD+M_SATURATION). The following operations can be used this way:

M_ADD??? M_ADD_CONST??? M_SUB
M_SUB_ABS??? M_SUB_CONST??? M_CONST_SUB
M_MULT??? M_MULT_CONST

Note

This function is optimized for packed binary buffers.

Status

In-place processing is supported (source equals destination), but the source and destination image buffers cannot partially overlap (a situation that can only occur when using child buffers).

注:此函数为图像点到点的数学操作,可以用逻辑运算(OR,NOR,NOT,XNOR,XOR,AND,NAND等、可以用四则运算(ADD,SUB,MULT,DIV),带有CONST参数时,代码图像与数值做运算,此时输入参数第二个是数值。