如何将dlib中的矩阵转换为std :: vector [英] how to convert a matrix in dlib to a std::vector

查看:214
本文介绍了如何将dlib中的矩阵转换为std :: vector的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在dlib中定义了colume矢量。如何将其转换为std :: vector?

I have a colume vector defined in dlib. How can I convert it to std::vector?

typedef dlib::matrix<double,0,1> column_vector;
column_vector starting_point(4);
starting_point = 1,2,3,4;
std::vector x = ??

谢谢

推荐答案

有很多方法。您可以通过for循环将其复制。或使用采用迭代器的std :: vector构造函数: std :: vector< double> x(starting_point.begin(),starting_point.end())

There are many ways. You could copy it via a for loop. Or use the std::vector constructor that takes iterators: std::vector<double> x(starting_point.begin(), starting_point.end()).

这篇关于如何将dlib中的矩阵转换为std :: vector的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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