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

Function cvInitNArrayIterator

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

returns number of dimensions to iterate. Checks whether arrays have equal type, sizes (mask is optional array that needs to have the same size, but 8uC1 or 8sC1 type). Returns number of dimensions to iterate through: 0 means that all arrays are continuous, 1 means that all arrays are vectors of continuous arrays etc. and the size of largest common continuous part of the arrays */

Source from the content-addressed store, hash-verified

373and the size of largest common continuous part of the arrays
374*/
375CV_IMPL int
376cvInitNArrayIterator( int count, CvArr** arrs,
377 const CvArr* mask, CvMatND* stubs,
378 CvNArrayIterator* iterator, int flags )
379{
380 int dims = -1;
381 int i, j, size, dim0 = -1;
382 int64 step;
383 CvMatND* hdr0 = 0;
384
385 if( count < 1 || count > CV_MAX_ARR )
386 CV_Error( CV_StsOutOfRange, "Incorrect number of arrays" );
387
388 if( !arrs || !stubs )
389 CV_Error( CV_StsNullPtr, "Some of required array pointers is NULL" );
390
391 if( !iterator )
392 CV_Error( CV_StsNullPtr, "Iterator pointer is NULL" );
393
394 for( i = 0; i <= count; i++ )
395 {
396 const CvArr* arr = i < count ? arrs[i] : mask;
397 CvMatND* hdr;
398
399 if( !arr )
400 {
401 if( i < count )
402 CV_Error( CV_StsNullPtr, "Some of required array pointers is NULL" );
403 break;
404 }
405
406 if( CV_IS_MATND( arr ))
407 hdr = (CvMatND*)arr;
408 else
409 {
410 int coi = 0;
411 hdr = cvGetMatND( arr, stubs + i, &coi );
412 if( coi != 0 )
413 CV_Error( CV_BadCOI, "COI set is not allowed here" );
414 }
415
416 iterator->hdr[i] = hdr;
417
418 if( i > 0 )
419 {
420 if( hdr->dims != hdr0->dims )
421 CV_Error( CV_StsUnmatchedSizes,
422 "Number of dimensions is the same for all arrays" );
423
424 if( i < count )
425 {
426 switch( flags & (CV_NO_DEPTH_CHECK|CV_NO_CN_CHECK))
427 {
428 case 0:
429 if( !CV_ARE_TYPES_EQ( hdr, hdr0 ))
430 CV_Error( CV_StsUnmatchedFormats,
431 "Data type is not the same for all arrays" );
432 break;

Callers 2

icvWriteMatNDFunction · 0.85
cvCalcProbDensityFunction · 0.85

Calls 2

cvGetMatNDFunction · 0.85
cvSizeFunction · 0.85

Tested by

no test coverage detected