Giter Site home page Giter Site logo

dtcmlops / pcl_visualizer Goto Github PK

View Code? Open in Web Editor NEW
8.0 3.0 4.0 678 KB

Visualizer for 3D point cloud using PCL Library 1.9.1

Home Page: https://raw.githubusercontent.com/danielTobon43/pcl_visualizer/master/example/example.png

License: GNU General Public License v3.0

CMake 87.38% C++ 6.23% Shell 5.43% Dockerfile 0.95%
pcl pcl-library point-cloud pcd ply xyz pcl-viewer cmake cpp c-plus-plus computer-vision clang-format

pcl_visualizer's Introduction

pcl_visualizer

example workflow

Visualizer for a 3D point cloud using PCL Library 1.8...1.12.1


This program display a PCL viewer for input point cloud data

Input file structure support

Format Description
.pcd Point Cloud Data file format
.ply Polygon file format
.txt Text file format
.xyz X Y Z Text file format

Example

Screenshot from 2022-06-03 08-21-25 Screenshot from 2022-06-03 08-26-18 Screenshot from 2022-06-03 08-31-38

Help

| Help:
-------
          p, P   : switch to a point-based representation
          w, W   : switch to a wireframe-based representation (where available)
          s, S   : switch to a surface-based representation (where available)

          j, J   : take a .PNG snapshot of the current window view
          c, C   : display current camera/window parameters
          f, F   : fly to point mode

          e, E   : exit the interactor
          q, Q   : stop and call VTK's TerminateApp

           +/-   : increment/decrement overall point size
     +/- [+ ALT] : zoom in/out 

          g, G   : display scale grid (on/off)
          u, U   : display lookup table (on/off)

    o, O         : switch between perspective/parallel projection (default = perspective)
    r, R [+ ALT] : reset camera [to viewpoint = {0, 0, 0} -> center_{x, y, z}]
    CTRL + s, S  : save camera parameters
    CTRL + r, R  : restore camera parameters

    ALT + s, S   : turn stereo mode on/off
    ALT + f, F   : switch between maximized window mode and original size

          l, L           : list all available geometric and color handlers for the current actor map
    ALT + 0..9 [+ CTRL]  : switch between different geometric handlers (where available)
          0..9 [+ CTRL]  : switch between different color handlers (where available)

    SHIFT + left click   : select a point (start with -use_point_picking)

          x, X   : toggle rubber band selection mode for left mouse button

Compilation

You can either compile the source code with CMake or download a pre-compiled docker image.

Compile from source code

This program depends on PCL, VTK and OpenGL.

  1. In the root folder create a build directoy
mkdir build
  1. Create compilation files
cd build/ && cmake ../src/
  1. Compile project
make

Expected output

Screenshot from 2022-06-03 08-35-43

Test

./pcl-visualizer <cloud file> 

Expected output

Screenshot from 2022-06-03 08-39-30

Download docker image

This image is based on Linux Alpine 3.15 and has the following packages installed:

  • VTK-9.1.0
  • PCL-1.12.0
  • Eigen-3.7.7
  • Flann-1.9.1
  • Boost-1.77.0

It's a lightweight [1.27GB] PCL docker image with the visualization module pre-compiled that uses the pcl-visualizer project to display a cloud

PCL modules:

The following subsystems will be built:
--   common
--   kdtree
--   octree
--   search
--   geometry
--   io
--   visualization
-- The following subsystems will not be built:
--   sample_consensus: Disabled manually.
--   filters: Disabled manually.
--   2d: Disabled manually.
--   features: Disabled manually.
--   ml: Disabled manually.
--   segmentation: Disabled manually.
--   surface: Disabled manually.
--   registration: Disabled manually.
--   keypoints: Disabled manually.
--   tracking: Disabled manually.
--   recognition: Disabled manually.
--   stereo: Disabled manually.
--   apps: Disabled by default
--   benchmarks: Disabled by default
--   outofcore: Disabled manually.
--   examples: Code examples are disabled by default.
--   people: Disabled manually.
--   simulation: Disabled by default.
--   global_tests: Disabled by default
--   tools: Disabled manually.
-- Configuring done
-- Generating done
  1. Download image from Docker hub
docker pull danieltobon43/pcl-visualizer:1.0-alpine3.15
  1. Create a visualizer.sh file with executable permissions.

Screenshot from 2022-06-03 10-16-13

  1. Copy the next content into the visualizer.sh file (remember to update PATH/TO/YOUR/PCD/PLY/FOLDER accordingly):
# Allow X server connection
xhost +local:root
docker run -it --rm \
    --env="DISPLAY" \
    --env="QT_X11_NO_MITSHM=1" \
    --name="pcl-container" \
    --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \
    --volume=PATH/TO/YOUR/PCD/PLY/FOLDER:/tmp \
    danieltobon43/pcl-visualizer:1.0-alpine3.15 /tmp/$1
# Disallow X server connection
xhost -local:root

e.g.

I have a folder called files at /home/user/Downloads/files with .pcd files. Then, replacing the line:

--volume=/home/user/Downloads/files:/tmp and saving the changes will have:

# Allow X server connection
xhost +local:root
docker run -it --rm \
    --env="DISPLAY" \
    --env="QT_X11_NO_MITSHM=1" \
    --name="pcl-container" \
    --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \
    --volume=/home/user/Downloads/files:/tmp \
    danieltobon43/pcl-visualizer:1.0-alpine3.15 /tmp/$1
# Disallow X server connection
xhost -local:root

This command will run a docker container called: "pcl-container" with the danieltobon43/pcl-visualizer:1.0-alpine3.15 image.

The environment variables QT_X11_NO_MITSHM, DISPLAY will activate a tunel for displaying a GUI in docker (More info here).

The --volume=/home/user/Downloads/files:/tmp line will mount the files folder from the host machine (my PC) into the location especified in the docker container, e.g /tmp folder in this case. This will allow to the project pcl-visualizer have access to the .pcd/.ply files inside the container.

Finally, the last line is the call to the danieltobon43/pcl-visualizer:1.0-alpine3.15 /tmp/$1 image with a command line parameter given by the /tmp/$1 file-path.

  1. Run a docker container with the following command:
./visualizer.sh YOUR-PCD-PLY-FILENAME

e.g.

./visualizer.sh Tree1.pcd 

Contributions

This project is open to any contribution, either a new format parser PR, CI workflow improvement, documentation, etc.

pcl_visualizer's People

Contributors

td43 avatar dtcmlops avatar

Stargazers

Stanisław Piasecki avatar  avatar  avatar  avatar ilove0518 avatar  avatar  avatar  avatar

Watchers

 avatar James Cloos avatar  avatar

Forkers

2amour 0000duck

pcl_visualizer's Issues

error in VTK package

I'm not sure what the issue is but when the code reaches the visualization section a segmentation error is there !
I tried removing the line you added that removes the errors.
and the following error appeared !

Generic Warning: In /build/vtk6-McbzXj/vtk6-6.2.0+dfsg1/Rendering/OpenGL/vtkOpenGLPolyDataMapper.cxx, line 69
vtkOpenGLPolyDataMapper::vtkOpenGLPolyDataMapper was deprecated for VTK 6.2 and will be removed in a future version.

Segmentation fault (core dumped)

Do you have any idea ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.