Created
October 23, 2018 12:39
-
-
Save stoyanovgeorge/3f2de32f47f3c4c8f39ba1e379138b0a to your computer and use it in GitHub Desktop.
Compares two image files and returns the PSNR and MSE values.
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 | |
if [ -e "$1" ] && [ -e "$2" ]; | |
then | |
if file "$1" | grep -qE 'image|bitmap' && file "$2" | grep -qE 'image|bitmap' ; | |
then | |
ffmpeg -loglevel error -i "$1" -i "$2" -lavfi psnr=psnr.log -f null - | |
cat psnr.log | |
rm psnr.log | |
else | |
echo "The first and/or the second file isn't a valid image file!" | |
exit 0 | |
fi | |
else | |
echo "The first and/or the second file doesn't exist! Please make sure to run the command: './psnr_check.sh path/to/reference/file path/to/processed/file'" | |
exit 0 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment