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

Function cvInitMatNDHeader

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

Source from the content-addressed store, hash-verified

221\****************************************************************************************/
222
223CV_IMPL CvMatND*
224cvInitMatNDHeader( CvMatND* mat, int dims, const int* sizes,
225 int type, void* data )
226{
227 type = CV_MAT_TYPE(type);
228 int64 step = CV_ELEM_SIZE(type);
229
230 if( !mat )
231 CV_Error( CV_StsNullPtr, "NULL matrix header pointer" );
232
233 if( step == 0 )
234 CV_Error( CV_StsUnsupportedFormat, "invalid array data type" );
235
236 if( !sizes )
237 CV_Error( CV_StsNullPtr, "NULL <sizes> pointer" );
238
239 if( dims <= 0 || dims > CV_MAX_DIM )
240 CV_Error( CV_StsOutOfRange,
241 "non-positive or too large number of dimensions" );
242
243 for( int i = dims - 1; i >= 0; i-- )
244 {
245 if( sizes[i] < 0 )
246 CV_Error( CV_StsBadSize, "one of dimesion sizes is non-positive" );
247 mat->dim[i].size = sizes[i];
248 if( step > INT_MAX )
249 CV_Error( CV_StsOutOfRange, "The array is too big" );
250 mat->dim[i].step = (int)step;
251 step *= sizes[i];
252 }
253
254 mat->type = CV_MATND_MAGIC_VAL | (step <= INT_MAX ? CV_MAT_CONT_FLAG : 0) | type;
255 mat->dims = dims;
256 mat->data.ptr = (uchar*)data;
257 mat->refcount = 0;
258 mat->hdr_refcount = 0;
259 return mat;
260}
261
262
263// Creates CvMatND and underlying data

Callers 5

matrix.cppFile · 0.85
cvCreateMatNDHeaderFunction · 0.85
cvCreateHistFunction · 0.85
histogram.cppFile · 0.85
icvReadHistFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected