Skip to content

Instantly share code, notes, and snippets.

@josejuansanchez
Last active August 29, 2015 14:18
Show Gist options
  • Save josejuansanchez/1afb250951494258c971 to your computer and use it in GitHub Desktop.
Save josejuansanchez/1afb250951494258c971 to your computer and use it in GitHub Desktop.
Bash script and Gnuplot file to create a curve with the codestream size for each frame of a sequence of frames.

Step 1

./getbytesperframe.sh 0 100 > sun.dat

Step 2

gnuplot < sun.gpt > sun.svg 

Step 3

display sun.svg
#!/bin/bash
if [ $# -ne 2 ]; then
echo -e "\nUso: $0 <start> <end>\n"
exit 1
fi
IMAGES_PATH=/home/josejuan/ESA/servers/data/delphi
START=$1
END=$2
i=$START
while [ $i -le $END ]; do
source=`printf %03d $i`
BYTES=`kdu_expand -i $IMAGES_PATH/$source.jp2 -o kk.pgm | grep "excluding any file format" | awk '{print $2}'`
echo -e "$i \t $BYTES" | sed 's/,//g'
i=$(($i+1))
done
set terminal svg
set title 'Sun'
set xlabel 'Frame Number'
set ylabel 'Bytes'
set key out bottom
plot "sun.dat" using 1:2 smooth bezier title 'J2K' axes x1y1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment