8

I am having an issue while comparing two images which are same. if the image sizes are same then can compare (No issues), if sizes are different, then I am unable to compare. I am comparing pixel by pixel.

Is there any way in C#.net to compare similar images like can match around 70%.

Thanks

Laxman

laxman digari
  • 127
  • 2
  • 3
  • Even if you compare resolution or byte size representation as well. The output isnt accurate. So to compare image contents are same, i guess you need to do pixel by pixel match. Or may be like google image recogniztion does, match patterns in image sequence, guess thats very difficult solution. – Zenwalker Sep 16 '11 at 04:30
  • It doesn't make any sense to compare images of different sizes pixel-by-pixel. What sort of program are you writing? – Brian L Sep 16 '11 at 04:31
  • You cannot do pixel by pixel comparison in this case - You might have some luck using OpenCV for this - here's a thread detailing an approach: http://stackoverflow.com/questions/4196453/simple-and-fast-method-to-compare-images-for-similarity – BrokenGlass Sep 16 '11 at 04:32

2 Answers2

3

You need to calculate and compare perceptual hash of both the images.

Read the following article and implement it in C# https://www.memonic.com/user/aengus/folder/coding/id/1qVeq

OR

You can use Exhaustive Template Matching class of AForge to compute image similarity

The class also can be used to get similarity level between two image of the same size, which can be useful to get information about how different/similar are images:

Muhammad Hasan Khan
  • 34,648
  • 16
  • 88
  • 131
0

Use gaussian filter and resize bigger one to smaller's size then use gaussian filter on smaller one too then try to compare them.Color ratios will not change too much you can use that too if you dont want to resize them. You can search pyramid feature detection.I hope that may help. http://en.wikipedia.org/wiki/Pyramid_(image_processing)

oknsnl
  • 351
  • 1
  • 11