Skip to content

Instantly share code, notes, and snippets.

@JWhitleyWork
Last active September 9, 2020 16:56
Show Gist options
  • Save JWhitleyWork/c95c87c8c2408a92846d439085a957ab to your computer and use it in GitHub Desktop.
Save JWhitleyWork/c95c87c8c2408a92846d439085a957ab to your computer and use it in GitHub Desktop.
PCD Downsampling Script (Voxel Grid Algorithm)
#!/bin/bash
set -e
LEAF_SIZE=$1
for file in ./original/*.pcd; do
filename=$(basename -- "${file}")
extension="${filename##*.}"
filename="${filename%.*}"
new_filename="${filename}_vg_${LEAF_SIZE}.pcd"
pcl_voxel_grid ${file} voxel_grid/${new_filename} -leaf ${LEAF_SIZE},${LEAF_SIZE},${LEAF_SIZE}
echo ""
done
pcl_concatenate_points_pcd voxel_grid/*_vg_${LEAF_SIZE}.pcd
echo ""
mv output.pcd output/AutonomouStuff_Mandli_vg_${LEAF_SIZE}_bin.pcd
pcl_convert_pcd_ascii_binary output/AutonomouStuff_Mandli_vg_${LEAF_SIZE}_bin.pcd output/AutonomouStuff_Mandli_vg_${LEAF_SIZE}_ascii.pcd 0
echo ""
echo "Done!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment