A point cloud viewer implemented with Qt and the excellent Point Cloud Library (PCL). Based on the official tutorial.
- Display Colorized point cloud
- Support pcd and ply files
- Tested with 10 million points
- Point colors adjustment
- Point size adjustment
Just choose a pcd or ply file and click the Load
button.
Mouse:
Drag with left button - adjust viewing angle
Drag with middle button - pan
Scroll - zoom
Keyboard:
f - fly to point
j - take screenshot
g - toggle scale grid
u - toggle lookup table
o - toggle perspective/parallel view
The project is developed on Ubuntu 14.04 with the following libraries:
-
Point Cloud Library (PCL) 1.7.2 (http://pointclouds.org/downloads/linux.html)
-
Qt 5.6 (http://www.qt.io/download/)
-
Install PCL and Qt
-
Execute the following command
cd <project_dir>
mkdir build
cd build
cmake ..
make
cd <project_dir>/build
./pcviewer
Test pcd files can be generated by the following commands:
cd <project_dir>/build
./gen_pcd
gen_pcd
will generate 7 pcd files, with number of points ranging from 10 to 10 million.
Following the suggestion of the instruction, I use C++, Qt, and PCL for this project.
I tried Unity first since I'm more familiar with it. With a free plugin (https://www.assetstore.unity3d.com/en/#!/content/19811), It's pretty easy to create a prototype.
Unity has many advantages, like fast iteration (the time between clicking build and seeing the result can be measured in milliseconds), easy development, fancy effects, and cross-platform runtime (Windows, Mac, iOS, Android, and Linux).
However, Unity is proprietary and may not be feasible in every organization. It's runtime may be too big, and the development environment is Mac and Windows only. So I went with PCL and Qt.
Although the error messages are dreadful, and the iteration is painfully slow, turned out PCL has many features implemented already.
The requirement has 3 main features, read()
, render()
, and handleInput
.
read()
gets a Filename that denotes a point cloud file, parses the file and generates an in-memory Model:
Model read(Filename)
render()
draws the Model to the screen using a Config (color options, point size, etc.):
render(Model, Config)
handleInput()
catches an InputEvent at runtime and updates the current Model or Config, which may cause another render()
call:
(Model, Config) handleInput(InputEvent, Model, Config)
The tutorial from PCL's official site has provided a few examples that can be used as the basis for this assignment. This project is based on the "Create a PCL visualizer in Qt to colorize clouds" example, which already has many features required by the assignment.
I added the following features:
- separate file selection and loading
- remember last selected directory
- option to switch to the original point colors
- display loading dialog
Due to limited time, I decided to focus on these basic usage features. The feature set is small, but it should do it well.
We can test read()
by comparing in-memory model and the input file, and we can test render()
by comparing screenshots generated by different versions of render()
.
One way to test handleInput
is to generate InputEvents and compare updated Model and Config with a programatically created one.
However, since most of the functions are implemented in PCL, testing for these functions seems like testing PCL instead of this project. So I went with manual tests with automatically generated pcd files.