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

Function cvMakeSeqHeaderForArray

deps/opencv/modules/core/src/datastructs.cpp:577–619  ·  view source on GitHub ↗

Construct a sequence from an array without copying any data. NB: The resultant sequence cannot grow beyond its initial size: */

Source from the content-addressed store, hash-verified

575/* Construct a sequence from an array without copying any data.
576 NB: The resultant sequence cannot grow beyond its initial size: */
577CV_IMPL CvSeq*
578cvMakeSeqHeaderForArray( int seq_flags, int header_size, int elem_size,
579 void *array, int total, CvSeq *seq, CvSeqBlock * block )
580{
581 CvSeq* result = 0;
582
583 if( elem_size <= 0 || header_size < (int)sizeof( CvSeq ) || total < 0 )
584 CV_Error( CV_StsBadSize, "" );
585
586 if( !seq || ((!array || !block) && total > 0) )
587 CV_Error( CV_StsNullPtr, "" );
588
589 memset( seq, 0, header_size );
590
591 seq->header_size = header_size;
592 seq->flags = (seq_flags & ~CV_MAGIC_MASK) | CV_SEQ_MAGIC_VAL;
593 {
594 int elemtype = CV_MAT_TYPE(seq_flags);
595 int typesize = CV_ELEM_SIZE(elemtype);
596
597 if( elemtype != CV_SEQ_ELTYPE_GENERIC &&
598 typesize != 0 && typesize != elem_size )
599 CV_Error( CV_StsBadSize,
600 "Element size doesn't match to the size of predefined element type "
601 "(try to use 0 for sequence element type)" );
602 }
603 seq->elem_size = elem_size;
604 seq->total = total;
605 seq->block_max = seq->ptr = (schar *) array + total * elem_size;
606
607 if( total > 0 )
608 {
609 seq->first = block;
610 block->prev = block->next = block;
611 block->start_index = 0;
612 block->count = total;
613 block->data = (schar *) array;
614 }
615
616 result = seq;
617
618 return result;
619}
620
621
622/* The function allocates space for at least one more sequence element.

Callers 9

cvSeqInsertSliceFunction · 0.85
cvFitLineFunction · 0.85
cvHoughLines2Function · 0.85
cvHoughCirclesFunction · 0.85
cvPointSeqFromMatFunction · 0.85
addChildContourFunction · 0.85
drawContoursMethod · 0.85
cvConvexHull2Function · 0.85
cvConvexityDefectsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected