Statistical Functions
sum
InputArray
Input array (1 to 4 channels)
Scalar
Sum of all array elements for each channel
mean
InputArray
Input array (1 to 4 channels)
InputArray
Optional operation mask (8-bit single channel)
Scalar
Mean value for each channel
meanStdDev
InputArray
Input array (1 to 4 channels)
OutputArray
Output parameter: calculated mean value
OutputArray
Output parameter: calculated standard deviation
InputArray
Optional operation mask
minMaxLoc
InputArray
Input single-channel array
double*
Pointer to returned minimum value (can be NULL)
double*
Pointer to returned maximum value (can be NULL)
Point*
Pointer to returned minimum location (can be NULL)
Point*
Pointer to returned maximum location (can be NULL)
InputArray
Optional mask to select a sub-array
norm
InputArray
First input array
InputArray
Second input array (for difference norms)
int
Type of norm: NORM_INF, NORM_L1, NORM_L2, NORM_L2SQR, NORM_HAMMING, NORM_HAMMING2
InputArray
Optional operation mask
double
Calculated norm value
NORM_INF: max(|x_i|)NORM_L1: Σ|x_i|NORM_L2: √(Σx_i²)NORM_L2SQR: Σx_i²
normalize
InputArray
Input array
InputOutputArray
Output array (same size as src)
double
Norm value to normalize to or lower range boundary in range normalization
double
Upper range boundary in range normalization (not used for norm normalization)
int
Normalization type: NORM_INF, NORM_L1, NORM_L2, or NORM_MINMAX
int
Optional depth of output array
InputArray
Optional operation mask
countNonZero
InputArray
Single-channel array
int
Number of non-zero elements
hasNonZero
bool
True if at least one non-zero element exists
findNonZero
InputArray
Single-channel array (8-bit or floating-point)
OutputArray
Output array of Point locations (N×1 or 1×N)
Reduction Operations
reduce
InputArray
Input array
OutputArray
Output vector
int
Dimension to reduce: 0 (reduce to single row), 1 (reduce to single column)
int
Reduction operation: REDUCE_SUM, REDUCE_AVG, REDUCE_MAX, REDUCE_MIN, REDUCE_SUM2
int
Optional depth of output array
REDUCE_SUM: Sum of all rows/columnsREDUCE_AVG: Mean of all rows/columnsREDUCE_MAX: Maximum of all rows/columnsREDUCE_MIN: Minimum of all rows/columnsREDUCE_SUM2: Sum of squared values
reduceArgMin
InputArray
Input array
OutputArray
Output array of indices
int
Dimension to reduce along
bool
Whether to return last index in case of multiple minimum values
reduceArgMax
Sorting
sort
InputArray
Input single-channel array
OutputArray
Output array (same size and type as src)
int
Operation flags: SORT_EVERY_ROW, SORT_EVERY_COLUMN, SORT_ASCENDING, SORT_DESCENDING
sortIdx
OutputArray
Output integer array of sorted indices
Linear Algebra
determinant
InputArray
Input matrix (must be square)
double
Determinant value
trace
InputArray
Input matrix
Scalar
Trace of the matrix
invert
InputArray
Input floating-point matrix
OutputArray
Output matrix of the same size and type as src
int
Inversion method: DECOMP_LU, DECOMP_SVD, DECOMP_CHOLESKY
double
Reciprocal condition number (for SVD) or 0 if singular
DECOMP_LU: LU decomposition (fastest for well-conditioned matrices)DECOMP_SVD: Singular value decomposition (works for singular matrices)DECOMP_CHOLESKY: Cholesky decomposition (for symmetric positive-definite matrices)
solve
InputArray
Coefficient matrix (A in Ax=b)
InputArray
Right-hand side matrix (b in Ax=b)
OutputArray
Output solution (x in Ax=b)
int
Solution method: DECOMP_LU, DECOMP_SVD, DECOMP_CHOLESKY, DECOMP_QR, DECOMP_NORMAL
bool
True if solution exists
eigen
InputArray
Input symmetric square matrix
OutputArray
Output vector of eigenvalues (in descending order)
OutputArray
Output matrix of eigenvectors (one per row)
bool
True if successful
This function is optimized for symmetric matrices. For general matrices, use eigenNonSymmetric().
calcCovarMatrix
InputArray
Input samples (each row or column is a sample)
OutputArray
Output covariance matrix
InputOutputArray
Input or output mean vector
int
Operation flags: COVAR_SCRAMBLED, COVAR_NORMAL, COVAR_USE_AVG, COVAR_SCALE, COVAR_ROWS, COVAR_COLS
int
Type of output matrices (CV_32F or CV_64F)
Timing and Profiling
getTickCount
int64
Current tick count
getTickFrequency
double
Tick frequency in Hz
TickMeter
System Information
getNumberOfCPUs
setNumThreads
int
Number of threads. Use 0 or negative values to reset to default
getNumThreads
getBuildInformation
getVersionString
getCPUFeaturesLine
- No marker: baseline features
*: features enabled in dispatcher?: features enabled but not available in hardware
Utility Functions
setUseOptimized
bool
True to enable optimizations, false to disable
useOptimized
checkRange
InputArray
Input array
bool
If true, doesn’t throw exceptions on invalid values
Point*
Optional output parameter for position of first invalid value
double
Minimum valid value (inclusive)
double
Maximum valid value (inclusive)
bool
True if all elements are within range and not NaN/Inf
patchNaNs
InputOutputArray
Input/output floating-point array
double
Value to replace NaNs with
LUT
InputArray
Input array (8-bit elements)
InputArray
Look-up table (256 elements)
OutputArray
Output array (same size as src)
convertScaleAbs
InputArray
Input array
OutputArray
Output array (CV_8U type)
double
Scale factor
double
Delta added to scaled values
PSNR
InputArray
First input array
InputArray
Second input array (same size and type as src1)
double
Maximum pixel value (255.0 for 8-bit images)
double
PSNR value in decibels (dB)
Higher PSNR values indicate better quality. Typical values range from 20 to 50 dB, with 30-50 dB being good quality.
