123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- #! /bin/bash
- if [ -z "$1" ]
- then
- echo "No argument supplied"
- echo "Need data folder"
- exit 1
- fi
- if [ -z "$2" ]
- then
- echo "No argument supplied"
- echo "Need output folder"
- exit 1
- fi
- if [ -z "$3" ]
- then
- echo "No argument supplied"
- echo "Need step output images expected (step of samples)"
- exit 1
- fi
- prefix="p3d_"
- build_folder="build"
- data_folder=$1
- output_folder=$2
- step=$3
- for folder_path in $(ls -d ${data_folder}*/)
- do
- nb_elements=$(ls -l ${folder_path} | grep ${prefix} | wc -l)
- IFS='/' read -ra ADDR <<< "${folder_path}"
- folder=${ADDR[-1]}
- # get output expected path
- output_scene_path=$output_folder/$folder
- output_scene_path_fixed=${output_scene_path//\/\//\/}
- if [ ! -d "$output_scene_path_fixed" ]; then
- # Control will enter here if $DIRECTORY doesn't exist.
-
- mkdir -p $output_scene_path_fixed
- samples=$step
- while [ $samples -le ${nb_elements} ]
- do
- suffix=$samples
- while [ ${#suffix} -le 5 ]
- do
- suffix="0"${suffix}
- done
- # need to create `outfile` name
- outfile="${folder}_${suffix}.png"
- echo "$folder: [merge of ${samples} samples] into ${outfile}"
- ./${build_folder}/main/rawls_merge --folder ${folder_path} --samples ${samples} --random 0 --outfile ${output_scene_path_fixed}/${outfile}
- samples=$(( $samples + $step ))
- done
- fi
- done
|