diff --git a/examples/multiplane.rs b/examples/multiplane.rs index 139a541..1b724db 100644 --- a/examples/multiplane.rs +++ b/examples/multiplane.rs @@ -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"); @@ -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); diff --git a/shell.nix b/shell.nix index f80375f..b406055 100644 --- a/shell.nix +++ b/shell.nix @@ -2,9 +2,13 @@ with (import {}); 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 diff --git a/src/bin/exporter.rs b/src/bin/exporter.rs index 6413bf2..f553d93 100644 --- a/src/bin/exporter.rs +++ b/src/bin/exporter.rs @@ -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 = vec![];