1

如何将 cvSeq* 转换为 vector< vector< Point >> ?

这是我的代码:

first_contour = NULL;

cvFindContours(
    src_copy_gray,
    storage,
    &first_contour,
    sizeof(CvContour),
    CV_RETR_TREE  );

// Finding convex Hull
CvMemStorage* hull_storage = cvCreateMemStorage();
CvSeq* retHulls = NULL;
CvMat* tmp;
cv::Mat tmp22;
// drawing contours 
ff = cv::Mat::zeros( tmp4.size(), CV_8UC3 );
draw =  new IplImage(ff);
for(CvSeq* i = first_contour; i != 0; i = i->h_next){
        cvDrawContours(draw,i,cv::Scalar(255,255,0,0),cv::Scalar(255,0,0,0),0,1,8);
        retHulls = cvConvexHull2(i,hull_storage,CV_CLOCKWISE,1);
        cvDrawContours(draw,retHulls,cv::Scalar(255,0,0,0),cv::Scalar(255,0,0,0),0,1,8);

        for (int k = 0; k < vertices_number; k++)
        {
        if(pointPolygonTest( ??????, cv::Point2f(verticesB[k].x,verticesB[k].y), false )>0){
                cv::line( ff,cv::Point2f(verticesB[k].x,verticesB[k].y),        cv::Point2f(verticesB[k].x,verticesB[k].y), cv::Scalar(255,0,255 ), 2, 8 );     
            }

        }
    }

我应该放什么而不是??????我需要一个 cv::_InputArray,但我不知道如何将 cvseq* retHulls 转换为 cv::_InputArray 之类的向量向量。

4

0 回答 0