Comparing Images For Similarity

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Aug 2004
Posts: 350
Reputation: Ghost is an unknown quantity at this point 
Solved Threads: 2
Ghost's Avatar
Ghost Ghost is offline Offline
Posting Whiz

Comparing Images For Similarity

 
0
  #1
Jun 5th, 2005
Hi,

I was wondering if there was a way to compare two images for similarity (i.e. checking to see if signature is same as signature on a credit card). Thankx in advanced.

--
C++
Reply With Quote Quick reply to this message  
Join Date: Jun 2004
Posts: 2,108
Reputation: server_crash is on a distinguished road 
Solved Threads: 18
server_crash server_crash is offline Offline
Postaholic

Re: Comparing Images For Similarity

 
0
  #2
Jun 5th, 2005
Basicly there's three steps:
> 1. convert the two images to an array of integer.
> 2. compare the two arrays.
> 3. then decide if they're a similar or not.

You convert the two images into an array by creating a PixelGrabber, and then getting the pixels. You can also store colors and compare to make it more accurate.


Now, you can try just comparing Image Objects, but I don't know how accurate that would be:

  1. Image one = new Image(...);
  2. Image two = new Image(...);
  3. if(one.equals(two)){
  4. //... true
  5. }
  6. else{
  7. //false
  8. }



I've never really done this, so I don't know how either approach will work out.
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 121
Reputation: tonakai is an unknown quantity at this point 
Solved Threads: 11
tonakai's Avatar
tonakai tonakai is offline Offline
Junior Poster

Re: Comparing Images For Similarity

 
0
  #3
Jun 5th, 2005
it is a very deep subject and hard one, and comparing pixel-by-pixel is a very slow approch, i suggest you searching "image processing"....
in GIMP's web site you can find source code of this program which is a very good image processing tool....
Good news, everyone!
aykutsoysal.com
Reply With Quote Quick reply to this message  
Join Date: Aug 2004
Posts: 350
Reputation: Ghost is an unknown quantity at this point 
Solved Threads: 2
Ghost's Avatar
Ghost Ghost is offline Offline
Posting Whiz

Re: Comparing Images For Similarity

 
0
  #4
Jun 5th, 2005
server_crash, i tried your second technique and it turns out the images are never the same. I'm going to try your first method. could you please go into a little more detail on the first method. specifically, what method in the pixel grabber class returns an array of ints. thanx.

tonakai, what exactly is gimp? I'm a little confused. thanx for trying to help.

I also have one more question:
How do you copy a pictre to the clipboard

Thanks for all your help. I really appreciate it.
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 121
Reputation: tonakai is an unknown quantity at this point 
Solved Threads: 11
tonakai's Avatar
tonakai tonakai is offline Offline
Junior Poster

Re: Comparing Images For Similarity

 
0
  #5
Jun 5th, 2005
gimp is a program like abode photoshop but it is free. and you can have the source code. they may also help you, because these guys are all interested in image processing.
you can also find ready to use image processing libraries, but i am not sure where to look. if you want next year i am going to have a course, so i can give more information
Good news, everyone!
aykutsoysal.com
Reply With Quote Quick reply to this message  
Join Date: Aug 2004
Posts: 350
Reputation: Ghost is an unknown quantity at this point 
Solved Threads: 2
Ghost's Avatar
Ghost Ghost is offline Offline
Posting Whiz

Re: Comparing Images For Similarity

 
0
  #6
Jun 5th, 2005
thanx. i edited my above post and added a few questions. could you help?

Thanks again.
Reply With Quote Quick reply to this message  
Join Date: Jun 2004
Posts: 2,108
Reputation: server_crash is on a distinguished road 
Solved Threads: 18
server_crash server_crash is offline Offline
Postaholic

Re: Comparing Images For Similarity

 
0
  #7
Jun 5th, 2005
I'm going somewhere right now, but I'll get back to you on the questions a little later...Hope you don't mind.

I think the method in pixel grabber is .grabPixels()
Reply With Quote Quick reply to this message  
Join Date: Aug 2004
Posts: 350
Reputation: Ghost is an unknown quantity at this point 
Solved Threads: 2
Ghost's Avatar
Ghost Ghost is offline Offline
Posting Whiz

Re: Comparing Images For Similarity

 
0
  #8
Jun 5th, 2005
I dont think .grabPixels returns an array of ints. Second, just so you know, im trying to compare two signatures. they may be slightly different from each other.

thanx.
Reply With Quote Quick reply to this message  
Join Date: Aug 2004
Posts: 350
Reputation: Ghost is an unknown quantity at this point 
Solved Threads: 2
Ghost's Avatar
Ghost Ghost is offline Offline
Posting Whiz

Re: Comparing Images For Similarity

 
0
  #9
Jun 5th, 2005
unfortunately, pixel grabber never works.
Reply With Quote Quick reply to this message  
Join Date: Aug 2004
Posts: 350
Reputation: Ghost is an unknown quantity at this point 
Solved Threads: 2
Ghost's Avatar
Ghost Ghost is offline Offline
Posting Whiz

Re: Comparing Images For Similarity

 
0
  #10
Jun 5th, 2005
sorry for being vague. when i check if int array one = int array two, it always turns out false. when i check if pixelGrabber.grapPixels() == pixelGrabber.grabPixels() it's always true.

any suggestions ??????????
thanx.
Reply With Quote Quick reply to this message  
Reply

Message:



Other Threads in the Java Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC