Skip to content

Instantly share code, notes, and snippets.

@unot
Created April 5, 2011 02:23
Show Gist options
  • Save unot/902912 to your computer and use it in GitHub Desktop.
Save unot/902912 to your computer and use it in GitHub Desktop.
色差計算(ΔE94)
#!/usr/bin/sh
#
#@(#) deltaE94.sh 色差を計算
#@(#) Copyleft 2008, 2009 UNO, Takashi
# Usage: deltaE94.sh file1 file2
if [ $# -ne 2 ]; then
echo "Usage: `basename $0` file1 file2" 2>&1
exit 1
fi
#for INFILE in $1 $2; do
# tail -n +8 $INFILE | cut -f1-3 >${INFILE}.lab
#done
paste ${1} ${2} | awk '{ dL = $1 - $4; dC = sqrt($2 ^2 + $3 ^2) - sqrt($5 ^2 + $6 ^2); dH = sqrt(($2 - $5) ^2 + ($3 - $6) ^2 - dC ^2); cone = sqrt($2 ^2 + $3 ^2); print sqrt(dL^2 + (dC/(1 + 0.045 * cone))^2 + (dH/(1 + 0.015 * cone))^2) }'
#rm -f ${1}.lab ${2}.lab
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment