-
Notifications
You must be signed in to change notification settings - Fork 7
/
CapturePointCloud.cpp
37 lines (29 loc) · 1.09 KB
/
CapturePointCloud.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <iostream>
#include <thread>
#include "MechEyeApi.h"
#include "SampleUtil.h"
#include "PclUtil.h"
int main()
{
mmind::api::MechEyeDevice device;
if (!findAndConnect(device))
return -1;
mmind::api::PointXYZMap pointXYZMap;
showError(device.capturePointXYZMap(pointXYZMap));
mmind::api::PointXYZBGRMap pointXYZBGRMap;
showError(device.capturePointXYZBGRMap(pointXYZBGRMap));
std::string pointCloudPath = "PointCloudXYZ.ply";
pcl::PointCloud<pcl::PointXYZ> pointCloud(pointXYZMap.width(), pointXYZMap.height());
toPCL(pointCloud, pointXYZMap);
viewPCL(pointCloud);
savePLY(pointXYZMap, pointCloudPath);
std::string colorPointCloudPath = "PointCloudXYZRGB.ply";
pcl::PointCloud<pcl::PointXYZRGB> colorPointCloud(pointXYZBGRMap.width(),
pointXYZBGRMap.height());
toPCL(colorPointCloud, pointXYZBGRMap);
viewPCL(colorPointCloud);
savePLY(pointXYZBGRMap, colorPointCloudPath);
device.disconnect();
std::cout << "Disconnect Mech-Eye Success." << std::endl;
return 0;
}