Graphics - acfr/snark GitHub Wiki

graphics library implements classes and utilities for 3d data viewing and editing.

It's most useful artefacts are utilities view-points and label-points.

view-points: point cloud viewer featuring:

  • viewing arbitrary points clouds in csv format
  • viewing multiple streams of points in realtime
  • stream camera position just as another stream of points
  • viewing cad models
label-points: a tool for manual point cloud labelling

usage examples

For simplicity's sake, all the examples use csv. In real applications, you would rather use binary data for performance. Then you would need to tell view-points the data format, e.g. --binary=t,3d,ui. (Here is a tutorial on csv vs binary data)

view-points

In additional to the usage examples on this page, there are two step-by-step tutorials that cover view-points extensively, including downloadable data:

view points from a file:
 cat xyz.csv | view-points
 view-points xyz.csv

view coloured points from a file:

 cat xyzrgb.csv | view-points --fields=x,y,z,r,g,b

view points from a file coloured by a scalar:

 cat xyzs.csv | view-points --fields=x,y,z,scalar --colour=red:white

view points from a file coloured by an integer id:

 cat xyzid.csv | view-points --fields=x,y,z,id

view points from a the same file coloured by id and as rgb:

 view-points "xyzrgbid.csv;fields=x,y,z,,,,id" "xyzrgbid.csv;fields=x,y,z,r,g,b"

view points from a live sensor, served as timestamp,x,y,z,intensity, where intensity varies from 0 to 255:

 netcat vehicle $lidar_port | view-points --fields=,x,y,z,scalar --colour=0:255,black:red

play back a log from a live sensor from the example above:

 cat lidar.csv | csv-play | view-points --fields=,x,y,z,scalar --colour=0:255,black:red

view points from two live sensors on ports 8888 and 9999, both publishing timestamp,x,y,z:

 view-points "tcp:vehicle:8888" "tcp:vehicle:9999" --fields=,x,y,z

view vehicle trajectory as timestamp,x,y,z,roll,pitch,yaw from a log:

 cat trajectory.csv | view-points --fields=,x,y,z,roll,pitch,yaw

play back vehicle trajectory as timestamp,x,y,z,roll,pitch,yaw from a log:

 cat trajectory.csv | csv-play | view-points --fields=,x,y,z,roll,pitch,yaw

view vehicle cad model from file vehicle.obj moving along the trajectory:

 cat trajectory.csv | csv-play | view-points --fields=,x,y,z,roll,pitch,yaw --shape=vehicle.obj

view both vehicle cad model from file vehicle.obj moving along the trajectory and the full trajectory:

 cat trajectory.csv | csv-play | view-points --fields=,x,y,z,roll,pitch,yaw "-;shape=vehicle.obj" trajectory.csv

label-points

CSV Files

Suppose we have a csv file (xyz.csv) containing x,y,z point cloud data and we want to graphically label the points.

first add an id (label) column (initialised as 0 in this instance) :

 csv-paste "xyz.csv" "value=0" > xyz-labelled.csv

view under label-points

 label-points "xyz-labelled.csv;fields=x,y,z,id"

select out an ID range

 cat xyz-labelled.csv | csv-select --fields=x,y,z,id "id;from=1;to=10"

Binary Files

If we were instead working with a binary file containing x,y,z points, we can stream it through to csv-paste

first add an id (label) column (initialised as 0 in this instance) :

 cat xyz.bin | csv-paste "-;binary=3d" "value=0;binary=ui" > xyz-labelled.bin

view under label-points

 label-points "xyz-labelled.bin;binary=3d,ui;fields=x,y,z,id"

select out ID's

 cat xyz-labelled.bin | csv-select --binary=3d,ui --fields=x,y,z,id "id;equals=1" > xyz-selected-label.bin
⚠️ **GitHub.com Fallback** ⚠️