Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Ask: send email if two images are the same
2 points by TheSpiceIsLife on July 25, 2018 | hide | past | favorite | 2 comments
Have an issue at work with a laser cutter. It's in auto change-over mode, finishes cutting one sheet then swaps it out and cuts the next.

Sometimes gets stuck on an error it can't recover from. In talks with supplier to update software to handle error.

I've got a USB webcam sitting inside the machine capturing a still image every 300 seconds. I want to be able to send an email if the two most recent image captures from the webcam are the same, indicating the machine has stopped, so I know to come in and fix it.

Images are being captured on a Windows 7 PC and uploaded to Dropbox. Solution could be any tool on Windows 7, Linux,or MacOS.

Any help would be appreciated.



Are the two most recent images _actually_ the same, as in a per-pixel match, or are you going to get random noise from dithering etc? If they are literally the same, then this becomes a lot easier.

You could easily set up a simple node.js program that uses fs.watcher to watch for new files, and https://github.com/lovell/sharp to process the two most recent images and see if the pixels are identical. If you need to package this into a standalone executable, you could use https://www.npmjs.com/package/pkg. Then you could use the built-in SMTP sender (if it is not blocked on your network) or mailgun or something of that nature to send the email.

You can do the same thing in other languages, like ruby, python, etc as well.

If the two images files are literally identical as in the same jpeg with all the same bytes, you could do this with a bash script that compares the sha1 or md5 hash of the two files and then consult https://stackoverflow.com/questions/5155923/sending-a-mail-f... for how to send an email from a bash script.


Thanks for the response, this gives me a bit to go on.

The images are jpg files from iSpy Connect. I'll see take some sample photos and see if they hash the same.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: