forked from royshil/SfM-Toy-Library
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcloud_viewer.cpp
52 lines (43 loc) · 1.47 KB
/
cloud_viewer.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
* cloud_viewer.cpp
* EyeRingOpenCV
*
* Created by Roy Shilkrot on 12/17/11.
* Copyright 2011 MIT. All rights reserved.
*
*/
#include <pcl/common/common.h>
#include <pcl/visualization/cloud_viewer.h>
#include <pcl/io/io.h>
#include <pcl/io/file_io.h>
#include <pcl/io/pcd_io.h>
pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloud;
void
viewerOneOff (pcl::visualization::PCLVisualizer& viewer)
{
viewer.setBackgroundColor(255,255,255);
// pcl::visualization::PointCloudColorHandlerRGBField<pcl::PointXYZRGB> rgb(cloud);
// viewer.addPointCloud<pcl::PointXYZRGB> (cloud, rgb, "sample cloud");
}
int main ()
{
cloud.reset(new pcl::PointCloud<pcl::PointXYZRGB>);
pcl::io::loadPCDFile ("/Users/royshilkrot/Downloads/EyeRing-OpenCV/output.pcd", *cloud);
pcl::visualization::CloudViewer viewer("Cloud Viewer");
//blocks until the cloud is actually rendered
viewer.showCloud(cloud);
//use the following functions to get access to the underlying more advanced/powerful
//PCLVisualizer
//This will only get called once
viewer.runOnVisualizationThreadOnce (viewerOneOff);
//This will get called once per visualization iteration
// viewer.runOnVisualizationThread (viewerPsycho);
while (!viewer.wasStopped ())
{
//you can also do cool processing here
//FIXME: Note that this is running in a separate thread from viewerPsycho
//and you should guard against race conditions yourself...
// user_data++;
}
return 0;
}