OpenCV: Core functionality

| OpenCV 3.4.2 Open Source Computer Vision

Modules | Namespaces | Classes | Typedefs | Enumerations | Functions
Core functionality

## Modules
| Basic structures
| C structures and operations
| Operations on arrays
| XML/YAML Persistence
| Clustering
| Utility and system functions and macros
| OpenGL interoperability
| Intel IPP Asynchronous C/C++ Converters
| Optimization Algorithms
| DirectX interoperability
| Eigen support
| OpenCL support
| Intel VA-API/OpenCL (CL-VA) interoperability
| Hardware Acceleration Layer

## Namespaces
| cv::traits

## Classes
class | cv::Affine3< T >
| Affine transform. More...
class | cv::BufferPoolController
class | cv::WImage< T >
| Image class which provides a thin layer around an IplImage. More...
class | cv::WImageBuffer< T >
class | cv::WImageBufferC< T, C >
class | cv::WImageC< T, C >
class | cv::WImageView< T >
class | cv::WImageViewC< T, C >

## Typedefs
typedef Affine3< double > | cv::Affine3d
typedef Affine3< float > | cv::Affine3f
typedef WImageC< short, 1 > | cv::WImage1_16s
typedef WImageC< ushort, 1 > | cv::WImage1_16u
typedef WImageC< uchar, 1 > | cv::WImage1_b
typedef WImageC< float, 1 > | cv::WImage1_f
typedef WImageC< short, 3 > | cv::WImage3_16s
typedef WImageC< ushort, 3 > | cv::WImage3_16u
typedef WImageC< uchar, 3 > | cv::WImage3_b
typedef WImageC< float, 3 > | cv::WImage3_f
typedef WImage< short > | cv::WImage_16s
typedef WImage< ushort > | cv::WImage_16u
typedef WImage< uchar > | cv::WImage_b
typedef WImage< float > | cv::WImage_f
typedef WImageBufferC< short, 1 > | cv::WImageBuffer1_16s
typedef WImageBufferC< ushort, 1 > | cv::WImageBuffer1_16u
typedef WImageBufferC< uchar, 1 > | cv::WImageBuffer1_b
typedef WImageBufferC< float, 1 > | cv::WImageBuffer1_f
typedef WImageBufferC< short, 3 > | cv::WImageBuffer3_16s
typedef WImageBufferC< ushort, 3 > | cv::WImageBuffer3_16u
typedef WImageBufferC< uchar, 3 > | cv::WImageBuffer3_b
typedef WImageBufferC< float, 3 > | cv::WImageBuffer3_f
typedef WImageBuffer< short > | cv::WImageBuffer_16s
typedef WImageBuffer< ushort > | cv::WImageBuffer_16u
typedef WImageBuffer< uchar > | cv::WImageBuffer_b
typedef WImageBuffer< float > | cv::WImageBuffer_f
typedef WImageViewC< short, 1 > | cv::WImageView1_16s
typedef WImageViewC< ushort, 1 > | cv::WImageView1_16u
typedef WImageViewC< uchar, 1 > | cv::WImageView1_b
typedef WImageViewC< float, 1 > | cv::WImageView1_f
typedef WImageViewC< short, 3 > | cv::WImageView3_16s
typedef WImageViewC< ushort, 3 > | cv::WImageView3_16u
typedef WImageViewC< uchar, 3 > | cv::WImageView3_b
typedef WImageViewC< float, 3 > | cv::WImageView3_f
typedef WImageView< short > | cv::WImageView_16s
typedef WImageView< ushort > | cv::WImageView_16u
typedef WImageView< uchar > | cv::WImageView_b
typedef WImageView< float > | cv::WImageView_f

## Enumerations
enum | cv::CovarFlags { cv::COVAR_SCRAMBLED = 0, cv::COVAR_NORMAL = 1, cv::COVAR_USE_AVG = 2, cv::COVAR_SCALE = 4, cv::COVAR_ROWS = 8, cv::COVAR_COLS = 16 }
| Covariation flags. More...
enum | cv::HersheyFonts { cv::FONT_HERSHEY_SIMPLEX = 0, cv::FONT_HERSHEY_PLAIN = 1, cv::FONT_HERSHEY_DUPLEX = 2, cv::FONT_HERSHEY_COMPLEX = 3, cv::FONT_HERSHEY_TRIPLEX = 4, cv::FONT_HERSHEY_COMPLEX_SMALL = 5, cv::FONT_HERSHEY_SCRIPT_SIMPLEX = 6, cv::FONT_HERSHEY_SCRIPT_COMPLEX = 7, cv::FONT_ITALIC = 16 }
| Only a subset of Hershey fonts https://en.wikipedia.org/wiki/Hershey_fonts are supported. More...
enum | cv::KmeansFlags { cv::KMEANS_RANDOM_CENTERS = 0, cv::KMEANS_PP_CENTERS = 2, cv::KMEANS_USE_INITIAL_LABELS = 1 }
| k-Means flags More...
enum | cv::LineTypes { cv::FILLED = -1, cv::LINE_4 = 4, cv::LINE_8 = 8, cv::LINE_AA = 16 }
| type of line More...
enum | cv::ReduceTypes { cv::REDUCE_SUM = 0, cv::REDUCE_AVG = 1, cv::REDUCE_MAX = 2, cv::REDUCE_MIN = 3 }

## Functions
| cv::WImageView< T >::WImageView (WImage< T > *img, int c, int r, int width, int height)
| cv::WImageView< T >::WImageView (T *data, int width, int height, int channels, int width_step=-1)
| cv::WImageViewC< T, C >::WImageViewC ()
| cv::WImageViewC< T, C >::WImageViewC (WImageC< T, C > *img, int c, int r, int width, int height)
| cv::WImageViewC< T, C >::WImageViewC (T *data, int width, int height, int width_step=-1)
virtual | cv::WImage< T >::~WImage ()=0
virtual | cv::WImageC< T, C >::~WImageC ()=0
void | cv::WImageBuffer< T >::Allocate (int width, int height, int nchannels)
void | cv::WImageBufferC< T, C >::Allocate (int width, int height)
template<typename T >
static Affine3< T > | cv::operator* (const Affine3< T > &affine1, const Affine3< T > &affine2)
template<typename T , typename V >
static V | cv::operator* (const Affine3< T > &affine, const V &vector)
| V is a 3-element vector with member fields x, y and z. More...
static Vec3f | cv::operator* (const Affine3f &affine, const Vec3f &vector)
static Vec3d | cv::operator* (const Affine3d &affine, const Vec3d &vector)
void | cv::swap (Mat &a, Mat &b)
| Swaps two matrices. More...
void | cv::swap (UMat &a, UMat &b)
WImageView< T > | cv::WImage< T >::View (int c, int r, int width, int height)
WImageViewC< T, C > | cv::WImageC< T, C >::View (int c, int r, int width, int height)

## Detailed Description

## Typedef Documentation

## ◆ Affine3d

typedef Affine3<double> cv::Affine3d

## ◆ Affine3f

typedef Affine3<float> cv::Affine3f

## ◆ WImage1_16s

typedef WImageC<short, 1> cv::WImage1_16s

## ◆ WImage1_16u

typedef WImageC<ushort, 1> cv::WImage1_16u

## ◆ WImage1_b

typedef WImageC<uchar, 1> cv::WImage1_b

## ◆ WImage1_f

typedef WImageC<float, 1> cv::WImage1_f

## ◆ WImage3_16s

typedef WImageC<short, 3> cv::WImage3_16s

## ◆ WImage3_16u

typedef WImageC<ushort, 3> cv::WImage3_16u

## ◆ WImage3_b

typedef WImageC<uchar, 3> cv::WImage3_b

## ◆ WImage3_f

typedef WImageC<float, 3> cv::WImage3_f

## ◆ WImage_16s

typedef WImage<short> cv::WImage_16s

## ◆ WImage_16u

typedef WImage<ushort> cv::WImage_16u

## ◆ WImage_b

typedef WImage<uchar> cv::WImage_b

## ◆ WImage_f

typedef WImage<float> cv::WImage_f

## ◆ WImageBuffer1_16s

typedef WImageBufferC<short, 1> cv::WImageBuffer1_16s

## ◆ WImageBuffer1_16u

typedef WImageBufferC<ushort, 1> cv::WImageBuffer1_16u

## ◆ WImageBuffer1_b

typedef WImageBufferC<uchar, 1> cv::WImageBuffer1_b

## ◆ WImageBuffer1_f

typedef WImageBufferC<float, 1> cv::WImageBuffer1_f

## ◆ WImageBuffer3_16s

typedef WImageBufferC<short, 3> cv::WImageBuffer3_16s

## ◆ WImageBuffer3_16u

typedef WImageBufferC<ushort, 3> cv::WImageBuffer3_16u

## ◆ WImageBuffer3_b

typedef WImageBufferC<uchar, 3> cv::WImageBuffer3_b

## ◆ WImageBuffer3_f

typedef WImageBufferC<float, 3> cv::WImageBuffer3_f

## ◆ WImageBuffer_16s

typedef WImageBuffer<short> cv::WImageBuffer_16s

## ◆ WImageBuffer_16u

typedef WImageBuffer<ushort> cv::WImageBuffer_16u

## ◆ WImageBuffer_b

typedef WImageBuffer<uchar> cv::WImageBuffer_b

## ◆ WImageBuffer_f

typedef WImageBuffer<float> cv::WImageBuffer_f

## ◆ WImageView1_16s

typedef WImageViewC<short, 1> cv::WImageView1_16s

## ◆ WImageView1_16u

typedef WImageViewC<ushort, 1> cv::WImageView1_16u

## ◆ WImageView1_b

typedef WImageViewC<uchar, 1> cv::WImageView1_b

## ◆ WImageView1_f

typedef WImageViewC<float, 1> cv::WImageView1_f

## ◆ WImageView3_16s

typedef WImageViewC<short, 3> cv::WImageView3_16s

## ◆ WImageView3_16u

typedef WImageViewC<ushort, 3> cv::WImageView3_16u

## ◆ WImageView3_b

typedef WImageViewC<uchar, 3> cv::WImageView3_b

## ◆ WImageView3_f

typedef WImageViewC<float, 3> cv::WImageView3_f

## ◆ WImageView_16s

typedef WImageView<short> cv::WImageView_16s

## ◆ WImageView_16u

typedef WImageView<ushort> cv::WImageView_16u

## ◆ WImageView_b

typedef WImageView<uchar> cv::WImageView_b

## ◆ WImageView_f

typedef WImageView<float> cv::WImageView_f

## Enumeration Type Documentation

## ◆ CovarFlags

enum cv::CovarFlags

Covariation flags.

Enumerator
COVAR_SCRAMBLED | The output covariance matrix is calculated as: \[\texttt{scale} \cdot [ \texttt{vects} [0]- \texttt{mean} , \texttt{vects} [1]- \texttt{mean} ,...]^T \cdot [ \texttt{vects} [0]- \texttt{mean} , \texttt{vects} [1]- \texttt{mean} ,...],\] The covariance matrix will be nsamples x nsamples. Such an unusual covariance matrix is used for fast PCA of a set of very large vectors (see, for example, the EigenFaces technique for face recognition). Eigenvalues of this "scrambled" matrix match the eigenvalues of the true covariance matrix. The "true" eigenvectors can be easily calculated from the eigenvectors of the "scrambled" covariance matrix.
COVAR_NORMAL | The output covariance matrix is calculated as: \[\texttt{scale} \cdot [ \texttt{vects} [0]- \texttt{mean} , \texttt{vects} [1]- \texttt{mean} ,...] \cdot [ \texttt{vects} [0]- \texttt{mean} , \texttt{vects} [1]- \texttt{mean} ,...]^T,\] covar will be a square matrix of the same size as the total number of elements in each input vector. One and only one of COVAR_SCRAMBLED and COVAR_NORMAL must be specified.
COVAR_USE_AVG | If the flag is specified, the function does not calculate mean from the input vectors but, instead, uses the passed mean vector. This is useful if mean has been pre-calculated or known in advance, or if the covariance matrix is calculated by parts. In this case, mean is not a mean vector of the input sub-set of vectors but rather the mean vector of the whole set.
COVAR_SCALE | If the flag is specified, the covariance matrix is scaled. In the "normal" mode, scale is 1./nsamples . In the "scrambled" mode, scale is the reciprocal of the total number of elements in each input vector. By default (if the flag is not specified), the covariance matrix is not scaled ( scale=1 ).
COVAR_ROWS | If the flag is specified, all the input vectors are stored as rows of the samples matrix. mean should be a single-row vector in this case.
COVAR_COLS | If the flag is specified, all the input vectors are stored as columns of the samples matrix. mean should be a single-column vector in this case.

## ◆ HersheyFonts

enum cv::HersheyFonts

Only a subset of Hershey fonts https://en.wikipedia.org/wiki/Hershey_fonts are supported.

Enumerator
FONT_HERSHEY_SIMPLEX | normal size sans-serif font
FONT_HERSHEY_PLAIN | small size sans-serif font
FONT_HERSHEY_DUPLEX | normal size sans-serif font (more complex than FONT_HERSHEY_SIMPLEX)
FONT_HERSHEY_COMPLEX | normal size serif font
FONT_HERSHEY_TRIPLEX | normal size serif font (more complex than FONT_HERSHEY_COMPLEX)
FONT_HERSHEY_COMPLEX_SMALL | smaller version of FONT_HERSHEY_COMPLEX
FONT_HERSHEY_SCRIPT_SIMPLEX | hand-writing style font
FONT_HERSHEY_SCRIPT_COMPLEX | more complex variant of FONT_HERSHEY_SCRIPT_SIMPLEX
FONT_ITALIC | flag for italic font

## ◆ KmeansFlags

enum cv::KmeansFlags

k-Means flags

Enumerator
KMEANS_RANDOM_CENTERS | Select random initial centers in each attempt.
KMEANS_PP_CENTERS | Use kmeans++ center initialization by Arthur and Vassilvitskii [Arthur2007].
KMEANS_USE_INITIAL_LABELS | During the first (and possibly the only) attempt, use the user-supplied labels instead of computing them from the initial centers. For the second and further attempts, use the random or semi-random centers. Use one of KMEANS_*_CENTERS flag to specify the exact method.

## ◆ LineTypes

enum cv::LineTypes

type of line

Enumerator
FILLED |
LINE_4 | 4-connected line
LINE_8 | 8-connected line
LINE_AA | antialiased line

## ◆ ReduceTypes

enum cv::ReduceTypes

Enumerator
REDUCE_SUM | the output is the sum of all rows/columns of the matrix.
REDUCE_AVG | the output is the mean vector of all rows/columns of the matrix.
REDUCE_MAX | the output is the maximum (column/row-wise) of all rows/columns of the matrix.
REDUCE_MIN | the output is the minimum (column/row-wise) of all rows/columns of the matrix.

## Function Documentation

## ◆ WImageView() [1/2]

template<typename T >

cv::WImageView< T >::WImageView | ( | WImage< T > * | img,
|  | int | c,
|  | int | r,
|  | int | width,
|  | int | height
| ) |  |

## ◆ WImageView() [2/2]

template<typename T >

cv::WImageView< T >::WImageView | ( | T * | data,
|  | int | width,
|  | int | height,
|  | int | channels,
|  | int | width_step = `-1`
| ) |  |

## ◆ WImageViewC() [1/3]

template<typename T , int C>

cv::WImageViewC< T, C >::WImageViewC | ( |  | ) |

## ◆ WImageViewC() [2/3]

template<typename T , int C>

cv::WImageViewC< T, C >::WImageViewC | ( | WImageC< T, C > * | img,
|  | int | c,
|  | int | r,
|  | int | width,
|  | int | height
| ) |  |

## ◆ WImageViewC() [3/3]

template<typename T , int C>

cv::WImageViewC< T, C >::WImageViewC | ( | T * | data,
|  | int | width,
|  | int | height,
|  | int | width_step = `-1`
| ) |  |

## ◆ ~WImage()

template<typename T >

cv::WImage< T >::~WImage | ( |  | ) |
| inlinepure virtual

## ◆ ~WImageC()

template<typename T , int C>

cv::WImageC< T, C >::~WImageC | ( |  | ) |
| inlinepure virtual

## ◆ Allocate() [1/2]

template<typename T >

void cv::WImageBuffer< T >::Allocate | ( | int | width,
|  | int | height,
|  | int | nchannels
| ) |  |
| inline

## ◆ Allocate() [2/2]

template<typename T , int C>

void cv::WImageBufferC< T, C >::Allocate | ( | int | width,
|  | int | height
| ) |  |
| inline

## ◆ operator*() [1/4]

template<typename T >

static Affine3<T> cv::operator* | ( | const Affine3< T > & | affine1,
|  | const Affine3< T > & | affine2
| ) |  |
| static

## ◆ operator*() [2/4]

template<typename T , typename V >

static V cv::operator* | ( | const Affine3< T > & | affine,
|  | const V & | vector
| ) |  |
| static

V is a 3-element vector with member fields x, y and z.

## ◆ operator*() [3/4]

static Vec3f cv::operator* | ( | const Affine3f & | affine,
|  | const Vec3f & | vector
| ) |  |
| static

## ◆ operator*() [4/4]

static Vec3d cv::operator* | ( | const Affine3d & | affine,
|  | const Vec3d & | vector
| ) |  |
| static

## ◆ swap() [1/2]

void cv::swap | ( | Mat & | a,
|  | Mat & | b
| ) |  |

Swaps two matrices.

## ◆ swap() [2/2]

void cv::swap | ( | UMat & | a,
|  | UMat & | b
| ) |  |

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

## ◆ View() [1/2]

template<typename T >

WImageView< T > cv::WImage< T >::View | ( | int | c,
|  | int | r,
|  | int | width,
|  | int | height
| ) |  |

## ◆ View() [2/2]

template<typename T , int C>

WImageViewC< T, C > cv::WImageC< T, C >::View | ( | int | c,
|  | int | r,
|  | int | width,
|  | int | height
| ) |  |