-
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
2cb3eba
commit 0abc9c8
Showing
18 changed files
with
1,381,643 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,11 @@ | ||
cmake_minimum_required(VERSION 2.8 FATAL_ERROR) | ||
project(passthrough) | ||
find_package(PCL 1.2 REQUIRED) | ||
include_directories(${PCL_INCLUDE_DIRS}) | ||
link_directories(${PCL_LIBRARY_DIRS}) | ||
add_definitions(${PCL_DEFINITIONS}) | ||
add_executable (passthrough passthrough.cpp) | ||
target_link_libraries (passthrough ${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,39 @@ | ||
#include <iostream> | ||
#include <ctime> | ||
#include <pcl/point_types.h> | ||
#include <pcl/filters/passthrough.h> | ||
int | ||
main (int argc, char** argv) | ||
{ srand(time(0)); | ||
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ>); | ||
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_filtered (new pcl::PointCloud<pcl::PointXYZ>); | ||
//填入点云数据 | ||
cloud->width = 5; | ||
cloud->height = 1; | ||
cloud->points.resize (cloud->width * cloud->height); | ||
for (size_t i = 0; i < cloud->points.size (); ++i) | ||
{ | ||
cloud->points[i].x = rand () / (RAND_MAX + 1.0f)-0.5; | ||
cloud->points[i].y = rand () / (RAND_MAX + 1.0f)-0.5; | ||
cloud->points[i].z = rand () / (RAND_MAX + 1.0f)-0.5; | ||
} | ||
std::cerr << "Cloud before filtering: " << std::endl; | ||
for (size_t i = 0; i < cloud->points.size (); ++i) | ||
std::cerr << " " << cloud->points[i].x << " " | ||
<< cloud->points[i].y << " " | ||
<< cloud->points[i].z << std::endl; | ||
// 创建滤波器对象 | ||
pcl::PassThrough<pcl::PointXYZ> pass; | ||
pass.setInputCloud (cloud); | ||
pass.setFilterFieldName ("z"); | ||
pass.setFilterLimits (0.0, 1.0); | ||
//pass.setFilterLimitsNegative (true); | ||
pass.filter (*cloud_filtered); | ||
|
||
std::cerr << "Cloud after filtering: " << std::endl; | ||
for (size_t i = 0; i < cloud_filtered->points.size (); ++i) | ||
std::cerr << " " << cloud_filtered->points[i].x << " " | ||
<< cloud_filtered->points[i].y << " " | ||
<< cloud_filtered->points[i].z << std::endl; | ||
return (0); | ||
} |
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(voxel_grid) | ||
find_package(PCL 1.2 REQUIRED) | ||
include_directories(${PCL_INCLUDE_DIRS}) | ||
link_directories(${PCL_LIBRARY_DIRS}) | ||
add_definitions(${PCL_DEFINITIONS}) | ||
add_executable (voxel_grid voxel_grid.cpp) | ||
target_link_libraries (voxel_grid ${PCL_LIBRARIES}) |
Oops, something went wrong.