In this tutorial we will learn how to read point cloud data from a PCD file.
- Open your.pcl file with a reader which can open the file. Print the file on the virtual PDF24 PDF printer. The PDF24 assistant opens, where you can save as a PDF, email, fax, or edit the new file. More about the PDF24 Creator.
- Right-click a file with the extension whose association you want to change, and then click Open With. In the Open With dialog box, click the program whith which you want the file to open, or click Browse to locate the program that you want. Select the Always use.
First, create a file called, let’s say, pcd_read.cpp
in your favoriteeditor, and place the following code inside it:
Open PCL File To open PCL file you need to find an application which works with that kind of file. PCL file extension is used by operating systems to recognize files with content of type PCL. Here is some information which will get you started. FormView is another free PCL viewer that will let you open and read PCL files on your PC. It lets you open single or multiple PCL files in separate windows. You can easily zoom in and zoom out of a PCL file to view it closely. The zoom tools are available on the tool bar of this software’s interface.
Pcl File Reader
Now, let’s break down the code piece by piece.
creates a PointCloud<PointXYZ> boost shared pointer and initializes it.
loads the PointCloud data from disk (we assume that test_pcd.pcd has alreadybeen created from the previous tutorial) into the binary blob.
Alternatively, you can read a PCLPointCloud2 blob (available only in PCL 1.x). Dueto the dynamic nature of point clouds, we prefer to read them as binary blobs,and then convert to the actual representation that we want to use.
How To Open Pcl Files
reads and converts the binary blob into the templated PointCloud format, hereusing pcl::PointXYZ as the underlying point type.
Finally:
is used to show the data that was loaded from file.
Add the following lines to your CMakeLists.txt file:
After you have made the executable, you can run it. Simply do:
You will see something similar to:
Note that if the file test_pcd.pcd does not exist (either it hasn’t beencreated or it has been erased), you should get an error message such as:
If you've ever saved a file instead of printing it, chances are good that in so doing you created a PCL (Printer Command Language) file. Or maybe you decided to send a document to the print queue instead of printing it immediately? This too generates a PCL file. But what happens when you need to view a PCL file after the fact, possibly months later? This can be problematic because there are only a few programs out there that help you view PCL files (and most are very expensive).
The good news is, here at CoolUtils we are proud to introduce one of our newest tools: the free PCL Viewer! Now you can conveniently view PCL files with just a few quick clicks. Once you've downloaded your copy of our free PCL Viewer, simply indicate which files you'd like to view and the program handles the rest. Did we mention that it's free?
Loaded with options, the free PCL Viewer lets you adjust the size of your PCL files so that you can view them full size or as thumbnail images. You can view them as a file list with details, or you can choose to look at them in full screen mode. You can even share your PCL files by sending them out as attachments from within the PCL Viewer itself!
If you're looking for a powerful tool that not only gets the job done, but is free as well - this is the one. Download your copy today and experience for yourself how beneficial the PCL Viewer can be. Note: although the free viewer will not let you convert your PCL files to other formats, it's still possible with the Total PDF Converter. Check it out here to learn more.
While you're at it, take a moment to explore all of our great software solutions. Like us on Facebook, follow us on Twitter and visit our blog.