C++ 将CvMat类型的元素推入CvSeq

C++ 将CvMat类型的元素推入CvSeq,c++,c,opencv,C++,C,Opencv,我在这里试图创建一个序列,它将CvMat作为它的元素 for(CvSeq *c = first_contour;c!=NULL;c = c->h_next) { //New Seq created for each component seq in first_contour CvSeq * newSeq = cvCreateSeq(0,sizeof(CvSeq),sizeof(CvMat),storage); cvDrawContours(iOrigi

我在这里试图创建一个序列,它将CvMat作为它的元素

  for(CvSeq *c = first_contour;c!=NULL;c = c->h_next)
   {
    //New Seq created for each component seq in first_contour
    CvSeq * newSeq = cvCreateSeq(0,sizeof(CvSeq),sizeof(CvMat),storage);

    cvDrawContours(iOriginal,c,red,green,0,2,8);
    //Printing the contour no.
    printf("Contour == %d\n",nTmp);

    cvShowImage("Countour Information",iOriginal);

    //Printing the total no of elements in each sequence
    printf("%d Elements",c->total);

    //Creating a matrix with the dimension (total by 2)
    CvMat * matBoundary = cvCreateMat(c->total,2,CV_64FC1);

    //Iterating thru each seq to access its elements and setting it to matrix      matBoundary
    for(int i =0 ;i<c->total;i++)
    {
        CvPoint * p = CV_GET_SEQ_ELEM(CvPoint,c,i);
        cvmSet(matBoundary,i,0,p->x);
        cvmSet(matBoundary,i,1,p->y);
        printf("(%d,%d)\n",p->x,p->y);
    }
    //Pushing new matrix's address in newSeq
    cvSeqPush(newSeq,&matBoundary);

    //Checking the contents of boundary mat
    //for(CvSeq * s = boundarySeq;s!=NULL;s = s->h_next)
    //{
        CvMat * mat = CV_GET_SEQ_ELEM(CvMat,newSeq,1);
        for(int i = 0;i<mat->rows;i++)
        {   
            int x = cvmGet(mat,i,0);
            int y = cvmGet(mat,i,0);
            printf("x=%d y=%d",x,y);
        }
for(CvSeq*c=first\u contour;c!=NULL;c=c->h\u next)
{
//为第一个轮廓中的每个组件序列创建新序列
CvSeq*newSeq=cvCreateSeq(0,sizeof(CvSeq),sizeof(CvMat),存储);
CVDraw等高线(原始、c、红色、绿色、0,2,8);
//打印轮廓编号。
printf(“轮廓==%d\n”,nTmp);
cvShowImage(“Countour信息”,iOriginal);
//打印每个序列中的元素总数
printf(“%d个元素”,c->total);
//创建具有维度的矩阵(总计2)
CvMat*matBoundary=cvCreateMat(c->total,2,CV_64FC1);
//遍历每个seq以访问其元素,并将其设置为matrix matBoundary
for(int i=0;itotal;i++)
{
CvPoint*p=CV_GET_SEQ_ELEM(CvPoint,c,i);
cvmSet(matBoundary,i,0,p->x);
cvmSet(matBoundary,i,1,p->y);
printf((%d,%d)\n),p->x,p->y;
}
//在newSeq中推送新矩阵的地址
cvSeqPush(newSeq和matBoundary);
//检查边界垫的内容
//for(CvSeq*s=boundarySeq;s!=NULL;s=s->h_next)
//{
CvMat*mat=CV_GET_SEQ_ELEM(CvMat,newSeq,1);
for(int i=0;irows;i++)
{   
int x=cvmGet(材料,i,0);
int y=cvmGet(材料,i,0);
printf(“x=%d y=%d”,x,y);
}
有谁能告诉我问题出在哪里,因为我在“newSeq”里什么都没有得到