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

Commit 1b426462 authored by Patrik Schmidt's avatar Patrik Schmidt 🤖
Browse files

finish registration tutorial

parent c627d2f1
......@@ -10,4 +10,4 @@ find_package(PCL 1.7 REQUIRED)
add_subdirectory(io)
add_subdirectory(visualization)
add_subdirectory(filtering)
add_subdirectory(segmentation)
\ No newline at end of file
add_subdirectory(registration)
\ No newline at end of file
cmake_minimum_required(VERSION 2.8)
project(pcl_segmentation)
project(pcl_registration)
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_LIBRARIES})
add_executable(pcl_registration main.cpp)
target_link_libraries(pcl_registration ${PCL_LIBRARIES})
/*
* PCL sample for segmentation
* PCL sample for registration
*/
#include <iostream>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <pcl/registration/icp.h>
#include <pcl/visualization/cloud_viewer.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 cloud2 (new pcl::PointCloud<pcl::PointXYZ>);
pcl::io::loadPCDFile(RESOURCES_PATH "/room_scan1.pcd", *cloud);
pcl::io::loadPCDFile(RESOURCES_PATH "/room_scan2.pcd", *cloud2);
pcl::visualization::CloudViewer viewer ("Demo Viewer");
viewer.showCloud(cloud);
while(!viewer.wasStopped()){
pcl::IterativeClosestPoint<pcl::PointXYZ, pcl::PointXYZ> icp;
icp.setInputSource(cloud);
icp.setInputTarget(cloud2);
pcl::PointCloud<pcl::PointXYZ>::Ptr Final (new pcl::PointCloud<pcl::PointXYZ>);
icp.align(*Final);
std::cout << "has converged:" << icp.hasConverged() << " score: " <<
icp.getFitnessScore() << std::endl;
std::cout << icp.getFinalTransformation() << std::endl;
}
pcl::visualization::CloudViewer viewer ("Demo Viewer");
viewer.showCloud(Final);
return (0);
}
\ No newline at end of file
......@@ -7,7 +7,7 @@ int
main (int argc, char** argv)
{
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ>);
pcl::io::loadPCDFile (RESOURCES_PATH "/room_scan1.pcd", *cloud);
pcl::io::loadPCDFile (RESOURCES_PATH "/room_scan2.pcd", *cloud);
pcl::visualization::CloudViewer viewer ("Demo Viewer");
viewer.showCloud(cloud);
......
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