Arithmetic Operations
add
First input array or scalar
Second input array or scalar
Output array with the same size and number of channels as input arrays
Optional 8-bit single channel mask that specifies elements to be changed
Optional depth of the output array. Default is -1 (same as input)
Saturation is not applied when the output array has depth CV_32S. You may get incorrect sign in case of overflow.
subtract
First input array or scalar
Second input array or scalar
Output array
Optional operation mask
Optional depth of the output array
multiply
First input array
Second input array of the same size and type as src1
Output array
Optional scale factor
Optional depth of the output array
For matrix multiplication (not element-wise), use gemm() function.
divide
First input array (numerator)
Second input array (denominator)
Scalar factor
Output array
scaleAdd
First input array
Scale factor for the first array
Second input array (same size and type as src1)
Output array
addWeighted
First input array
Weight of the first array elements
Second input array
Weight of the second array elements
Scalar added to each sum
Output array
Bitwise Operations
bitwise_and
First input array or scalar
Second input array or scalar
Output array
Optional operation mask
bitwise_or
bitwise_xor
bitwise_not
Input array
Output array
Comparison Operations
compare
First input array or scalar
Second input array or scalar
Output array of type CV_8U (0 or 255 values)
Comparison operation: CMP_EQ, CMP_GT, CMP_GE, CMP_LT, CMP_LE, CMP_NE
min
max
inRange
Input array
Inclusive lower boundary array or scalar
Inclusive upper boundary array or scalar
Output array of type CV_8U (0 or 255)
Mathematical Operations
sqrt
pow
Input array
Exponent of power
Output array
exp
log
absdiff
magnitude
Floating-point array of x-coordinates
Floating-point array of y-coordinates (same size as x)
Output array of magnitudes
phase
Array of x-coordinates (floating-point)
Array of y-coordinates (same size and type as x)
Output array of angles
When true, angles are in degrees (0-360), otherwise radians (0-2π)
cartToPolar
polarToCart
Array of vector magnitudes
Array of vector angles
Output array of x-coordinates
Output array of y-coordinates
Matrix Operations
gemm
First input matrix
Second input matrix
Weight for src1 * src2
Third input matrix (added to product)
Weight for src3
Output matrix
Operation flags: GEMM_1_T (transpose src1), GEMM_2_T (transpose src2), GEMM_3_T (transpose src3)
transpose
transform
Input array (must be continuous)
Output array
Transformation matrix (2x2, 2x3, 3x3, or 3x4 for 2D, 3x3 or 3x4 for 3D)
mulTransposed
Input matrix
Output square matrix
If true, computes src^T * src; if false, computes src * src^T
Optional delta matrix subtracted from src before multiplication
Optional scale factor for the matrix product
Array Manipulation
flip
Input array
Output array
Flip type: 0 (vertical flip), positive (horizontal flip), negative (both axes)
rotate
Rotation type: ROTATE_90_CLOCKWISE, ROTATE_180, ROTATE_90_COUNTERCLOCKWISE
repeat
Number of times to repeat along the vertical axis
Number of times to repeat along the horizontal axis
hconcat
vconcat
Channel Operations
split
Input multi-channel array
Output vector of arrays
merge
mixChannels
Array of index pairs: fromTo[k2] is source channel, fromTo[k2+1] is destination channel
Channel indexing starts from 0. Use -1 to set a channel to zero.
