| OpenCV 3.4.8 Open Source Computer Vision

Public Types | Public Member Functions | Static Public Member Functions | List of all members
cv::_OutputArray Class Reference
Core functionality » Basic structures

This type is very similar to InputArray except that it is used for input/output and output function parameters. More...

`#include <opencv2/core/mat.hpp>`

Inheritance diagram for cv::_OutputArray:

## Public Types
enum | { DEPTH_MASK_8U = 1 << CV_8U, DEPTH_MASK_8S = 1 << CV_8S, DEPTH_MASK_16U = 1 << CV_16U, DEPTH_MASK_16S = 1 << CV_16S, DEPTH_MASK_32S = 1 << CV_32S, DEPTH_MASK_32F = 1 << CV_32F, DEPTH_MASK_64F = 1 << CV_64F, DEPTH_MASK_ALL = (DEPTH_MASK_64F<<1)-1, DEPTH_MASK_ALL_BUT_8S = DEPTH_MASK_ALL & ~DEPTH_MASK_8S, DEPTH_MASK_FLT = DEPTH_MASK_32F + DEPTH_MASK_64F }
Public Types inherited from cv::_InputArray
enum | { KIND_SHIFT = 16, FIXED_TYPE = 0x8000 << KIND_SHIFT, FIXED_SIZE = 0x4000 << KIND_SHIFT, KIND_MASK = 31 << KIND_SHIFT, NONE = 0 << KIND_SHIFT, MAT = 1 << KIND_SHIFT, MATX = 2 << KIND_SHIFT, STD_VECTOR = 3 << KIND_SHIFT, STD_VECTOR_VECTOR = 4 << KIND_SHIFT, STD_VECTOR_MAT = 5 << KIND_SHIFT, EXPR = 6 << KIND_SHIFT, OPENGL_BUFFER = 7 << KIND_SHIFT, CUDA_HOST_MEM = 8 << KIND_SHIFT, CUDA_GPU_MAT = 9 << KIND_SHIFT, UMAT =10 << KIND_SHIFT, STD_VECTOR_UMAT =11 << KIND_SHIFT, STD_BOOL_VECTOR =12 << KIND_SHIFT, STD_VECTOR_CUDA_GPU_MAT = 13 << KIND_SHIFT, STD_ARRAY =14 << KIND_SHIFT, STD_ARRAY_MAT =15 << KIND_SHIFT }

## Public Member Functions
| _OutputArray ()
| _OutputArray (int _flags, void *_obj)
| _OutputArray (Mat &m)
| _OutputArray (std::vector< Mat > &vec)
| _OutputArray (cuda::GpuMat &d_mat)
| _OutputArray (std::vector< cuda::GpuMat > &d_mat)
| _OutputArray (ogl::Buffer &buf)
| _OutputArray (cuda::HostMem &cuda_mem)
template<typename _Tp >
| _OutputArray (cudev::GpuMat_< _Tp > &m)
template<typename _Tp >
| _OutputArray (std::vector< _Tp > &vec)
| _OutputArray (std::vector< bool > &vec)
template<typename _Tp >
| _OutputArray (std::vector< std::vector< _Tp > > &vec)
| _OutputArray (std::vector< std::vector< bool > > &)
template<typename _Tp >
| _OutputArray (std::vector< Mat_< _Tp > > &vec)
template<typename _Tp >
| _OutputArray (Mat_< _Tp > &m)
template<typename _Tp >
| _OutputArray (_Tp *vec, int n)
template<typename _Tp , int m, int n>
| _OutputArray (Matx< _Tp, m, n > &matx)
| _OutputArray (UMat &m)
| _OutputArray (std::vector< UMat > &vec)
| _OutputArray (const Mat &m)
| _OutputArray (const std::vector< Mat > &vec)
| _OutputArray (const cuda::GpuMat &d_mat)
| _OutputArray (const std::vector< cuda::GpuMat > &d_mat)
| _OutputArray (const ogl::Buffer &buf)
| _OutputArray (const cuda::HostMem &cuda_mem)
template<typename _Tp >
| _OutputArray (const cudev::GpuMat_< _Tp > &m)
template<typename _Tp >
| _OutputArray (const std::vector< _Tp > &vec)
template<typename _Tp >
| _OutputArray (const std::vector< std::vector< _Tp > > &vec)
template<typename _Tp >
| _OutputArray (const std::vector< Mat_< _Tp > > &vec)
template<typename _Tp >
| _OutputArray (const Mat_< _Tp > &m)
template<typename _Tp >
| _OutputArray (const _Tp *vec, int n)
template<typename _Tp , int m, int n>
| _OutputArray (const Matx< _Tp, m, n > &matx)
| _OutputArray (const UMat &m)
| _OutputArray (const std::vector< UMat > &vec)
void | assign (const UMat &u) const
void | assign (const Mat &m) const
void | assign (const std::vector< UMat > &v) const
void | assign (const std::vector< Mat > &v) const
void | clear () const
void | create (Size sz, int type, int i=-1, bool allowTransposed=false, int fixedDepthMask=0) const
void | create (int rows, int cols, int type, int i=-1, bool allowTransposed=false, int fixedDepthMask=0) const
void | create (int dims, const int *size, int type, int i=-1, bool allowTransposed=false, int fixedDepthMask=0) const
void | createSameSize (const _InputArray &arr, int mtype) const
bool | fixedSize () const
bool | fixedType () const
cuda::GpuMat & | getGpuMatRef () const
std::vector< cuda::GpuMat > & | getGpuMatVecRef () const
cuda::HostMem & | getHostMemRef () const
Mat & | getMatRef (int i=-1) const
ogl::Buffer & | getOGlBufferRef () const
UMat & | getUMatRef (int i=-1) const
void | move (UMat &u) const
void | move (Mat &m) const
bool | needed () const
void | release () const
void | setTo (const _InputArray &value, const _InputArray &mask=_InputArray()) const
Public Member Functions inherited from cv::_InputArray
| _InputArray ()
| _InputArray (int _flags, void *_obj)
| _InputArray (const Mat &m)
| _InputArray (const MatExpr &expr)
| _InputArray (const std::vector< Mat > &vec)
template<typename _Tp >
| _InputArray (const Mat_< _Tp > &m)
template<typename _Tp >
| _InputArray (const std::vector< _Tp > &vec)
| _InputArray (const std::vector< bool > &vec)
template<typename _Tp >
| _InputArray (const std::vector< std::vector< _Tp > > &vec)
| _InputArray (const std::vector< std::vector< bool > > &)
template<typename _Tp >
| _InputArray (const std::vector< Mat_< _Tp > > &vec)
template<typename _Tp >
| _InputArray (const _Tp *vec, int n)
template<typename _Tp , int m, int n>
| _InputArray (const Matx< _Tp, m, n > &matx)
| _InputArray (const double &val)
| _InputArray (const cuda::GpuMat &d_mat)
| _InputArray (const std::vector< cuda::GpuMat > &d_mat_array)
| _InputArray (const ogl::Buffer &buf)
| _InputArray (const cuda::HostMem &cuda_mem)
template<typename _Tp >
| _InputArray (const cudev::GpuMat_< _Tp > &m)
| _InputArray (const UMat &um)
| _InputArray (const std::vector< UMat > &umv)
| ~_InputArray ()
int | channels (int i=-1) const
int | cols (int i=-1) const
void | copyTo (const _OutputArray &arr) const
void | copyTo (const _OutputArray &arr, const _InputArray &mask) const
int | depth (int i=-1) const
int | dims (int i=-1) const
bool | empty () const
int | getFlags () const
cuda::GpuMat | getGpuMat () const
void | getGpuMatVector (std::vector< cuda::GpuMat > &gpumv) const
Mat | getMat (int idx=-1) const
Mat | getMat_ (int idx=-1) const
void | getMatVector (std::vector< Mat > &mv) const
void * | getObj () const
ogl::Buffer | getOGlBuffer () const
Size | getSz () const
UMat | getUMat (int idx=-1) const
void | getUMatVector (std::vector< UMat > &umv) const
bool | isContinuous (int i=-1) const
bool | isGpuMat () const
bool | isGpuMatVector () const
bool | isMat () const
bool | isMatVector () const
bool | isMatx () const
bool | isSubmatrix (int i=-1) const
bool | isUMat () const
bool | isUMatVector () const
bool | isVector () const
int | kind () const
size_t | offset (int i=-1) const
int | rows (int i=-1) const
bool | sameSize (const _InputArray &arr) const
Size | size (int i=-1) const
int | sizend (int *sz, int i=-1) const
size_t | step (int i=-1) const
size_t | total (int i=-1) const
int | type (int i=-1) const

## Static Public Member Functions
template<typename _Tp >
static _OutputArray | rawOut (std::vector< _Tp > &vec)
Static Public Member Functions inherited from cv::_InputArray
template<typename _Tp >
static _InputArray | rawIn (const std::vector< _Tp > &vec)

## Additional Inherited Members
Protected Member Functions inherited from cv::_InputArray
void | init (int _flags, const void *_obj)
void | init (int _flags, const void *_obj, Size _sz)
Protected Attributes inherited from cv::_InputArray
int | flags
void * | obj
Size | sz

## Detailed Description

This type is very similar to InputArray except that it is used for input/output and output function parameters.

Just like with InputArray, OpenCV users should not care about OutputArray, they just pass `Mat`, `vector<T>` etc. to the functions. The same limitation as for `InputArray`: Do not explicitly create OutputArray instances applies here too.

If you want to make your function polymorphic (i.e. accept different arrays as output parameters), it is also not very difficult. Take the sample above as the reference. Note that _OutputArray::create() needs to be called before _OutputArray::getMat(). This way you guarantee that the output array is properly allocated.

Optional output parameters. If you do not need certain output array to be computed and returned to you, pass cv::noArray(), just like you would in the case of optional input array. At the implementation level, use _OutputArray::needed() to check if certain output array needs to be computed or not.

There are several synonyms for OutputArray that are used to assist automatic Python/Java/... wrapper generators:

typedef OutputArray OutputArrayOfArrays;
typedef OutputArray InputOutputArray;
typedef OutputArray InputOutputArrayOfArrays;

## Member Enumeration Documentation

## § anonymous enum

anonymous enum

Enumerator
DEPTH_MASK_8U |
DEPTH_MASK_8S |
DEPTH_MASK_16U |
DEPTH_MASK_16S |
DEPTH_MASK_32S |
DEPTH_MASK_32F |
DEPTH_MASK_64F |
DEPTH_MASK_ALL |
DEPTH_MASK_ALL_BUT_8S |
DEPTH_MASK_FLT |

## Constructor & Destructor Documentation

## § _OutputArray() [1/34]

cv::_OutputArray::_OutputArray | ( |  | ) |

## § _OutputArray() [2/34]

cv::_OutputArray::_OutputArray | ( | int | _flags,
|  | void * | _obj
| ) |  |

## § _OutputArray() [3/34]

cv::_OutputArray::_OutputArray | ( | Mat & | m | ) |

## § _OutputArray() [4/34]

cv::_OutputArray::_OutputArray | ( | std::vector< Mat > & | vec | ) |

## § _OutputArray() [5/34]

cv::_OutputArray::_OutputArray | ( | cuda::GpuMat & | d_mat | ) |

## § _OutputArray() [6/34]

cv::_OutputArray::_OutputArray | ( | std::vector< cuda::GpuMat > & | d_mat | ) |

## § _OutputArray() [7/34]

cv::_OutputArray::_OutputArray | ( | ogl::Buffer & | buf | ) |

## § _OutputArray() [8/34]

cv::_OutputArray::_OutputArray | ( | cuda::HostMem & | cuda_mem | ) |

## § _OutputArray() [9/34]

template<typename _Tp >

cv::_OutputArray::_OutputArray | ( | cudev::GpuMat_< _Tp > & | m | ) |

## § _OutputArray() [10/34]

template<typename _Tp >

cv::_OutputArray::_OutputArray | ( | std::vector< _Tp > & | vec | ) |

## § _OutputArray() [11/34]

cv::_OutputArray::_OutputArray | ( | std::vector< bool > & | vec | ) |

## § _OutputArray() [12/34]

template<typename _Tp >

cv::_OutputArray::_OutputArray | ( | std::vector< std::vector< _Tp > > & | vec | ) |

## § _OutputArray() [13/34]

cv::_OutputArray::_OutputArray | ( | std::vector< std::vector< bool > > & |  | ) |

## § _OutputArray() [14/34]

template<typename _Tp >

cv::_OutputArray::_OutputArray | ( | std::vector< Mat_< _Tp > > & | vec | ) |

## § _OutputArray() [15/34]

template<typename _Tp >

cv::_OutputArray::_OutputArray | ( | Mat_< _Tp > & | m | ) |

## § _OutputArray() [16/34]

template<typename _Tp >

cv::_OutputArray::_OutputArray | ( | _Tp * | vec,
|  | int | n
| ) |  |

## § _OutputArray() [17/34]

template<typename _Tp , int m, int n>

cv::_OutputArray::_OutputArray | ( | Matx< _Tp, m, n > & | matx | ) |

## § _OutputArray() [18/34]

cv::_OutputArray::_OutputArray | ( | UMat & | m | ) |

## § _OutputArray() [19/34]

cv::_OutputArray::_OutputArray | ( | std::vector< UMat > & | vec | ) |

## § _OutputArray() [20/34]

cv::_OutputArray::_OutputArray | ( | const Mat & | m | ) |

## § _OutputArray() [21/34]

cv::_OutputArray::_OutputArray | ( | const std::vector< Mat > & | vec | ) |

## § _OutputArray() [22/34]

cv::_OutputArray::_OutputArray | ( | const cuda::GpuMat & | d_mat | ) |

## § _OutputArray() [23/34]

cv::_OutputArray::_OutputArray | ( | const std::vector< cuda::GpuMat > & | d_mat | ) |

## § _OutputArray() [24/34]

cv::_OutputArray::_OutputArray | ( | const ogl::Buffer & | buf | ) |

## § _OutputArray() [25/34]

cv::_OutputArray::_OutputArray | ( | const cuda::HostMem & | cuda_mem | ) |

## § _OutputArray() [26/34]

template<typename _Tp >

cv::_OutputArray::_OutputArray | ( | const cudev::GpuMat_< _Tp > & | m | ) |

## § _OutputArray() [27/34]

template<typename _Tp >

cv::_OutputArray::_OutputArray | ( | const std::vector< _Tp > & | vec | ) |

## § _OutputArray() [28/34]

template<typename _Tp >

cv::_OutputArray::_OutputArray | ( | const std::vector< std::vector< _Tp > > & | vec | ) |

## § _OutputArray() [29/34]

template<typename _Tp >

cv::_OutputArray::_OutputArray | ( | const std::vector< Mat_< _Tp > > & | vec | ) |

## § _OutputArray() [30/34]

template<typename _Tp >

cv::_OutputArray::_OutputArray | ( | const Mat_< _Tp > & | m | ) |

## § _OutputArray() [31/34]

template<typename _Tp >

cv::_OutputArray::_OutputArray | ( | const _Tp * | vec,
|  | int | n
| ) |  |

## § _OutputArray() [32/34]

template<typename _Tp , int m, int n>

cv::_OutputArray::_OutputArray | ( | const Matx< _Tp, m, n > & | matx | ) |

## § _OutputArray() [33/34]

cv::_OutputArray::_OutputArray | ( | const UMat & | m | ) |

## § _OutputArray() [34/34]

cv::_OutputArray::_OutputArray | ( | const std::vector< UMat > & | vec | ) |

## Member Function Documentation

## § assign() [1/4]

void cv::_OutputArray::assign | ( | const UMat & | u | ) | const

## § assign() [2/4]

void cv::_OutputArray::assign | ( | const Mat & | m | ) | const

## § assign() [3/4]

void cv::_OutputArray::assign | ( | const std::vector< UMat > & | v | ) | const

## § assign() [4/4]

void cv::_OutputArray::assign | ( | const std::vector< Mat > & | v | ) | const

## § clear()

void cv::_OutputArray::clear | ( |  | ) | const

## § create() [1/3]

void cv::_OutputArray::create | ( | Size | sz,
|  | int | type,
|  | int | i = `-1`,
|  | bool | allowTransposed = `false`,
|  | int | fixedDepthMask = `0`
| ) |  | const

## § create() [2/3]

void cv::_OutputArray::create | ( | int | rows,
|  | int | cols,
|  | int | type,
|  | int | i = `-1`,
|  | bool | allowTransposed = `false`,
|  | int | fixedDepthMask = `0`
| ) |  | const

## § create() [3/3]

void cv::_OutputArray::create | ( | int | dims,
|  | const int * | size,
|  | int | type,
|  | int | i = `-1`,
|  | bool | allowTransposed = `false`,
|  | int | fixedDepthMask = `0`
| ) |  | const

## § createSameSize()

void cv::_OutputArray::createSameSize | ( | const _InputArray & | arr,
|  | int | mtype
| ) |  | const

## § fixedSize()

bool cv::_OutputArray::fixedSize | ( |  | ) | const

## § fixedType()

bool cv::_OutputArray::fixedType | ( |  | ) | const

## § getGpuMatRef()

cuda::GpuMat& cv::_OutputArray::getGpuMatRef | ( |  | ) | const

## § getGpuMatVecRef()

std::vector<cuda::GpuMat>& cv::_OutputArray::getGpuMatVecRef | ( |  | ) | const

## § getHostMemRef()

cuda::HostMem& cv::_OutputArray::getHostMemRef | ( |  | ) | const

## § getMatRef()

Mat& cv::_OutputArray::getMatRef | ( | int | i = `-1` | ) | const

## § getOGlBufferRef()

ogl::Buffer& cv::_OutputArray::getOGlBufferRef | ( |  | ) | const

## § getUMatRef()

UMat& cv::_OutputArray::getUMatRef | ( | int | i = `-1` | ) | const

## § move() [1/2]

void cv::_OutputArray::move | ( | UMat & | u | ) | const

## § move() [2/2]

void cv::_OutputArray::move | ( | Mat & | m | ) | const

## § needed()

bool cv::_OutputArray::needed | ( |  | ) | const

## § rawOut()

template<typename _Tp >

static _OutputArray cv::_OutputArray::rawOut | ( | std::vector< _Tp > & | vec | ) |
| static

## § release()

void cv::_OutputArray::release | ( |  | ) | const

## § setTo()

void cv::_OutputArray::setTo | ( | const _InputArray & | value,
|  | const _InputArray & | mask = `_InputArray()`
| ) |  | const

The documentation for this class was generated from the following file:

- opencv2/core/mat.hpp