MCPcopy Create free account
hub / github.com/creatale/node-dv / cvCreateMatHeader

Function cvCreateMatHeader

deps/opencv/modules/core/src/array.cpp:107–131  ·  view source on GitHub ↗

Creates CvMat header only

Source from the content-addressed store, hash-verified

105
106// Creates CvMat header only
107CV_IMPL CvMat*
108cvCreateMatHeader( int rows, int cols, int type )
109{
110 type = CV_MAT_TYPE(type);
111
112 if( rows < 0 || cols <= 0 )
113 CV_Error( CV_StsBadSize, "Non-positive width or height" );
114
115 int min_step = CV_ELEM_SIZE(type)*cols;
116 if( min_step <= 0 )
117 CV_Error( CV_StsUnsupportedFormat, "Invalid matrix type" );
118
119 CvMat* arr = (CvMat*)cvAlloc( sizeof(*arr));
120
121 arr->step = min_step;
122 arr->type = CV_MAT_MAGIC_VAL | type | CV_MAT_CONT_FLAG;
123 arr->rows = rows;
124 arr->cols = cols;
125 arr->data.ptr = 0;
126 arr->refcount = 0;
127 arr->hdr_refcount = 1;
128
129 icvCheckHuge( arr );
130 return arr;
131}
132
133
134// Initializes CvMat header, allocated by the user

Callers 4

icvReadMatFunction · 0.85
cvCreateMatFunction · 0.85
cvCloneMatFunction · 0.85
cvCreatePyramidFunction · 0.85

Calls 2

cvAllocFunction · 0.85
icvCheckHugeFunction · 0.85

Tested by

no test coverage detected