一、Opencv
1.1 类型转换
(1)将vector<Point2f>转换成vector<Point>
vector<Point2f> vd{ { 1.1, 2.2 }, { 3.3, 4.4 }, {5.5, 6.6} };
vector<Point> v(vd.begin(), vd.end());
2.1 文档数据读取
(1)从txt中读取坐标数据(每一行为 x, y 格式,如下图所示),并赋值给vector<Point>
ifstream infile;
infile.open("distortPoints/"+names[i]+"_points.txt");
if (!infile.is_open()) {
std::cout << "read txt file is failed!" << std::endl;
return false;
}
vector<Point2f> Points;
float x, y;
char delim;
while (infile >> x >> delim>> y) {
Points.emplace_back(Point2f(x, y));
}