cvApproxPoly 函数出错
我有以下代码片段:
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);
但此代码引发异常:错误:cvApproxPoly 中的错误参数(不支持的序列类型) 我的代码有什么问题吗?在文档上,它说 cvApproxPoly 将第一个参数作为 CvSeq *
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 *
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据这篇文章,
cvApproxPoly
给出了如果未为传入的序列设置CV_SEQ_POLYLINE
标志,则会出现错误。尝试将该标志添加到cvCreateSeq
行中。According to this post,
cvApproxPoly
gives an error when theCV_SEQ_POLYLINE
flag isn't set for the sequence you pass in. Try adding that flag to yourcvCreateSeq
line.