reconstruct_png.sh 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #! /bin/bash
  2. if [ -z "$1" ]
  3. then
  4. echo "No argument supplied"
  5. echo "Need data folder"
  6. exit 1
  7. fi
  8. if [ -z "$2" ]
  9. then
  10. echo "No argument supplied"
  11. echo "Need output folder"
  12. exit 1
  13. fi
  14. if [ -z "$3" ]
  15. then
  16. echo "No argument supplied"
  17. echo "Need step output images expected (step of samples)"
  18. exit 1
  19. fi
  20. prefix="p3d_"
  21. build_folder="build"
  22. data_folder=$1
  23. output_folder=$2
  24. step=$3
  25. for folder_path in $(ls -d ${data_folder}*/)
  26. do
  27. nb_elements=$(ls -l ${folder_path} | grep ${prefix} | wc -l)
  28. IFS='/' read -ra ADDR <<< "${folder_path}"
  29. folder=${ADDR[-1]}
  30. # get output expected path
  31. output_scene_path=$output_folder/$folder
  32. output_scene_path_fixed=${output_scene_path//\/\//\/}
  33. if [ ! -d "$output_scene_path_fixed" ]; then
  34. # Control will enter here if $DIRECTORY doesn't exist.
  35. mkdir -p $output_scene_path_fixed
  36. ./${build_folder}/main/rawls_merge_incr --folder ${folder_path} --output $output_scene_path_fixed --step ${step} --random 0 --prefix ${folder} --max ${nb_elements} --extension ".png"
  37. fi
  38. done