开发者

Error on cvApproxPoly function

开发者 https://www.devze.com 2023-04-06 22:40 出处:网络
开发者_高级运维I have the following fragment of code: int count = (int)sizes.size(); CvPoint2D32f p;

开发者_高级运维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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号