2013-04-10 48 views
1

在OpenCV中 - 如何将CvPoint转换为CvSeq?在OpenCV中 - 如何将CvPoint转换为CvSeq?

我有CvPoints,我想用于cvconvexhull2打开函数 - 但它只接受CvSeq作为输入。请帮我在这个转换..

+2

HTTP: //stackoverflow.com/questions/8312102/how-to-insert-a-cvpoint-into-a-cvseq-with-cvinsert – Barshan 2013-04-10 13:20:26

回答

0

据OpenCV的documentation

这里是如何创建不同的OpenCV动态数据结构存储,并填写动态扩展序列:

CvMemStorage* storage = cvCreateMemStorage(0); 
CvSeq* seq = cvCreateSeq(CV_32SC2, sizeof(CvSeq), sizeof(CvPoint), storage); 
int i; 

for(i = 0; i < 10; i++){ 
    CvPoint pt; 
    pt.x = rand(); 
    pt.y = rand(); 
    cvSeqPush(seq, &pt); 
}