Ubuntu Configuration Install PCL

Source: Internet
Author: User
Tags git clone

Ubuntu Configuration Install PCL

has been developed under the Mac, now start Ubuntu, but also to learn about Linux under the source code compilation installation process.

About PCL

The PCL (Point Cloud Library) is a large cross-platform open-source C + + programming library built on the basis of the research on the previous points cloud, which realizes a large number of cloud-related general-purpose algorithms and efficient data structures, which involves point cloud acquisition, filtering, segmentation, registration, retrieval, feature extraction, recognition and tracking. , surface reconstruction, visualization, and so on. supports a variety of operating system platforms that can be run on Windows, Linux, Android, Mac OS X, and some embedded real-time systems. If OpenCV is the crystallization of 2D information acquisition and processing, then PCL has the same status as 3D information acquisition and processing, and PCL is the BSD licensing method that can be used for commercial and academic applications free of charge.

Specific Step 1. Install dependencies
apt-get update &&         apt-get install -y libflann-dev         libvtk5-dev         libqhull-dev
2. Download the source code
git clone https://github.com/PointCloudLibrary/pclcd pcl
3. Configuring the Installation
cmake -DCMAKE_BUILD_TYPE=Release .make -j 8 # job数量根据自身的CPU核数定sudo make install
4. Installation directory
    • A header file (such as VTK) installed via apt is /usr/include inside
    • Dynamic link libraries (such as VTK) installed via apt are /usr/lib inside
    • Build your own installed header files (such as PCL) /usr/local/include inside
    • Self-compiled and installed dynamic-link libraries (such as PCL) /usr/local/lib inside

The above folder CMakeLists.txt find_package() can be found in the Write commands, listed here just to get a better understanding of the details, or some code completion tool will require the specific path of the library

Test

Main.cpp

#include <pcl/common/common_headers.h> #include <pcl/visualization/pcl_visualizer.h>boost::shared_ptr <pcl::visualization::P clvisualizer> Simplevis (PCL::P OINTCLOUD&LT;PCL::P ointxyz>::constptr Cloud) {boost:    : shared_ptr<pcl::visualization::P clvisualizer> Viewer (new pcl::visualization::P clvisualizer ("3D viewer");    Viewer->setbackgroundcolor (0, 0, 0);    VIEWER-&GT;ADDPOINTCLOUD&LT;PCL::P ointxyz> (Cloud, "sample Cloud");    Viewer->setpointcloudrenderingproperties (pcl::visualization::P cl_visualizer_point_size, 3, "Sample Cloud");    Viewer->addcoordinatesystem (1.0);    Viewer->initcameraparameters (); return (viewer);} int main (int argc, char **argv) {//Create point Cloud PCL::P OINTCLOUD&LT;PCL::P ointxyz>::P tr basic_cloud_ptr (New PCL:    :P OINTCLOUD&LT;PCL::P ointxyz>);            for (float Z ( -1.0), z <= 1.0; z + = 0.05) {for (float angle (0.0); angle <= 360.0; angle + = 5) { Bottom surface is elliptical PCL::P oinTXYZ Basic_point;            Basic_point.x = 0.5 * COSF (PCL::d Eg2rad (angle));            Basic_point.y = Sinf (PCL::d Eg2rad (angle));            Basic_point.z = Z;        Basic_cloud_ptr->points.push_back (Basic_point);    }} basic_cloud_ptr->width = (int) basic_cloud_ptr->points.size ();    Basic_cloud_ptr->height = 1;    Boost::shared_ptr<pcl::visualization::P clvisualizer> Viewer;    Viewer = Simplevis (basic_cloud_ptr);        while (!viewer->wasstopped ()) {viewer->spinonce (100);    Boost::this_thread::sleep (boost::p osix_time::microseconds (100000)); } return 0;}

CMakeLists.txt

cmake_minimum_required(VERSION 3.0)project(demo01)set(CMAKE_CXX_STANDARD 11)find_package(PCL REQUIRED)include_directories(${PCL_INCLUDE_DIRS})link_directories(${PCL_LIBRARY_DIRS})add_definitions(${PCL_DEFINITIONS})add_executable(demo01 main.cpp)target_link_libraries (demo01 ${PCL_LIBRARIES})

Command

cmake .make./demo01

Run results

Summary

Before the environment is apt a key solution, on the Mac is also brew a bit, did not compile from the source code, the experiment can be said to learn more about the underlying details, learned a lot.

Linux on the development is very comfortable ~

Ubuntu Configuration Install PCL

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.