Last active
December 16, 2018 19:06
-
-
Save Shnatsel/0c1e9254f722c63cced09a322eefd74d to your computer and use it in GitHub Desktop.
compare two folders with images visually and output mean squared error for each pair
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Usage: | |
# ./compare.sh folder1 folder2 | grep -v '^[0-9]\.[0-9]\+e-' | grep -v '^0 ' | sort --numeric-sort --reverse | |
# filters out images with significant differences and sorts them by mean squared error | |
cd "$1" | |
for file in $(find * -type f); do | |
# http://www.imagemagick.org/Usage/compare/ | |
NORMALIZED_DIFFERENCE=$(compare -metric MSE "$file" ../"$2"/"$file" null: 2>&1 | cut -d '(' -f 2 | cut -d ')' -f 1) | |
echo "$NORMALIZED_DIFFERENCE" "$file" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment