convert_folder.sh 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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 width size"
  18. exit 1
  19. fi
  20. if [ -z "$4" ]
  21. then
  22. echo "No argument supplied"
  23. echo "Need height size"
  24. exit 1
  25. fi
  26. prefix="p3d_"
  27. data_folder=$1
  28. output_folder=$2
  29. width=$3
  30. height=$4
  31. for folder_path in $(ls -d ${data_folder}*)
  32. do
  33. IFS='/' read -ra ADDR <<< "${folder_path}"
  34. folder=${ADDR[-1]}
  35. # if [[ "$folder" == ${prefix}* ]]; then
  36. output_scene_folder=$output_folder/${folder}_${width}_${height}
  37. mkdir -p $output_scene_folder
  38. for file in $(ls ${folder_path}*)
  39. do
  40. filepath=$folder_path/$file
  41. python utils/get_center_image.py --image ${filepath} --size "${width},${height}" --output $output_scene_folder/$file
  42. echo "Images centered saved into $output_scene_folder/$file"
  43. done
  44. # fi
  45. done