PCL point cloud visualization (no VTK)

tags: PCL learning  Visualize  c++  Video processing

purpose

Convearter from a click cloud.

Code

#include <iostream>
#include <pcl/io/pcd_io.h>
#include <pcl/filters/conditional_removal.h>
#include <pcl/visualization/cloud_viewer.h> 
#include <pcl/visualization/pcl_visualizer.h>

using namespace std;

typedef pcl::PointXYZRGBA PointType;

int main() {
	pcl::PCDReader reader;
	Pcl :: PointCloud <PCL :: Pointxyz> :: Ptr Cloud (New Pcl :: PointCloud <PCL :: Pointxyz>); // Point Cloud to Show
	 Boost :: Shared_Ptr <PCL :: Visualization :: PCLVISUALIZER> M_VIEWER; // Window

	 // read the file
	reader.read("D:/ground_1.pcd", *cloud);

	 // Display window initialization
	m_viewer.reset(new pcl::visualization::PCLVisualizer("viewer", false));
	 m_viewer-> setbackgroundcolor (0, 0, 0); // Set background color
	m_viewer->initCameraParameters();
	 m_viewer-> addcoordinateSystem (); // Add red green blue coordinate axis
	m_viewer->createInteractor();

	
	while (!m_viewer->wasStopped()) {
		m_viewer->spinOnce(1);
		 If (! m_viewer-> updatePointCloud (Cloud-> Makeshared (), "Cloud")) {// pointcloud_xyzrgba is a pointer type, cannot be used (.) operator
			m_viewer->addPointCloud(cloud->makeShared(), "cloud");
		}
	}

	system("pause");
	return 0;
}

Result (origin cloud, no sample)

 :217088

Pay attention

When the number of points in the point cloud is much longer, it takes a long time. You can first sample the point cloud and then display it.

Intelligent Recommendation

PCL visualization [point cloud rendering]

The PCL visualization module provides the function of point cloud rendering.You can specify a field to render visualization. The default coordinate field minimum value is red, and the maximum value is...

Point cloud rendering and visualization (pcl::visualization)

canPCLVisualizerThe visualization class is the most complete visualization class in PCL. Compared with the CloudViewer visualization class,PCLVisualizerIt is more complex and has more comprehensive fu...

[PCL | Visualization] Point cloud multi-window visualization

Attention to the left upper corner and in the lower right corner of each window, the maximum value of X, Y coordinates cannot exceed 1, otherwise the window cannot be displayed! If you want to display...

Point cloud visualization: pcl::visualization::PCLVisualizer class in PCL

The code header file is as follows 1. Read point cloud The point cloud format is XYZRGB, and the background color can be changed 2. Read point cloud point cloud format is XYZ 3. Read point cloud point...

PCL visualization point cloud [color feature]

Depth in color To display point clouds more intuitively, different depth values ​​are displayed as different colors. #include #include <pcl/point_types.h> #include <pcl/io/ply_io.h> #inclu...

More Recommendation

PCL programming problem 3: point cloud visualization

First attach the visual code: The code segment in which the visualization is: There is also a way to write a PCLVisualizer module: It is also possible to implement the operation of the electric cloud ...

PCL Point Cloud Visualization - Transfer Zhangzhi Sheng

#include <iostream> #include <pcl/point_types.h> #include <pcl/point_cloud.h> #include <pcl/visualization/pcl_visualizer.h> int main(int argc, char** argv) { // define a point ...

[PCL] Multi-point cloud visualization window

When visualizing a point cloud, sometimes it is necessary to display a comparison, then it is necessary to display two or more point clouds at the same time. viewer->createViewPort(double Xmin,doub...

Several situations of window point cloud visualization in pcl

1.class pcl::visualization::Cloudviewer (simple function) 2.class pcl::visualization::PCLVisualizer (there are many member functions, the content is very rich, it is the most important class in point ...

Help posts, pcl point cloud visualization.

I have compiled a piece of visual code by myself. It will be very convenient to use it directly in the future, but there are some problems, please pass by to help answer. . Realized function: If one p...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top