Application for giving the % percent difference between pictures

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Gamerxx13
Posts: 2
Joined: 2016-04-14T17:40:15-07:00
Authentication code: 1151

Application for giving the % percent difference between pictures

Post by Gamerxx13 »

Hi All,
I am new to the forums.
I was thinking about creating a comparison tool for a work environment tool.
I work in biotech, and we use a liquid handler to run assays for us. The user will run a specific script on the liquid handler but requires the deck layout to be in a specific order. If not there is no way to knowing and the script will crash.
A way to avoid this issue is to implement a way to take a picture of how the deck looks now, and compare it to how the deck should look.
I was messing around with ImageMagick and think it can serve this purpose. I can write a batch file to do the comparison.
I was wondering if there is a way to output the % difference between the two pictures as a variable I can use in the batch file.
Basically batch file calls ImageMagick, asks the user for the picture, ImageMagick does the comparison, and hands the batch file calling it a variable difference.
If you have any suggestions let me know, I look forward to your answers.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Application for giving the % percent difference between pictures

Post by fmw42 »

I have moved this topic to the User's forum since it does not appear to be for PAID consulting. The other forum is only for PAID consulting.

Imagemagick has a compare function that returns various difference measures for the exact same size images. It does not take into account any translation, rotation or scale. It can be used for two different size images to find translation, but not rotation or scale difference. There result is presented in two formats, raw and scaled to the range 0 to 1. The latter, if multiplied, by 100 gives a percentage measure. See

http://www.imagemagick.org/script/compare.php
http://www.imagemagick.org/Usage/compare/
http://www.imagemagick.org/Usage/compare/#statistics
Gamerxx13
Posts: 2
Joined: 2016-04-14T17:40:15-07:00
Authentication code: 1151

Re: Application for giving the % percent difference between pictures

Post by Gamerxx13 »

Hi,
Thanks for your help. I went through some of the examples and was able to find some cool commands using the batch files.
http://www.imagemagick.org/script/comma ... php#metric

What I did was this. I used compare with MES. This way I can get a numeric value of the difference in error per pixel.
I tried using this command, and it seems to work as a command line command by this

compare -metric MSE Picture1.jpg Picture2.jpg difference.png

I can put it together and save it as a value. I was wondering if there are any examples of this?
I tried this command with two of the same pictures, and it was able to print out 0 for the same, and some value for difference. I can put a threshold and if over that value give the user a warning.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Application for giving the % percent difference between pictures

Post by snibgo »

compare -metric MSE Picture1.jpg Picture2.jpg difference.png
Do you care about the difference image? If not, replacing the output filename with NULL: will be quicker.
I can put it together and save it as a value. I was wondering if there are any examples of this?
There are many examples of this, in Windows BAT syntax, on my pages. I generally use metric RMSE or sometimes AE.
snibgo's IM pages: im.snibgo.com
Post Reply