Giter Site home page Giter Site logo

pointcloudviewer's Introduction

Github licence

This is a point cloud viewer for R. The first goal of this package is to be the backend to display point clouds in the lidR package in replacement of rgl (full support since lidR v1.4.0).

rgl is an awesome package but has some difficulties displaying large point clouds. The 'PointCloudViewer' package is able to display large point clouds consisting of several million points. So far I have tried it with over 30 million points and the display window remained fluid (smoothly pan, zoom and rotate).

Advantage of PointCloudViewer:

  • can easily handle more than 20 million points while rgl can struggle displaying a tenth of that.
  • has pan zoom rotate while rgl only has zoom rotate.
  • is much more memory efficient. It allocates only a small amount of additional memory.

Drawbacks

  • blocks the R session. If the viewer windows is open, you can't use R for anything else. You must close the viewer windows first (so no multiple plots).
  • can only display point clouds. No other feature. This is only a large point cloud displayer so not intended as a replacement for rgl

Installation

PointCloudViewer is based on OpenGL and the SDL. You must install both first.

GNU/Linux

sudo apt-get install libsdl-dev freeglut3-dev
devtools::install_github("Jean-Romain/PointCloudViewer")

Windows

I successfully installed the package on a Windows machine once. It is a litte bit painful but not as much as your everyday workflow ๐Ÿ˜‰. The following is a little bit dirty but it works (btw if it exists a way to make that in tidy manner on Windows please tell me).

  1. Install a compiler and R developement tools with Rtools.exe
  2. Download the SDL 1.2 developpment librairies files for Mingw here
    • Extract this archive
    • Copy the folder SDL that belong into the folder include to C:\RBuildTools\3.4\mingw_64\include\ or any other place like that depending on your computer and your R version.
  3. Download the SDL 1.2 runtime librairies files for 64-bit windows here
    • Extract the archive
    • Copy the file SDL.dll into C:\RBuildTools\3.4\bin or any other place like that depending on your computer and your R version
  4. Clone the repo, check the file makevar.win and update the path if requiered.
  5. Compile the package

How it works

Displaying huge point clouds in real time is a complex task. Advanced techniques often rely on Octrees to selectively display points within the camera field of view. These techniques are smart but beyond my knowledge and not really appropriate for my low memory usage requirements. Considering how R stores data, constructing an Octree would require a full copy of the point cloud. This package uses some very naive optimization to render large point clouds in pseudo-real time:

  • It relies on modern OpenGL, which by default is able to handle many points.
  • When users rotate/pan/zoom it only displays 1 million points, which allows for smooth, fluid movement of the display.
  • When the program finds a few milliseconds of free time between two events it progressively densifies the point cloud until the entire point cloud is displayed. This allows the user to rotate/pan/zoom again before the end of the rendering.
  • It uses a pointer to the R memory and does not create any copy. The memory allocated for the rendering is therefore reduced to a few megabytes independently of the point cloud size.

So far it works well on my tests and the package can display as many points as the user wants (I stopped my tests after 35 million points [~1GB]).

Benchmark

On a core i7 with 11 million points.

Package Time (s) Alloc mem Fluid
rgl 15-20 1.2 GB no
PointCloudViewer < 1 1.0 MB yes

'Time' is the time taken to open the Windows. 'Alloc mem' is the extra memory allocated by the call. 'Fluid' means you can rotate and zoom freely.

pointcloudviewer's People

Contributors

jean-romain avatar

Watchers

James Cloos avatar

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.