开发者

comparing images programmatically - lib or class [closed]

开发者 https://www.devze.com 2022-12-08 05:26 出处:网络
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references,or expertise, but this question will likely solicit debate, a
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 9 years ago.

My objective is to supply 2 image files, and get a true/false response as to whether these 2 files could be the same (within an acceptable degree of certainty).

I realize this question falls under artificial intelligence and is much more complex than it appears, so I highly doubt I could (or would even want to) do it myself. What I'm looking for is probably a library or a class. I'm working with PHP.

thanks in advance..

All helpful answers/comments get up voted..

Update:

I wonder if I'm over-c开发者_如何学Goomplicating it, and maybe a more general library like imageMagick (imagick) could get it done? Anyone who's more experienced with imageMagick?


I didn't try it, but maybe Libpuzzle might do the trick (quoting) :

The Puzzle library is designed to quickly find visually similar images (GIF, PNG, JPG), even if they have been resized, recompressed, recolored or slightly modified.

This is a C library, but is also comes with a command-line tool and PHP bindings.

And there is an example in PHP there.

(It seems to be a PHP extension -- which means you'll need to be admin of your server to be able to install it)


There are already many questions on SO about detecting similar images:

  • Near-Duplicate Image Detection
  • Removing Duplicate Images
  • Image fingerprint to compare similarity of many images
  • How can I measure the similarity between two images?
  • writing a similarity function for images for clustering data


http://tineye.com/ may be useful if you're just comparing your own images.

You should probably do some research on image similarity algorithms, though anything advanced isn't going to suit a scripting language like PHP. The most simple comparison method would work like this:

  1. Make both images the same size if they are not already.
  2. Compare each corresponding pixel and decide how similar they are. Simplest method is to take the difference between the red values, then the blue values, then the green values, and average them.
  3. Take the average difference from all the pixels. If it's below some threshold you decide, then the images are the same or similar. You'd need to test with various images to decide on a threshold.

I'm not totally familiar with ImageMagick and PHP's image functions so not sure if you can do all of this.

0

精彩评论

暂无评论...
验证码 换一张
取 消