Skip to content

Instantly share code, notes, and snippets.

@barrbrain barrbrain/PSNR-CIE76.bash

Last active Oct 31, 2015
What would you like to do?
Calculate PSNR with CIE76 difference method
# REQUIRES imagemagick compiled with HDRI feature enabled
SIZE=$(head -n1 "$1" | sed -E 's/.*W([0-9]*) H([0-9]*).*/\1x\2/')
FMT="-size $SIZE -depth 8 -sampling-factor 4:2:0 -interlace plane -set colorspace Rec709YCbCr"
convert $FMT YUV:<(tail -n+3<"$1") YUV:<(tail -n+3<"$2") \
-colorspace Lab -compose difference \
-composite -evaluate Pow 2 -separate -evaluate-sequence Add \
-filter box -resize 1x1\! -format "%[fx:-10*log(u)]\n" info:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.