in reply to Fast way to compare two picture-files

It depends very much to what degree you want to compare those images. I fully agree with ikegami on the fact that if you want to know if two files are exactly the same you can just use byte-to-byte comparison instead of computing hashes for the files,but in the worst case(which is rarely the case in practice) you will have lots of duplicates and then the MD5 will payoff(but again,that is rarely the case). But all of this matters only if you have substantial amounts of data on which you run your scripts,if you are dealing with small amounts it's not worth the trouble of optimizing. Also, maybe what you are trying to do is not byte-to-byte match but you are looking for a similarity match,maybe the images are very similar. Someone has thought of this and has written something that makes the difference between pixels of an image and if the differences are below a certain mindist(a threshold value) than the images are said to be similar,otherwise they are different. The code for that is in the Image::Filters module over here. Things can also get more complicated if you consider comparing images that are a scaling of one another or maybe comparing ones that are a translation of one another, you could use the Hausdorff measure, an implementation of that in pure C is here but to applu this you probably first have to use some kind of edge-detection. These things are explained here in a bit more detail. Some people have also written some nice software for searching images based on similarity called imgseek. So first decide what you exactly mean by image comparison and then choose what is more appropriate.
  • Comment on Re: Fast way to compare two picture-files