points.txt 文件内容如下:
index x1 y1 x2 y2
0 247 372 264 614
1 224 158 246 400
2 389 264 407 509
3 466 43 490 289
4 33 379 49 618
5 237 63 260 305
6 288 151 309 395
string filename="./points.txt";
fstream file;
vector<Point2f>vp1,vp2;
file.open(filename,ios_base::in);
string line;
while (!file.eof())
{
getline(file,line);
int index;
float x1,y1,x2,y2;
stringstream data(line);
data>>index>>x1>>y1>>x2>>y2;
vp1.push_back(Point2f(x1,y1));
vp2.push_back(Point2f(x2,y2));
}