-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Hao Guo <[email protected]>
- Loading branch information
1 parent
fbf2e14
commit 2cb3eba
Showing
33 changed files
with
156,102 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
cmake_minimum_required(VERSION 2.8 FATAL_ERROR) | ||
project(cloud_viewer) | ||
find_package(PCL 1.2 REQUIRED) | ||
include_directories(${PCL_INCLUDE_DIRS}) | ||
link_directories(${PCL_LIBRARY_DIRS}) | ||
add_definitions(${PCL_DEFINITIONS}) | ||
add_executable (cloud_viewer cloud_viewer.cpp) | ||
target_link_libraries (cloud_viewer ${PCL_LIBRARIES}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#include <pcl/visualization/cloud_viewer.h> | ||
#include <iostream> | ||
#include <pcl/io/io.h> | ||
#include <pcl/io/pcd_io.h> | ||
|
||
int user_data; | ||
void | ||
viewerOneOff (pcl::visualization::PCLVisualizer& viewer) | ||
{ | ||
viewer.setBackgroundColor (1.0, 0.5, 1.0); | ||
pcl::PointXYZ o; | ||
o.x = 1.0; | ||
o.y = 0; | ||
o.z = 0; | ||
viewer.addSphere (o, 0.25, "sphere", 0); | ||
std::cout << "i only run once" << std::endl; | ||
|
||
} | ||
|
||
void | ||
viewerPsycho (pcl::visualization::PCLVisualizer& viewer) | ||
{ | ||
static unsigned count = 0; | ||
std::stringstream ss; | ||
ss << "Once per viewer loop: " << count++; | ||
viewer.removeShape ("text", 0); | ||
viewer.addText (ss.str(), 200, 300, "text", 0); | ||
//FIXME: possible race condition here: | ||
user_data++; | ||
} | ||
|
||
int | ||
main () | ||
{ | ||
pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZRGBA>); | ||
pcl::io::loadPCDFile ("my_point_cloud.pcd", *cloud); | ||
pcl::visualization::CloudViewer viewer("Cloud Viewer"); | ||
//showCloud函数是同步的,在此处等待直到渲染显示为止 | ||
viewer.showCloud(cloud); | ||
//该注册函数在可视化时只调用一次 | ||
viewer.runOnVisualizationThreadOnce (viewerOneOff); | ||
//该注册函数在渲染输出时每次都调用 | ||
viewer.runOnVisualizationThread (viewerPsycho); | ||
while (!viewer.wasStopped ()) | ||
{ | ||
//在此处可以添加其他处理 | ||
user_data++; | ||
} | ||
return 0; | ||
} |
Oops, something went wrong.