It is currently Sat Aug 22, 2026 10:03 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 27 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: image comparison (closed)
PostPosted: Sun Mar 27, 2016 12:56 pm  (#1) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14831
Location: roma, italy
GIMP Version: 2.8.16
Operating System: Windows
GIMP Experience: Basic Level



I use an external software to find duplicated images.
I was wondering whether it has been produced a filter in Gimp able to compare two images and detect the percentage of similarities.
Any idea?

_________________
"Where am I ?"


Last edited by dinasset on Thu Mar 31, 2016 11:54 pm, edited 1 time in total.

Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: image comparison
PostPosted: Sun Mar 27, 2016 1:24 pm  (#2) 
Offline
GimpChat Member
User avatar

Joined: Nov 16, 2011
Posts: 5127
Location: Metro Vancouver, BC
Is this what your looking for, How can I tell exactly what changed between two images?

_________________
Image
Gimp 2.8.18, Linux, median user
Gimp Chat Tutorials Index
Spirit Bear (Kermode)


Top
 Post subject: Re: image comparison
PostPosted: Sun Mar 27, 2016 3:16 pm  (#3) 
Offline
GimpChat Member
User avatar

Joined: Jan 13, 2011
Posts: 2648
Location: Poland
It may come in handy?

Elsamuko Difference Layer Script

https://sites.google.com/site/elsamuko/gimp/difference

To determine the percentage I use an external software - XnView (only connection through Shelout)


Attachments:
Similarity.png
Similarity.png [ 21.01 KiB | Viewed 5718 times ]

_________________
Image
Top
 Post subject: Re: image comparison
PostPosted: Mon Mar 28, 2016 3:03 am  (#4) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14831
Location: roma, italy
thanks Odin, thanks Marero.
Hopefully someone may come out with a script which can be called like:
percentage = pdb.((script_fu)or(python_fu))_similarity (imageA, imageB)
with a return value of 0-100
spes ultima dea

_________________
"Where am I ?"


Top
 Post subject: Re: image comparison
PostPosted: Mon Mar 28, 2016 6:29 pm  (#5) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4812
IIRC there is a function like this ImageMagick. but I wonder how/why you would use it in a Gimp filter...

_________________
Image


Top
 Post subject: Re: image comparison
PostPosted: Mon Mar 28, 2016 9:50 pm  (#6) 
Offline
Script Coder
User avatar

Joined: Jul 14, 2010
Posts: 697
dinasset wrote:
thanks Odin, thanks Marero.
Hopefully someone may come out with a script which can be called like:
percentage = pdb.((script_fu)or(python_fu))_similarity (imageA, imageB)
with a return value of 0-100
spes ultima dea


Logistically - how would one define "difference"?

- Would scaled versions of the same image be 100% the same or 100% different?
- Should the comparison be done pixel by pixel or some averaging?
- What colour space should the comparison happen in - RGB, CYM(K), HSV, HSL, LAB, etc....
- Does alpha/transparency count when comparing differences?
- What does a value of 50 mean - 50% of the pixels have any difference, 100% of the pixels are different by 50%, or something else?

-Rob A>

_________________
Image
Fantasy Cartography and Mapping by RobA


Top
 Post subject: Re: image comparison
PostPosted: Tue Mar 29, 2016 12:31 am  (#7) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14831
Location: roma, italy
interesting technical aspects, RobA.
I don't know how "specialized" software (like "Awesome Duplicate Photo Finder") do the comparison.
IMO:
- images should be scaled equally (at least in one dimension) before comparing
- comparison should be able to identify as "almost equal" (80%?) an image compared with its copy a bit blurred
- same for transparency: comparison should be performed after transparency has been removed from both

but these are only my ideas....

_________________
"Where am I ?"


Top
 Post subject: Re: image comparison
PostPosted: Tue Mar 29, 2016 12:33 am  (#8) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14831
Location: roma, italy
let's see other opinions on these aspects
edit: maybe those who know and make use both of Gimp and ImageMagick can see how ImageMagick performs...

_________________
"Where am I ?"


Top
 Post subject: Re: image comparison
PostPosted: Tue Mar 29, 2016 2:42 am  (#9) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4812
dinasset wrote:
let's see other opinions on these aspects
edit: maybe those who know and make use both of Gimp and ImageMagick can see how ImageMagick performs...


You can also have a look at the OpenCV library for python.

_________________
Image


Top
 Post subject: Re: image comparison
PostPosted: Tue Mar 29, 2016 3:22 am  (#10) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 1171
Location: Here and there
Here's the Imagemagick page about doing image comparisons: http://www.imagemagick.org/script/compare.php

Reverse engineering some Python I wrote to examine images captured from a bird nestbox camera:

"C:\Program Files (x86)\ImageMagick-6.8.8-8\convert" file1.jpg file2.jpg -compose  Difference -composite -colorspace gray -format %[fx:mean*100] info:


Which gave me a 0->100 percentage measure of the difference and I deleted anything below a threshold as being insufficiently different.

Kevin


Top
 Post subject: Re: image comparison
PostPosted: Tue Mar 29, 2016 3:29 am  (#11) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14831
Location: roma, italy
ofnuts wrote:
dinasset wrote:
let's see other opinions on these aspects
edit: maybe those who know and make use both of Gimp and ImageMagick can see how ImageMagick performs...


You can also have a look at the OpenCV library for python.

any specific reference? I'm a bit "dispersed" when looking at OpenCV.

_________________
"Where am I ?"


Top
 Post subject: Re: image comparison
PostPosted: Tue Mar 29, 2016 3:30 am  (#12) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14831
Location: roma, italy
paynekj wrote:
Here's the Imagemagick page about doing image comparisons: http://www.imagemagick.org/script/compare.php

Reverse engineering some Python I wrote to examine images captured from a bird nestbox camera:

"C:\Program Files (x86)\ImageMagick-6.8.8-8\convert" file1.jpg file2.jpg -compose  Difference -composite -colorspace gray -format %[fx:mean*100] info:


Which gave me a 0->100 percentage measure of the difference and I deleted anything below a threshold as being insufficiently different.

Kevin

something "portable" into Gimp, Kevin?

_________________
"Where am I ?"


Top
 Post subject: Re: image comparison
PostPosted: Tue Mar 29, 2016 8:28 pm  (#13) 
Offline
GimpChat Member
User avatar

Joined: Nov 16, 2011
Posts: 5127
Location: Metro Vancouver, BC
I stumbled upon python code to compare two images by jsbueno at Stack Overflow.
For a quick demo: Run the attached python script from the command line on the included images (not a Gimp plug-in). It requires Python Imaging Library (PIL)
I think ImageMacgick compare is the best option.


Attachments:
File comment: Not a Gimp plug-in
compare-img-demo.zip [99.73 KiB]
Downloaded 99 times

_________________
Image
Gimp 2.8.18, Linux, median user
Gimp Chat Tutorials Index
Spirit Bear (Kermode)
Top
 Post subject: Re: image comparison
PostPosted: Wed Mar 30, 2016 12:29 am  (#14) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14831
Location: roma, italy
thanks Odin, still hoping to have sooner or later a Gimp filter.

_________________
"Where am I ?"


Top
 Post subject: Re: image comparison
PostPosted: Wed Mar 30, 2016 1:33 am  (#15) 
Offline
GimpChat Member
User avatar

Joined: Nov 16, 2011
Posts: 5127
Location: Metro Vancouver, BC
dinasset wrote:
thanks Odin, still hoping to have sooner or later a Gimp filter.
Have you tried Gimp Compare images script yet?

_________________
Image
Gimp 2.8.18, Linux, median user
Gimp Chat Tutorials Index
Spirit Bear (Kermode)


Top
 Post subject: Re: image comparison
PostPosted: Wed Mar 30, 2016 3:14 am  (#16) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14831
Location: roma, italy
I didn't, Odin.
Done now.
First tests not very...impressive: got always a third image fully white.
Also: a result being an image (should the filter work and show the differences) is not what I'm looking for: I'm looking for a simple percentage: similarity is 75%
"similarity = compare_images (imageA, imageB)"
Thanks anyhow, Odin, for your support

_________________
"Where am I ?"


Top
 Post subject: Re: image comparison
PostPosted: Wed Mar 30, 2016 5:08 am  (#17) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 1171
Location: Here and there
So here's a suggestion for you to code up...

Both images as layers
Set the mode of the top layer to "Difference"
New layer from Visible (gimp-layer-new-from-visible)
With New layer active, look at the histogram (gimp-histogram)
Divide the Mean value by 2.55 to get a percentage (You may want to consider the means of all 4 channels)

Kevin


Top
 Post subject: Re: image comparison
PostPosted: Wed Mar 30, 2016 5:50 am  (#18) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14831
Location: roma, italy
Thanks Kevin.
I will do it.
Just for curiosity: is it what ImageMagick does?

_________________
"Where am I ?"


Top
 Post subject: Re: image comparison
PostPosted: Wed Mar 30, 2016 11:19 am  (#19) 
Offline
GimpChat Member
User avatar

Joined: Nov 16, 2011
Posts: 5127
Location: Metro Vancouver, BC
Have a look at ImageMagick: -segment (segment the colors of an image)

_________________
Image
Gimp 2.8.18, Linux, median user
Gimp Chat Tutorials Index
Spirit Bear (Kermode)


Top
 Post subject: Re: image comparison
PostPosted: Wed Mar 30, 2016 3:31 pm  (#20) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4812
paynekj wrote:
With New layer active, look at the histogram (gimp-histogram)
Divide the Mean value by 2.55 to get a percentage (You may want to consider the means of all 4 channels)

Faster: desaturate, and pixellize the image to its own size (ie, make it one big pixel). The grey level will be a measure of the difference.

_________________
Image


Top
Post new topic Reply to topic  [ 27 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours [ DST ]



* Login  



Powered by phpBB3 © phpBB Group