Ask Your Question
2

Convert vector<Point> to Mat with 2 columns

asked 2016-08-16 12:15:22 -0600

Nbb gravatar image

How can I do the following ? I tried it below but my matrix is of size 2 rows and 1 column. Its supposed to be 2 rows and 2 columns

vector<Point2d> Crds;

Crds.push_back(Point2d(1, 1));
Crds.push_back(Point2d(2, 2));

Mat crd = Mat(Crds);
cout << crd.cols << endl << endl;

cout << crd << endl;
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2016-08-16 18:49:43 -0600

i think you are looking for

Mat crd = Mat(Crds.size(),2,CV_64F,Crds.data());
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2016-08-16 12:15:22 -0600

Seen: 8,616 times

Last updated: Aug 16 '16