opencv fitLine 总是崩溃 [英] opencv fitLine always crashes

查看:216
本文介绍了opencv fitLine 总是崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用 fitLine 但它总是崩溃.我已经尝试修改输入数据(cv::Mat, std::vector)和输出数据(cv::Vect4dstd::vector(2)std::vector(4)) 格式.

Hi i try to use fitLine but it always crashes. I already tried to modify input data (cv::Mat, std::vector<cv::Pointd>) and output data(cv::Vect4d, std::vector<cv::Pointd>(2), std::vector<double>(4)) formats.

这是我的代码:

std::vector<cv::Point2d> points;
// [...] // push_back some (26) points
std::vector<double> line(4,0);
cv::fitLine(points,line,CV_DIST_L2,0,0.01,0.01);

现在崩溃了.我正在使用带有 opencv 2.41 版本的 winxp VS2010我没有调用堆栈,崩溃似乎发生在 kernel32.dll xstring

now it crashes. Iam using winxp VS2010 with a opencv 2.41 build I got no call stack and the crash seems to happen in kernel32.dll xstring

我的失败在哪里?

附注:我在 opencv 问答论坛上发布了这个问题,但在查看问题历史后,我对快速解决方案不是很自信.

PS: i posted the question in the opencv Q&A Forum, but after a look into the question history iam not very confident about a fast solution.

推荐答案

好吧我低估了 opencv 站点:http://answers.opencv.org/question/14547/fitline-always-crashes/?answer=14550#post-id-14550

Ok i underestimated the opencv site: http://answers.opencv.org/question/14547/fitline-always-crashes/?answer=14550#post-id-14550

解决办法是:只支持浮点输入数据.

The solution is: only float input data is supported.

std::vector<cv::Point2f> points;
// [...] // push_back some (26) points
cv::Vec4f line;
cv::fitLine(points,line,CV_DIST_L2,0,0.01,0.01);

会起作用

这篇关于opencv fitLine 总是崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆