Code Monkey home page Code Monkey logo

viewercloud's Introduction

Viewercloud

Rust general CI

Python package Release Package Release Flow

Viewercloud is a library and also a cli to read and display Pointcloud. It was initially used to display KITTI pointcloud. However it was also tested on the Lyft Level 5 Dataset pointcloud.

It will also be able to display the 3D annotations and the 3D BoundingBox computed by your favorite algorithm.

Viewercloud will open a openGL window to display the pointcloud. Press qto close.

kitti-centroid

It can also take a screen shot of the current view to save as png. Press s take screenshot.

lyft-color

Python Usage

You can install pyviewercloud the python bindings to viewercloud thanks to Pyo3 and Pyo3-numpy

poetry add pyviewercloud
pip install pyviewercloud
import numpy as np
import pyviewercloud as pyviewer

# Create a new viewer with a window size 1200x1800.
viewer = pyviewer.PointcloudViewer(1200, 1800, 15000)

# Load some pointcloud from the lyft perception dataset
# Currently only support pointcloud as numpy.ndarray Nx3 in np.float32
lyft_point_cloud_1 = np.fromfile("tests/data/lyft/host-a101_lidar0_1241893239502712366.bin", dtype=np.float32).reshape((-1, 5))[:,:3]
lyft_point_cloud_2= np.fromfile("tests/data/lyft/host-a101_lidar1_1241893239502712366.bin", dtype=np.float32).reshape((-1, 5))[:,:3]
lyft_point_cloud_3= np.fromfile("tests/data/lyft/host-a101_lidar2_1241893239502712366.bin", dtype=np.float32).reshape((-1, 5))[:,:3]

# Add them one by one to the viewer to have different color
viewer.add_pointcloud(lyft_point_cloud_1, [255, 0, 0])
viewer.add_pointcloud(lyft_point_cloud_2, [0, 0, 255])
viewer.add_pointcloud(lyft_point_cloud_3, [0, 255, 0])

# You can now display the window
viewer.show()
import numpy as np
import pyviewercloud as pyviewer

# Create a new viewer with a window size 1200x1800.
viewer = pyviewer.PointcloudViewer(1200, 1800, 15000)

# Load some pointcloud from the kitti dataset
kitti_point_cloud = np.fromfile("tests/data/kitti/velodyne/000001.bin", dtype=np.float32).reshape((-1, 4))[:,:3]
viewer.add_pointcloud(kitti_point_cloud, [255, 255, 255])

# Add some centroids to have the same color.
# Currently only support centroids as numpy.ndarray Nx3 in np.float32
centroids = np.array([[-11.5,0,-0.8]]).astype(np.float32)
viewer.add_centroid(centroids, [255, 0, 0])
viewer.show()

CLI Usage

> viewercloud --help
viewercloud 0.2.1
Thomaub <[email protected]>
Display KITTI 3D Pointcloud with annotations and your model inferences

USAGE:
    viewercloud <pointcloud-file> [ARGS]

ARGS:
    <pointcloud-file>     Path to the kitti Pointcloud .bin or .txt file
    <annotations-file>    Path to the kitti 3D annotation .txt file
    <inferences-file>     Path to your model inferences .json file

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

Build

cargo build --release

It will be possible to download from github release and brew.

viewercloud's People

Contributors

dependabot[bot] avatar thomaub avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

viewercloud's Issues

add support for WebAssembly

Could it be possible to compile the core lib and add support for WebAssembly thus allowing to display point cloud in the browser

upgrade to newer kiss3D

src/viewer.rs:39:13
251
   |
252
39 |             &Point2::new(0.0, 20.0),
253
   |             ^^^^^^^^^^^^^^^^^^^^^^^ expected struct `kiss3d::nalgebra::Point`, found struct `nalgebra::Point`
254
   |
255
   = note: expected reference `&kiss3d::nalgebra::Point<f32, kiss3d::nalgebra::U2>`
256
              found reference `&nalgebra::Point<{float}, 2_usize>`
257
   = note: perhaps two different versions of crate `nalgebra` are being used?
258

259
error[E0308]: mismatched types
260
  --> src/viewer.rs:42:13
261
   |
262
42 |             &Point3::new(1.0, 1.0, 1.0),
263
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `kiss3d::nalgebra::Point`, found struct `nalgebra::Point`
264
   |
265
   = note: expected reference `&kiss3d::nalgebra::Point<f32, kiss3d::nalgebra::U3>`
266
              found reference `&nalgebra::Point<{float}, 3_usize>`
267
   = note: perhaps two different versions of crate `nalgebra` are being used?
268

269
error[E0277]: the trait bound `nalgebra::Point<f32, 3_usize>: GLPrimitive` is not satisfied
270
  --> src/renderer.rs:30:25
271
   |
272
30 |             pos: shader.get_attrib::<Point3<f32>>("position").unwrap(),
273
   |                         ^^^^^^^^^^ the trait `GLPrimitive` is not implemented for `nalgebra::Point<f32, 3_usize>`
274

275
error[E0277]: the trait bound `nalgebra::Point<f32, 3_usize>: GLPrimitive` is not satisfied
276
  --> src/renderer.rs:31:27
277
   |
278
31 |             color: shader.get_attrib::<Point3<f32>>("color").unwrap(),
279
   |                           ^^^^^^^^^^ the trait `GLPrimitive` is not implemented for `nalgebra::Point<f32, 3_usize>`
280

281
error[E0277]: the trait bound `nalgebra::Matrix<f32, Const<4_usize>, Const<4_usize>, nalgebra::ArrayStorage<f32, 4_usize, 4_usize>>: GLPrimitive` is not satisfied
282
  --> src/renderer.rs:32:26
283
   |
284
32 |             proj: shader.get_uniform::<Matrix4<f32>>("proj").unwrap(),
285
   |                          ^^^^^^^^^^^ the trait `GLPrimitive` is not implemented for `nalgebra::Matrix<f32, Const<4_usize>, Const<4_usize>, nalgebra::ArrayStorage<f32, 4_usize, 4_usize>>`
286

287
error[E0277]: the trait bound `nalgebra::Matrix<f32, Const<4_usize>, Const<4_usize>, nalgebra::ArrayStorage<f32, 4_usize, 4_usize>>: GLPrimitive` is not satisfied
288
  --> src/renderer.rs:33:26
289
   |
290
33 |             view: shader.get_uniform::<Matrix4<f32>>("view").unwrap(),
291
   |                          ^^^^^^^^^^^ the trait `GLPrimitive` is not implemented for `nalgebra::Matrix<f32, Const<4_usize>, Const<4_usize>, nalgebra::ArrayStorage<f32, 4_usize, 4_usize>>`
292

293
error[E0599]: the method `len` exists for struct `GPUVec<nalgebra::Point<f32, 3_usize>>`, but its trait bounds were not satisfied
294
  --> src/renderer.rs:40:29
295
   |
296
40 |         self.colored_points.len() / 2
297
   |                             ^^^ private field, not a method
298
   | 
299
  ::: /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/nalgebra-0.26.1/src/geometry/point.rs:43:1
300
   |
301
43 | pub struct Point<T, const D: usize> {
302
   | ----------------------------------- doesn't satisfy `nalgebra::Point<f32, 3_usize>: GLPrimitive`
303
   |
304
   = note: the following trait bounds were not satisfied:
305
           `nalgebra::Point<f32, 3_usize>: GLPrimitive`
306

307
error[E0599]: the method `len` exists for struct `GPUVec<nalgebra::Point<f32, 3_usize>>`, but its trait bounds were not satisfied
308
  --> src/renderer.rs:47:32
309
   |
310
47 |         if self.colored_points.len() == 0 {
311
   |                                ^^^ private field, not a method
312
   | 
313
  ::: /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/nalgebra-0.26.1/src/geometry/point.rs:43:1
314
   |
315
43 | pub struct Point<T, const D: usize> {
316
   | ----------------------------------- doesn't satisfy `nalgebra::Point<f32, 3_usize>: GLPrimitive`
317
   |
318
   = note: the following trait bounds were not satisfied:
319
           `nalgebra::Point<f32, 3_usize>: GLPrimitive`
320

321
error[E0599]: the method `enable` exists for struct `ShaderAttribute<nalgebra::Point<f32, 3_usize>>`, but its trait bounds were not satisfied
322
  --> src/renderer.rs:52:18
323
   |
324
52 |         self.pos.enable();
325
   |                  ^^^^^^ method cannot be called on `ShaderAttribute<nalgebra::Point<f32, 3_usize>>` due to unsatisfied trait bounds
326
   | 
327
  ::: /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/nalgebra-0.26.1/src/geometry/point.rs:43:1
328
   |
329
43 | pub struct Point<T, const D: usize> {
330
   | ----------------------------------- doesn't satisfy `nalgebra::Point<f32, 3_usize>: GLPrimitive`
331
   |
332
   = note: the following trait bounds were not satisfied:
333
           `nalgebra::Point<f32, 3_usize>: GLPrimitive`
334

335
error[E0599]: the method `enable` exists for struct `ShaderAttribute<nalgebra::Point<f32, 3_usize>>`, but its trait bounds were not satisfied
336
  --> src/renderer.rs:53:20
337
   |
338
53 |         self.color.enable();
339
   |                    ^^^^^^ method cannot be called on `ShaderAttribute<nalgebra::Point<f32, 3_usize>>` due to unsatisfied trait bounds
340
   | 
341
  ::: /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/nalgebra-0.26.1/src/geometry/point.rs:43:1
342
   |
343
43 | pub struct Point<T, const D: usize> {
344
   | ----------------------------------- doesn't satisfy `nalgebra::Point<f32, 3_usize>: GLPrimitive`
345
   |
346
   = note: the following trait bounds were not satisfied:
347
           `nalgebra::Point<f32, 3_usize>: GLPrimitive`
348

349
error[E0308]: mismatched types
350
  --> src/renderer.rs:55:29
351
   |
352
55 |         camera.upload(pass, &mut self.proj, &mut self.view);
353
   |                             ^^^^^^^^^^^^^^ expected struct `kiss3d::nalgebra::Matrix`, found struct `nalgebra::Matrix`
354
   |
355
   = note: expected mutable reference `&mut ShaderUniform<kiss3d::nalgebra::Matrix<f32, kiss3d::nalgebra::U4, kiss3d::nalgebra::U4, kiss3d::nalgebra::ArrayStorage<f32, kiss3d::nalgebra::U4, kiss3d::nalgebra::U4>>>`
356
              found mutable reference `&mut ShaderUniform<nalgebra::Matrix<f32, Const<4_usize>, Const<4_usize>, nalgebra::ArrayStorage<f32, 4_usize, 4_usize>>>`
357
   = note: perhaps two different versions of crate `nalgebra` are being used?
358

359
error[E0308]: mismatched types
360
  --> src/renderer.rs:55:45
361
   |
362
55 |         camera.upload(pass, &mut self.proj, &mut self.view);
363
   |                                             ^^^^^^^^^^^^^^ expected struct `kiss3d::nalgebra::Matrix`, found struct `nalgebra::Matrix`
364
   |
365
   = note: expected mutable reference `&mut ShaderUniform<kiss3d::nalgebra::Matrix<f32, kiss3d::nalgebra::U4, kiss3d::nalgebra::U4, kiss3d::nalgebra::ArrayStorage<f32, kiss3d::nalgebra::U4, kiss3d::nalgebra::U4>>>`
366
              found mutable reference `&mut ShaderUniform<nalgebra::Matrix<f32, Const<4_usize>, Const<4_usize>, nalgebra::ArrayStorage<f32, 4_usize, 4_usize>>>`
367
   = note: perhaps two different versions of crate `nalgebra` are being used?
368

369
error[E0599]: the method `bind_sub_buffer` exists for struct `ShaderAttribute<nalgebra::Point<f32, 3_usize>>`, but its trait bounds were not satisfied
370
  --> src/renderer.rs:57:20
371
   |
372
57 |         self.color.bind_sub_buffer(&mut self.colored_points, 1, 1);
373
   |                    ^^^^^^^^^^^^^^^ method cannot be called on `ShaderAttribute<nalgebra::Point<f32, 3_usize>>` due to unsatisfied trait bounds
374
   | 
375
  ::: /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/nalgebra-0.26.1/src/geometry/point.rs:43:1
376
   |
377
43 | pub struct Point<T, const D: usize> {
378
   | ----------------------------------- doesn't satisfy `nalgebra::Point<f32, 3_usize>: GLPrimitive`
379
   |
380
   = note: the following trait bounds were not satisfied:
381
           `nalgebra::Point<f32, 3_usize>: GLPrimitive`
382

383
error[E0599]: the method `bind_sub_buffer` exists for struct `ShaderAttribute<nalgebra::Point<f32, 3_usize>>`, but its trait bounds were not satisfied
384
  --> src/renderer.rs:58:18
385
   |
386
58 |         self.pos.bind_sub_buffer(&mut self.colored_points, 1, 0);
387
   |                  ^^^^^^^^^^^^^^^ method cannot be called on `ShaderAttribute<nalgebra::Point<f32, 3_usize>>` due to unsatisfied trait bounds
388
   | 
389
  ::: /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/nalgebra-0.26.1/src/geometry/point.rs:43:1
390
   |
391
43 | pub struct Point<T, const D: usize> {
392
   | ----------------------------------- doesn't satisfy `nalgebra::Point<f32, 3_usize>: GLPrimitive`
393
   |
394
   = note: the following trait bounds were not satisfied:
395
           `nalgebra::Point<f32, 3_usize>: GLPrimitive`
396

397
error[E0599]: the method `len` exists for struct `GPUVec<nalgebra::Point<f32, 3_usize>>`, but its trait bounds were not satisfied
398
  --> src/renderer.rs:62:67
399
   |
400
62 |         ctxt.draw_arrays(Context::POINTS, 0, (self.colored_points.len() - 10) as i32);
401
   |                                                                   ^^^ private field, not a method
402
   | 
403
  ::: /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/nalgebra-0.26.1/src/geometry/point.rs:43:1
404
   |
405
43 | pub struct Point<T, const D: usize> {
406
   | ----------------------------------- doesn't satisfy `nalgebra::Point<f32, 3_usize>: GLPrimitive`
407
   |
408
   = note: the following trait bounds were not satisfied:
409
           `nalgebra::Point<f32, 3_usize>: GLPrimitive`
410

411
error[E0599]: the method `disable` exists for struct `ShaderAttribute<nalgebra::Point<f32, 3_usize>>`, but its trait bounds were not satisfied
412
  --> src/renderer.rs:63:18
413
   |
414
63 |         self.pos.disable();
415
   |                  ^^^^^^^ method cannot be called on `ShaderAttribute<nalgebra::Point<f32, 3_usize>>` due to unsatisfied trait bounds
416
   | 
417
  ::: /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/nalgebra-0.26.1/src/geometry/point.rs:43:1
418
   |
419
43 | pub struct Point<T, const D: usize> {
420
   | ----------------------------------- doesn't satisfy `nalgebra::Point<f32, 3_usize>: GLPrimitive`
421
   |
422
   = note: the following trait bounds were not satisfied:
423
           `nalgebra::Point<f32, 3_usize>: GLPrimitive`
424

425
error[E0599]: the method `disable` exists for struct `ShaderAttribute<nalgebra::Point<f32, 3_usize>>`, but its trait bounds were not satisfied
426
  --> src/renderer.rs:64:20
427
   |
428
64 |         self.color.disable();
429
   |                    ^^^^^^^ method cannot be called on `ShaderAttribute<nalgebra::Point<f32, 3_usize>>` due to unsatisfied trait bounds
430
   | 
431
  ::: /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/nalgebra-0.26.1/src/geometry/point.rs:43:1
432
   |
433
43 | pub struct Point<T, const D: usize> {
434
   | ----------------------------------- doesn't satisfy `nalgebra::Point<f32, 3_usize>: GLPrimitive`
435
   |
436
   = note: the following trait bounds were not satisfied:
437
           `nalgebra::Point<f32, 3_usize>: GLPrimitive`
438

439
error: aborting due to 17 previous errors
440

441
Some errors have detailed explanations: E0277, E0308, E0599.
442
For more information about an error, try `rustc --explain E0277`.
443
error: could not compile `viewercloud`

add python bindings

Currently the way to interact with overcloud is only through the rust cli.
Users need to save files in .bin maybe soon .npy

It would be easier to recently pass down a view of the bumpy array to the viewer

rename to viewercloud

kitti_viewer was fun but we might want more than that so the name will be viewercloud

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.