开发者_高级运维I have the following fragment of code:
int count = (int)sizes.size();
CvPoint2D32f p;
CvSeq* seq = cvCreateSeq(CV_SEQ_KIND_GENERIC|CV_32FC2, sizeof(CvSeq), sizeof(CvPoint2D32f), memStorage1);
CvSeq* result;
for (int i=0;i<count;i++) {
p.x = sizes[i];
p.y = depths[i];
cvSeqPush(seq, &p);
}
result = cvApproxPoly(seq, sizeof(CvPoint2D32f), memStorage2, CV_POLY_APPROX_DP, 3, 0);
but this code throws exception: Error: Bad argument (Unsupported sequence type) in cvApproxPoly
what's wrong in my code? on documentation it says that cvApproxPoly takes first argument as CvSeq *
According to this post, cvApproxPoly
gives an error when the CV_SEQ_POLYLINE
flag isn't set for the sequence you pass in. Try adding that flag to your cvCreateSeq
line.
精彩评论