-1

How is image processing done?

I want to compare two images and identify the differences between them. How do I identify difference between two taken pixels of different images?

8
  • What language, platform? Are you using a number-crunching tool like Matlab or IDL?
    – DarenW
    Nov 29, 2010 at 15:27
  • You can try this link for some pointers stackoverflow.com/q/23931/5195
    – vtbose
    Nov 29, 2010 at 15:44
  • 1
    how different are the images? are they structurally similar (e.g. same image, different compressors), different angles of the same subject, or completely different?
    – mpenkov
    Nov 29, 2010 at 23:53
  • yes @misha, different lighting, focus, scale/resolution, etc...
    – kenny
    Nov 30, 2010 at 0:07
  • Is there any more information you can provide about your image set? Generally, the more assumptions you can make about the images you're comparing, the easier the task becomes. For example, if you know you're working with faces only, the problem can be reduced to comparing the visible facial features. If you know you're dealing with cars, it can be reduced to comparing things like number of wheels, aspect ratio, etc. With zero assumptions, it's an image understanding problem -- a natural task for humans, but quite difficult for a computer to solve.
    – mpenkov
    Nov 30, 2010 at 3:24

9 Answers 9

2

The particulars depend on which language you are using, but generally it works something like this:

Each image is treated programmatically as a two dimensional array. So to find the difference in values at the same pixel (call it x,y) for two different images you would do something like this:

diff = image1[x][y] - image2[x][y]

There are some implementations details you have to wary of (e.g. the difference will be signed), but this is the basic idea.

If you mention what language you're working with, I can offer some advice about how to open an image so that it can be treated like an array.

2
  • thankxxxxxxxxxxxxx.I got the point. I suppose to use java.
    – Nera
    Nov 29, 2010 at 16:51
  • "the difference will be signed" : Be careful about underflow when doing subtraction
    – Bossliaw
    Aug 19, 2011 at 19:01
1

Don't simply add the differences from Answer 1, or positive and negative differences will cancel out! You need to sum the squares of the differences, or their absolute values. You could also consider multiplying the pairs of pixels and dividing by their sum (correlation).

All three of these methods are now technically correct but they will still be far from practically useful. Don't be surprised to find smaller difference between two totally unrelated images than, say, two images of the same object with a slightly different illumination.

1

"How is image processing done?"
Ans: Depends on what processing you want to do. There are hundreds of operations you could do in image processing, each one may have an entirely different approach, the only thing in common being reading and storing the pixel data.

"I want to compare two images and identify the differences between them. How do I identify difference between two taken pixels of different images?"

Before even asking you about the type of images - I would like to ask what you mean by "identify difference between two taken pixels"? Do you just want to know if the two images are different? Do you want to know which pixels are different? Do you want to know if pixels at a given location are different?

1

try processing.js you can do some really fun stuff with that.

http://processingjs.org/

0

Random selecting pixels and check the size of the image. if they are the same, you could possible assume they are identical.

1
  • 1
    If the OP just wanted to know if the images are different, he could use diff. If quick comparisions were needed: checking size + md5 would be much better. The OP wants to identify the difference.
    – JP19
    Dec 23, 2010 at 16:57
0

Here's an image processing example that I did a couple weeks ago.

http://keshavsaharia.com/2011/03/17/theres-waldo-2/

It's built in Mathematica, and takes a Where's Waldo puzzle and uses fairly simple image processing techniques to find Waldo.

Image processing is a pretty simple concept. It is almost entirely based around taking individual pixels and applying transformations to the image as a whole based on numeric properties of the pixel values in relation to other pixel values or to a given threshold value.

Mathematica is a fantastic tool for image processing, as is Matlab and Python (if you're looking for a python solution, check out PIL). Image processing libraries are available for pretty much every programming language - C++ has EasyBMP, Java has a wide variety of image tools, and every language has its own set of unique methodologies. Choose the language based on your application.

0

If you need just a simple comparison of two images on the pixel basis, there is nothing as simple as count sum of differences between each pixels of two images. This approach is not very versatile and for example different illumination can significantly affect results.

What is to say, image comparison is still open research problem and it is related to the image-mining task.

If you need some more advanced image comparison, you can try Rapidminer with IMMI extension which includes several advanced methods for image comparison.

0

Image processing is a massive field so I don't think any single answer on here will teach you everything there is to know about image processing. There are many great sources and lectures scattered all over the internet that you can learn tons of information from. If you want a good book for signal processing (signal is representative of almost any datatype: light, sound, image, etc, etc...) which covers a huge number of signal processing techniques check out Signals and Systems.

But otherwise if you just want to learn basic processes that can be applied to images check out the processing language (like jaboston said) and its tutorials/learning books as its essentially designed for visual artists and makes image processing a much less laborious (syntactically) task than other languages: http://processing.org/ .

And erich has the right of it- use the euclidean distance to work out the difference between two pixels.

2
  • Do not post links to pirate ebook sites. I've replaced your link with one to Amazon, where people can go to actually buy this book.
    – Brad Larson
    Mar 28, 2012 at 15:23
  • Apologies, I thought I had linked to a site that sold it I have a hardcopy of this book, and don't recommend piracy
    – schanq
    Mar 29, 2012 at 19:38
0

Image similarity is not an easy task and is still open research problem. Pixel per pixel comparison usually does not give good results and at the same time it is quite time consuming.

One of the approach is to use Rapidminer (open-source tool). Radpiminer (widely used data mining platform, http://rapid-i.com) with IMMI plugin (IMage MIning extension, http://splab.cz/immi) implements similar methods and can do some non-trivial similarity measurements.

Not the answer you're looking for? Browse other questions tagged or ask your own question.