Skip to content

Commit

Permalink
Merge pull request #61 from nus-vv-streams/spring-cleaning
Browse files Browse the repository at this point in the history
Spring cleaning
  • Loading branch information
weitsang authored May 28, 2024
2 parents 10532c0 + 1aeca7f commit 9b7427c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
11 changes: 8 additions & 3 deletions examples/multiplane.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ use std::env;
use std::path::PathBuf;
use vivotk::codec::decoder::Tmc2rsDecoder;
use vivotk::codec::Decoder;
use vivotk::pcd::PointCloudData;
use vivotk::pcd::{write_pcd_file, PCDDataType, PointCloudData};

fn main() {
let _output_file = env::args().nth(1).expect("output file");
let output_folder = env::args()
.nth(1)
.expect("output folder (e.g. . or ./data)");
let left = env::args().nth(2).expect("input file");
let bottom = env::args().nth(3).expect("input file");
let back = env::args().nth(4).expect("input file");
Expand All @@ -23,10 +25,13 @@ fn main() {
]);
let now = std::time::Instant::now();
decoder.start().unwrap();
let mut file_counter = 1;
while let Some(pc) = decoder.poll() {
let pcd = PointCloudData::from(&pc);
dbg!(pcd.header().points());
// write_pcd_file(&pcd, PCDDataType::Ascii, &output_file).unwrap();
let filename = format!("{}/{}.pcd", output_folder, file_counter);
file_counter += 1;
write_pcd_file(&pcd, PCDDataType::Ascii, &filename).unwrap();
}
let elapsed = now.elapsed();
dbg!("Decoding took {:?} seconds", elapsed);
Expand Down
6 changes: 5 additions & 1 deletion shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@ with (import <nixpkgs> {});
stdenv.mkDerivation {
name = "rust-env";
buildInputs = [
ffmpeg
ffmpeg_4
libiconvReal
pkg-config
pkgs.darwin.apple_sdk.frameworks.Security
pkgs.darwin.apple_sdk.frameworks.ApplicationServices
pkgs.darwin.apple_sdk.frameworks.CoreVideo
pkgs.darwin.apple_sdk.frameworks.AppKit
];

# Set Environment variables
Expand Down
2 changes: 1 addition & 1 deletion src/bin/exporter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ async fn main() {
let pc = decoder.poll().unwrap();
png_writer.write_to_png(&pc, &(i + frame_number as usize).to_string());
}
frame_number += 30;
frame_number += args.segment_size as u64;
}
} else if let Some(ply_folder) = args.ply_folder {
let mut ply_files: Vec<PathBuf> = vec![];
Expand Down

0 comments on commit 9b7427c

Please sign in to comment.