当前位置:网站首页>【OpenCV】使用 FileStorage 读写 Eigen 向量
【OpenCV】使用 FileStorage 读写 Eigen 向量
2022-04-23 05:48:00 【mightbxg】
在自己的 cpp 中加入以下代码:
namespace cv {
template <typename _Scalar, int _Dim>
class DataType<Eigen::Matrix<_Scalar, _Dim, 1>> {
public:
typedef Eigen::Matrix<_Scalar, _Dim, 1> value_type;
typedef Eigen::Matrix<typename DataType<_Scalar>::work_type, _Dim, 1> work_type;
typedef _Scalar channel_type;
enum {
generic_type = 0,
channels = _Dim,
fmt = traits::SafeFmt<channel_type>::fmt + ((channels - 1) << 8)
};
typedef Vec<channel_type, channels> vec_type;
};
} //namespace cv
然后就可以像 cv::Point_<T>
、cv::Point3_<T>
那样使用 cv::FileStorage
来读写 Eigne::Vector2f
、Eigen::Vector3d
等类型,包括相关序列类型 std::vector<...>
和 std::vector<std::vector<...>>
版权声明
本文为[mightbxg]所创,转载请带上原文链接,感谢
https://blog.csdn.net/mightbxg/article/details/117950625
边栏推荐
猜你喜欢
[leetcode 202] happy number
Integration and induction of knowledge points of automatic control principle (Han min version)
scikit-learn sklearn 0.18 官方文档中文版
Advanced operation of idea debug
类和对象的初始化(构造函数与析构函数)
GDAL+OGR学习
Database - sorting data
[leetcode 54] spiral matrix
A solution to replace not in in SQL
C language file operation
随机推荐
POI and easyexcel exercises
Basemap库绘制地图
[leetcode169] most elements
[leetcode 150] evaluation of inverse Polish expression
爬取彩票数据
Busybox initrd and initialization process
[leetcode 459] duplicate substring
深拷贝和浅拷贝的区别
Rust 中的 Rc智能指针
Export of data
Substring Inversion (Easy Version)
Log4j2跨线程打印traceId
SVN简单操作命令
基于pygame库编写的五子棋游戏
Generation of verification code
The onnx model of yolov5 removes the transfer layer
A solution to replace not in in SQL
[leetcode 6] zigzag transformation
C语言实现2048小游戏方向合并逻辑
几行代码教你爬取LOL皮肤图片