Ask Your Question

Revision history [back]

Something like this works

vector<Point3d> x={Point3d(1,2,3),Point3d(4,5,6),Point3d(7,8,9),Point3d(10,11,12),Point3d(13,14,15) };

Mat ww;
Mat wx(x);
convertPointsToHomogeneous(wx,ww);

cout << wx;
cout << ww;

Something like this works

vector<Point3d> x={Point3d(1,2,3),Point3d(4,5,6),Point3d(7,8,9),Point3d(10,11,12),Point3d(13,14,15) };

Mat ww;
Mat wx(x);
convertPointsToHomogeneous(wx,ww);

cout << wx;
cout << ww;
ww.at<double>(1,3)=3;
cout << ww;
convertPointsFromHomogeneous(ww,wx);
cout<<wx;

Something like this works

vector<Point3d> x={Point3d(1,2,3),Point3d(4,5,6),Point3d(7,8,9),Point3d(10,11,12),Point3d(13,14,15) };

Mat ww;
Mat wx(x);
convertPointsToHomogeneous(wx,ww);

cout << wx;
"vector<Point3> to matrix : " << wx.size() << endl <<wx<<endl;
cout << ww;
"vector<Point3> to matrix : " << wx.size() << endl << wx << endl;
cout << "matrix point to homogenous : " << ww.size() << endl << ww << endl;
ww.at<double>(1,3)=3;
cout << ww;
cout << " homogenous to matrix point3d : " << ww << endl;
convertPointsFromHomogeneous(ww,wx);
cout<<wx;
wx = wx.reshape(1, x.size());
cout << " homogenous to matrix point3d : " << wx.size() << endl << wx << endl;

Something like this works

vector<Point3d> x={Point3d(1,2,3),Point3d(4,5,6),Point3d(7,8,9),Point3d(10,11,12),Point3d(13,14,15) };

Mat ww;
Mat wx(x);
convertPointsToHomogeneous(wx,ww);

cout << "vector<Point3> to matrix : " << wx.size() << endl <<wx<<endl;
cout << "vector<Point3> to matrix : " << wx.size() << endl << wx << endl;
convertPointsToHomogeneous(wx,ww);

cout << "matrix point to homogenous : " << ww.size() << endl << ww << endl;
ww.at<double>(1,3)=3;
cout << ww;
cout << " homogenous to matrix point3d : " << ww << endl;
convertPointsFromHomogeneous(ww,wx);
wx = wx.reshape(1, x.size());
cout << " homogenous to matrix point3d : " << wx.size() << endl << wx << endl;