Git Product home page Git Product logo

pc2vid's Introduction

Point Cloud to Video

Converts a 3d point cloud to a video, using three.js and ffmpeg. Load Javascript data, render using three.js, and save the canvas to a png. Additionally supplies a utility for converting a specific .npy format to Javascript.

2011_09_26_0001 LiDAR data and images belong to the KITTI dataset's copyright holders.

Note that this repository isn't general at all. You'll probably need to hack it for your own purposes. I've done the heavy lifting (i.e., mixed and matched from the relevant Three.js docs) to render the point cloud though.

Usage

  1. Clone the repository recursively (replace with HTTP below if you don't have keys setup)
git clone --recursive [email protected]:alvinwan/pc2vid.git

General Usage

  1. Create a new js/output.js file with the structure described in Point Cloud Format below. This should match the format described at antsy3d. The latter takes precedence.
  2. Open js_to_png.html in your browser. The app will begin saving frames as PNGs every half-second. The PNG filename will match the key provided in the original data dictionary. The example from Point Cloud Format, for example, would output frog.png.
  3. Run the png_to_mp4.sh bash script. (ffmpeg)

Pallas-Specific Usage

  1. Download .npy files to data/<dataset>. (For example, you could have data/0001_pred/{000000000,0000000001...}.npy) Make sure all files match %10d.npy.
  2. Run python to_json.py <dataset> <start> <end>. There's too much data to load at once, so we have to split up, say, 159 images, into chunks of ~40. (e.g., run python to_json.py 0001_pred 0 40. Do next step, then python to_json.py 0001_pred 40 80...)
  3. Open js_to_png.html in your browser. This will render and download each image.

Point Cloud Format

js/output.js defines a global variable data, a dictionary mapping unique point cloud names to point cloud data; point clouds have a vertices property, a list of vertices, each with .x, .y and .z properties.

e.g., To access the x position of the first point in the point cloud named frog, you would access data.frog.vertices[0].x. Simple example of output.js:

var data = {
   'frog': {
      'vertices': [
          {'x': 3.5, 'y': 3.5, 'z': 5.6},
          {'x': 1.0, 'y': 1.2, 'z': 3.4}
      ]
   }
}

.npy Conversion Tool

Note this tool is extremely specific to our own data format. It may be wortwhile to code your own from scratch. To use it, install numpy

pip install numpy

Then, run

python to_json.py 

Why not build a Python utility? I tried looking around, but visualizations I explored used a backend I didn't have (and didn't want to bother installing). However, this utility just uses the browser, which every computer has.

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.