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

Function cvGetMatND

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

Source from the content-addressed store, hash-verified

317
318
319static CvMatND*
320cvGetMatND( const CvArr* arr, CvMatND* matnd, int* coi )
321{
322 CvMatND* result = 0;
323
324 if( coi )
325 *coi = 0;
326
327 if( !matnd || !arr )
328 CV_Error( CV_StsNullPtr, "NULL array pointer is passed" );
329
330 if( CV_IS_MATND_HDR(arr))
331 {
332 if( !((CvMatND*)arr)->data.ptr )
333 CV_Error( CV_StsNullPtr, "The matrix has NULL data pointer" );
334
335 result = (CvMatND*)arr;
336 }
337 else
338 {
339 CvMat stub, *mat = (CvMat*)arr;
340
341 if( CV_IS_IMAGE_HDR( mat ))
342 mat = cvGetMat( mat, &stub, coi );
343
344 if( !CV_IS_MAT_HDR( mat ))
345 CV_Error( CV_StsBadArg, "Unrecognized or unsupported array type" );
346
347 if( !mat->data.ptr )
348 CV_Error( CV_StsNullPtr, "Input array has NULL data pointer" );
349
350 matnd->data.ptr = mat->data.ptr;
351 matnd->refcount = 0;
352 matnd->hdr_refcount = 0;
353 matnd->type = mat->type;
354 matnd->dims = 2;
355 matnd->dim[0].size = mat->rows;
356 matnd->dim[0].step = mat->step;
357 matnd->dim[1].size = mat->cols;
358 matnd->dim[1].step = CV_ELEM_SIZE(mat->type);
359 result = matnd;
360 }
361
362 return result;
363}
364
365
366// returns number of dimensions to iterate.

Callers 2

cvInitNArrayIteratorFunction · 0.85
cvReshapeMatNDFunction · 0.85

Calls 1

cvGetMatFunction · 0.85

Tested by

no test coverage detected