Skip to content

Instantly share code, notes, and snippets.

@catichenor
Last active March 5, 2016 21:40
Show Gist options
  • Save catichenor/fc0d89e6cde4a1b20680 to your computer and use it in GitHub Desktop.
Save catichenor/fc0d89e6cde4a1b20680 to your computer and use it in GitHub Desktop.
Compare two images and return whether or not they match
#!/bin/bash
THRESHOLD="15000" # You'll need to do some testing to come up with this number.
# Requires ImageMagick, also using PNG format since JPEG adds too much noise
echo "`compare -metric RMSE clean_webcam_image.png corrupt_webcam_image.png NULL: 2>&1 | awk '{print $1}'` > ${THRESHOLD}" | bc # Returns 1 if the difference is greater than 15000, 0 otherwise
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment