From 3f09834afc0f6a52ed976c1528ad7ee89d27ba63 Mon Sep 17 00:00:00 2001 From: Ammar Qammaz Date: Tue, 3 May 2022 16:00:16 +0300 Subject: [PATCH] splitStereo.sh can now work regardless of input dimension.. --- scripts/splitStereo.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/splitStereo.sh b/scripts/splitStereo.sh index 6b69b71..cf8ab48 100755 --- a/scripts/splitStereo.sh +++ b/scripts/splitStereo.sh @@ -3,6 +3,7 @@ FROMDATASET="$1" X=0 +# sudo apt-get install imagemagick if (( $# != 1 )); then echo "Please run giving the path to download and build" @@ -23,9 +24,15 @@ do if [ -f "colorFrame_0_$XNUM.jpg" ] then + width=$(identify -format "%w" "colorFrame_0_$XNUM.jpg")> /dev/null + height=$(identify -format "%h" "colorFrame_0_$XNUM.jpg")> /dev/null + halfWidth=$((width / 2)) + echo "$width x $height -> 2x $halfWidth x $height" + + #First crop second half ( before source file gets rewritten ) - convert colorFrame_0_$XNUM.jpg -crop 1280x720+1280+0 colorFrame_1_$XNUM.jpg - convert colorFrame_0_$XNUM.jpg -crop 1280x720+0+0 colorFrame_0_$XNUM.jpg + convert colorFrame_0_$XNUM.jpg -crop "$halfWidth"x$height+$halfWidth+0 colorFrame_1_$XNUM.jpg + convert colorFrame_0_$XNUM.jpg -crop "$halfWidth"x$height+0+0 colorFrame_0_$XNUM.jpg else break fi