Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/image-processing/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/opencv/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Image processing 转换向量<;点>;垫_Image Processing_Opencv_Vector - Fatal编程技术网

Image processing 转换向量<;点>;垫

Image processing 转换向量<;点>;垫,image-processing,opencv,vector,Image Processing,Opencv,Vector,我尝试使用opencv2.1中的函数fitLine(),但需要将我的向量转换为Mat。我该怎么做 vector<Point> line_points; Vec4f line; fitLine(line_points, line, CV_DIST_L2, 0.0, 0.01, 0.01); 矢量线_点; Vec4f线; fitLine(直线点、直线、CV距离L2、0.0、0.01、0.01); 实际上非常简单-Mat提供了一个构造函数,用于点向量和Mat之间的转换。您所需要的就

我尝试使用
opencv2.1
中的函数
fitLine()
,但需要将我的
向量
转换为Mat。我该怎么做

 vector<Point> line_points;
 Vec4f line;
 fitLine(line_points, line, CV_DIST_L2, 0.0, 0.01, 0.01);
矢量线_点;
Vec4f线;
fitLine(直线点、直线、CV距离L2、0.0、0.01、0.01);

实际上非常简单-
Mat
提供了一个构造函数,用于点向量和
Mat
之间的转换。您所需要的就是:

fitLine(Mat(line_points), line, CV_DIST_L2, 0.0, 0.01, 0.01);

提到了这一点。

Mat Mat=Mat(直线点);语义问题:不允许将函数样式从“Vector”转换为“cv::Mat”。奇怪,它在我的代码中起作用。。。确保您使用的是
std::vector
,而不是您自己的
vector
实现。