Das Problem mit der Erreichbarkeit der HS-Koblenz ist behoben. Es können sich wieder alle anmelden.

Commit c627d2f1 authored by Patrik Schmidt's avatar Patrik Schmidt 🤖
Browse files

finishes filtering tutorial

parent 6c9b653b
......@@ -3,8 +3,8 @@ project(pcl_filtering)
include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINTIONS})
add_definitions(-DRESOURCES_PATH="${RESOURCES_PATH}")
set(CMAKE_CXX_STANDARD 14)
add_executable(pcl_filtering main.cpp)
target_link_libraries(pcl_filtering ${PCL_COMMON_LIBRARIES} ${PCL_IO_LIBRARIES} ${PCL_VISUALIZATION_LIBRARIES})
#target_link_libraries(pcl_tutorial ${PCL_LIBRARIES})
target_link_libraries(pcl_filtering ${PCL_LIBRARIES})
......@@ -6,13 +6,16 @@
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <pcl/visualization/cloud_viewer.h>
#include <pcl/filters/statistical_outlier_removal.h>
int
main (int argc, char** argv)
{
//Filtering
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ>);
pcl::io::loadPCDFile ("../../room_scan1.pcd", *cloud);
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_filtered (new pcl::PointCloud<pcl::PointXYZ>);
pcl::io::loadPCDFile (RESOURCES_PATH "/table.pcd", *cloud);
pcl::visualization::CloudViewer viewer ("Demo Viewer");
viewer.showCloud(cloud);
......@@ -21,5 +24,27 @@ main (int argc, char** argv)
}
pcl::StatisticalOutlierRemoval<pcl::PointXYZ> sor;
sor.setInputCloud (cloud);
sor.setMeanK (50);
sor.setStddevMulThresh (1.0);
sor.filter (*cloud_filtered);
std::cerr << "Cloud after filtering: " << std::endl;
std::cerr << *cloud_filtered << std::endl;
pcl::PCDWriter writer;
writer.write<pcl::PointXYZ> (RESOURCES_PATH "/table_filtered.pcd", *cloud_filtered, false);
sor.setNegative (true);
sor.filter (*cloud_filtered);
writer.write<pcl::PointXYZ> ("table_scene_lms400_outliers.pcd", *cloud_filtered, false);
viewer.showCloud(cloud_filtered);
while(!viewer.wasStopped()){
}
return (0);
}
\ No newline at end of file
......@@ -3,7 +3,8 @@ project(pcl_segmentation)
include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINTIONS})
add_definitions(-DRESOURCES_PATH="${RESOURCES_PATH}")
set(CMAKE_CXX_STANDARD 14)
add_executable(pcl_segmentation main.cpp)
target_link_libraries(pcl_segmentation ${PCL_COMMON_LIBRARIES} ${PCL_IO_LIBRARIES})
target_link_libraries(pcl_segmentation ${PCL_LIBRARIES})
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment