| OpenCV 3.4.3 Open Source Computer Vision

Public Member Functions | Public Attributes | List of all members
CvMat Struct Reference
Core functionality » C structures and operations

`#include "types_c.h"`

## Public Member Functions
| CvMat ()
| CvMat (const CvMat &m)
| CvMat (const cv::Mat &m)

## Public Attributes
union {
int height
int rows
}; |
union {
int cols
int width
}; |
union {
double * db
float * fl
int * i
uchar * ptr
short * s
} | data
int | hdr_refcount
int * | refcount
int | step
int | type

## Detailed Description

Matrix elements are stored row by row. Element (i, j) (i - 0-based row index, j - 0-based column index) of a matrix can be retrieved or modified using CV_MAT_ELEM macro:

    uchar pixval = CV_MAT_ELEM(grayimg, uchar, i, j)
    CV_MAT_ELEM(cameraMatrix, float, 0, 2) = image.width*0.5f;

To access multiple-channel matrices, you can use CV_MAT_ELEM(matrix, type, i, j*nchannels + channel_idx).

Deprecated:
  CvMat is now obsolete; consider using Mat instead.

Examples:
  samples/cpp/polar_transforms.cpp.

## Constructor & Destructor Documentation

## § CvMat() [1/2]

CvMat::CvMat | ( |  | ) |
| inline

## § CvMat() [2/2]

CvMat::CvMat | ( | const CvMat & | m | ) |
| inline

## Member Data Documentation

## § @87

union { ... }

## § @89

union { ... }

## § cols

int CvMat::cols

## § data

union { ... } CvMat::data

## § db

double* CvMat::db

## § fl

float* CvMat::fl

## § hdr_refcount

int CvMat::hdr_refcount

## § height

int CvMat::height

## § i

int* CvMat::i

## § ptr

uchar* CvMat::ptr

## § refcount

int* CvMat::refcount

## § rows

int CvMat::rows

## § s

short* CvMat::s

## § step

int CvMat::step

## § type

int CvMat::type

## § width

int CvMat::width

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

- core/include/opencv2/core/types_c.h