本例程涉及到几个数据结构及方法,CvMemStorage、cvPyrSegmentation()、CvConnectedComp、cvGetSeqElem().
CvMemStorage
CvMemStorage
Growing memory storage
typedef struct CvMemStorage
{
struct CvMemBlock* bottom;/* first allocated block */
struct CvMemBlock* top; /* the current memory block - top of the stack */
struct CvMemStorage* parent; /* borrows new blocks from */
int block_size; /* block size */
int free_space; /* free space in the top block (in bytes) */
} CvMemStorage;
内存存储器是一个可用来存储诸如序列,轮廓,图形,子划分等动态增长数据结构的底层结构。它是由一系列以同等大小的内存块构成,呈列表型 ---bottom 域指的是列首,top 域指的是当前指向的块但未必是列尾.在bottom和top之间所有的块(包括bottom, 不包括top)被完全占据了空间;在 top和列尾之间所有的块(包括块尾,不包括top)则是空的;而top块本身则被占据了部分空间 -- free_space 指的是top块剩馀的空字节数。
新分配的内存缓冲区(或显式的通过 cvMemStorageAlloc 函数分配,或隐式的通过 cvSeqPush, cvGraphAddEdge等高级函数分配)总是起始于当前块(即top块)的剩馀那部分,如果剩馀那部分能满足要求(够分配的大小)。分配后,fr

本文介绍了基于图像金字塔的图像分割方法cvPyrSegmentation,以及与之相关的数据结构CvMemStorage、CvConnectedComp。cvPyrSegmentation用于图像分割,连接部件通过特定阈值确定。CvMemStorage作为内存存储器,按栈的方式管理内存。CvConnectedComp用于表示连接部件的属性,如面积、ROI等。
最低0.47元/天 解锁文章
189





