haynar
haynar

Reputation: 6030

Error on cvApproxPoly function

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 *

Upvotes: 0

Views: 810

Answers (1)

Kevin
Kevin

Reputation: 76244

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.

Upvotes: 1

Related Questions