16 #define _USE_MATH_DEFINES
20 #include <open3d/Open3D.h>
21 #include <visiontransfer/deviceenumeration.h>
22 #include <visiontransfer/imagetransfer.h>
23 #include <visiontransfer/imageset.h>
24 #include <visiontransfer/reconstruct3d.h>
30 using namespace visiontransfer;
32 int main(
int argc,
char** argv) {
36 <<
"Usage: " << argv[0] <<
" MODE" << std::endl
38 <<
"Available modes:" << std::endl
39 <<
"0: Display RGBD image" << std::endl
40 <<
"1: Display 3d pointcloud" << std::endl;
43 bool displayPointcloud = (bool)atoi(argv[1]);
48 if(devices.size() == 0) {
49 std::cout <<
"No devices discovered!" << std::endl;
60 open3d::geometry::AxisAlignedBoundingBox bbox(Eigen::Vector3d(-10, -10, 0),
61 Eigen::Vector3d(10, 10, 5));
62 std::shared_ptr<open3d::geometry::PointCloud> cloud(
new open3d::geometry::PointCloud);
63 std::shared_ptr<open3d::geometry::RGBDImage> rgbdImage(
new open3d::geometry::RGBDImage);
66 open3d::visualization::Visualizer vis;
67 vis.CreateVisualizerWindow(
"Nerian 3D viewer", 1280, 768);
68 vis.PrintVisualizerHelp();
69 vis.GetRenderOption().SetPointSize(2);
74 while(!imageTransfer.receiveImageSet(imageSet)) {
75 if(!vis.PollEvents()) {
80 if(displayPointcloud) {
85 cloud->Transform(Eigen::Affine3d(Eigen::AngleAxis<double>(M_PI, Eigen::Vector3d(1.0, 0.0, 0.0))).matrix());
92 if(!vis.HasGeometry()) {
93 if(displayPointcloud) {
94 vis.AddGeometry(cloud);
96 vis.AddGeometry(rgbdImage);
100 vis.UpdateGeometry();
101 if(!vis.PollEvents()) {
108 }
catch(
const std::exception& ex) {
109 std::cerr <<
"Exception occurred: " << ex.what() << std::endl;