Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re: comparing two images and detecting differences

by daddyefsacks (Pilgrim)
on Dec 31, 2003 at 05:22 UTC ( #317835=note: print w/replies, xml ) Need Help??

in reply to comparing two images and detecting differences

merlyn has a column seemingly very similar to what you are looking for. Take a look here if you are interested. Best of luck!
  • Comment on Re: comparing two images and detecting differences

Replies are listed 'Best First'.
Re: Re: comparing two images and detecting differences
by moof1138 (Curate) on Dec 31, 2003 at 06:08 UTC
    I did a cursory search of Merlyn's articles, but somehow I missed the perfect one. Many thanks for that link. That looks like an excellent place to start.
Re: Re: comparing two images and detecting differences
by bean (Monk) on Dec 31, 2003 at 22:10 UTC
    I don't actually think it's very similar. merlyn was trying to find similar images (differing by resolution, format, etc, but otherwise more or less identical) whereas moof1138 is trying to find similar objects - the images he will be comparing will all be lit differently and be photographed against different backgrounds. Removing the backgrounds and adjusting colors based on lighting are both nontrivial tasks. I think the C/C++ based tools mentioned by tachyon in the first post will be your best bet.
Re: Re: comparing two images and detecting differences
by biosysadmin (Deacon) on Jan 01, 2004 at 09:46 UTC
    This is definitely a cool problem, here's a possible snag that you may run in to:

    "My selected strategy is to reduce each image to a 4-by-4 grid of RGB values, yielding a 48-number vector of values from 0 to 255."

    Assuming that the counterfeits would at least have similar color schemes to the originals, this has a very good chance of generating a lot of falsely positive matches. You could get around this by increasing the size of the grid (and therefore the length of your vectors), but this is the kind of algorithm in which C/C++ would probably outperform Perl (although you could check out the pdl). Even after making your vectors then you're left with the task of determining a metric for measuring similarity of vectors and deciding how similar two vectors must be in order to assume that they point to the same type of coin.

    Here's what I think that I would do:

    - Play with generating vectors using the method from Merlyn's article until you find an acceptable balance of speed and sensitivity.
    - Use a measure of similarity between vectors (such as Euclidean distance) and compare different images of the same coin.
    - Attempt to determine a reasonable threshold for assuming that they point to a counterfeit copy of the same type of coin.

    Actually, more realistically I'd put this off until after vacation, when I could go back and ask an imaging scientist friend about the problem. :)

    Good luck, and have fun.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://317835]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2023-06-08 12:29 GMT
Find Nodes?
    Voting Booth?
    How often do you go to conferences?

    Results (30 votes). Check out past polls.