1)OpenCV CvSeq的内部结构探讨
对于CvSeq这一结构体,又称为可动态增长元素序列(OpenCV_1.0已发生改变,详见cxtypes.h) Growable sequence of elements。
CvSeq定义复杂,首先,定义CV_SEQUENCE_FIELDS()。
#define CV_SEQUENCE_FIELDS() \
typedef struct CvSeq
{
int flags; /* micsellaneous flags */
int header_size; /* size of sequence header */
struct CvSeq* h_prev; /* previous sequence */
struct CvSeq* h_next; /* next sequence */
struct CvSeq* v_prev; /* 2nd previous sequence */
struct CvSeq* v_next; /* 2nd next sequence */
int total; /* total number of elements */
int elem_size; /* size of sequence element in bytes */
char* block_max; /* maximal bound of the last block */
char* ptr; /* current write pointer */ \
int delta_elems; /* how many elements allocated when the
sequence grows (sequence granularity) */
CvMemStorage* storage; /* where the seq is stored */
CvSeqBlock* free_blocks; /* free blocks