本文整理汇总了C++中GLWidget::AddNewStructure方法的典型用法代码示例。如果您正苦于以下问题:C++ GLWidget::AddNewStructure方法的具体用法?C++ GLWidget::AddNewStructure怎么用?C++ GLWidget::AddNewStructure使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GLWidget
的用法示例。
在下文中一共展示了GLWidget::AddNewStructure方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char** argv) {
// Do projective reconstruction
bool is_projective = true;
// Assume noise free
bool has_outliers = false;
// Read 2D points from text file
Mat_<double> x1, x2;
int npts;
if (argc < 2) {
help();
exit(0);
} else {
ifstream myfile(argv[1]);
if (!myfile.is_open()) {
cout << "Unable to read file: " << argv[1] << endl;
exit(0);
} else {
string line;
// Read number of points
getline(myfile, line);
npts = (int) atof(line.c_str());
x1 = Mat_<double>(2, npts);
x2 = Mat_<double>(2, npts);
// Read the point coordinates
for (int i = 0; i < npts; ++i) {
getline(myfile, line);
stringstream s(line);
string cord;
s >> cord;
x1(0, i) = atof(cord.c_str());
s >> cord;
x1(1, i) = atof(cord.c_str());
s >> cord;
x2(0, i) = atof(cord.c_str());
s >> cord;
x2(1, i) = atof(cord.c_str());
}
myfile.close();
}
}
// Call the reconstruction function
vector < Mat_<double> > points2d;
points2d.push_back(x1);
points2d.push_back(x2);
Mat_<double> points3d_estimated;
vector < Mat > Ps_estimated;
reconstruct(points2d, Ps_estimated, points3d_estimated, is_projective,
has_outliers);
// Print output
cout << endl;
cout << "Projection Matrix of View 1: " << endl;
cout << "============================ " << endl;
cout << Ps_estimated[0] << endl << endl;
cout << "Projection Matrix of View 1: " << endl;
cout << "============================ " << endl;
cout << Ps_estimated[1] << endl << endl;
cout << "Reconstructed 3D points: " << endl;
cout << "======================== " << endl;
cout << points3d_estimated << endl;
// Display 3D points using Qt widget
// Create the structure
vector<Vec3f> struct_coords;
for (int i = 0; i < npts; ++i) {
Vec3f point3d((float) points3d_estimated(0, i),
(float) points3d_estimated(1, i),
(float) points3d_estimated(2, i));
struct_coords.push_back(point3d);
}
// Qt stuff
QApplication app(argc, argv);
GLWidget window;
window.AddNewStructure(struct_coords);
window.resize(800, 600);
window.show();
return app.exec();
}