Compare image levels?

  • I am trying to find a way to compare images based on colour etc.
    If I am using Photoshop I can use it doing the levels or historyogram
    and then visually compare the information. I am wondering if I can
    somehow do this programmatically?

    The idea is compare two images and check if they are the same or
    similiar
    based on their levels possibly comparing to a range of levels to find
    a match.

    Can anyone give me a starting point?
    Thanks
    Brendan
  • Image comparison is a very, very complex subject.  It has been the subject
    of more than a few CompSci PhD theses.  So, a short answer is difficult.

    However, picture data is just data.  A byte (more or less) for Red, one for
    Green, one for Blue, etc. (if in RGB).  You can access the data in an
    NSBitmapImageRep and have at it.

    You will soon, however, realize that this is really hard.  Compression
    algorithms mess with the data "just a little bit" to get better results, and
    that throws off comparisons.  Pictures get cropped and that makes them just
    a bit different.  And so on.  Comparing strictly numerically almost never
    works.

    However, as a starting point, you might consider looking at the project:

    > From: Brendan Wilde <Brendan.wilde...>
    > Date: Tue, 27 Nov 2007 11:23:26 +1100
    > To: <cocoa-dev...>
    > Subject: Compare image levels?
    >
    > I am trying to find a way to compare images based on colour etc.
    > If I am using Photoshop I can use it doing the levels or historyogram
    > and then visually compare the information. I am wondering if I can
    > somehow do this programmatically?
    >
    > The idea is compare two images and check if they are the same or
    > similiar
    > based on their levels possibly comparing to a range of levels to find
    > a match.
    >
    > Can anyone give me a starting point?
    > Thanks
    > Brendan
  • Poop, accidentally hit send...

    Check out the Perceptual Image Difference project on sourceforge at:

    http://sourceforge.net/projects/pdiff/

    > From: Chris Williams <chris...>
    > Date: Mon, 26 Nov 2007 16:43:59 -0800
    > To: Brendan Wilde <Brendan.wilde...>, <cocoa-dev...>
    > Conversation: Compare image levels?
    > Subject: Re: Compare image levels?
    >
    > Image comparison is a very, very complex subject.  It has been the subject of
    > more than a few CompSci PhD theses.  So, a short answer is difficult.
    >
    > However, picture data is just data.  A byte (more or less) for Red, one for
    > Green, one for Blue, etc. (if in RGB).  You can access the data in an
    > NSBitmapImageRep and have at it.
    >
    > You will soon, however, realize that this is really hard.  Compression
    > algorithms mess with the data "just a little bit" to get better results, and
    > that throws off comparisons.  Pictures get cropped and that makes them just a
    > bit different.  And so on.  Comparing strictly numerically almost never works.
    >
    > However, as a starting point, you might consider looking at the project:
    >
    >
    >
    >> From: Brendan Wilde <Brendan.wilde...>
    >> Date: Tue, 27 Nov 2007 11:23:26 +1100
    >> To: <cocoa-dev...>
    >> Subject: Compare image levels?
    >>
    >> I am trying to find a way to compare images based on colour etc.
    >> If I am using Photoshop I can use it doing the levels or historyogram
    >> and then visually compare the information. I am wondering if I can
    >> somehow do this programmatically?
    >>
    >> The idea is compare two images and check if they are the same or
    >> similiar
    >> based on their levels possibly comparing to a range of levels to find
    >> a match.
    >>
    >> Can anyone give me a starting point?
    >> Thanks
    >> Brendan
  • Chris Williams already gave you a good answer for finding the differences
    between images, but I'm still curious as to what your goal is.  What
    precisely are you trying to accomplish?  Knowledge of which pixels are
    different between two images, knowledge of how the pictures has been
    translated/rotated/skewed, what?

    Thanks,
    Cem Karan
  • On 11/27/07 11:23 AM, Brendan Wilde said:

    > I am trying to find a way to compare images based on colour etc.
    > If I am using Photoshop I can use it doing the levels or historyogram
    > and then visually compare the information. I am wondering if I can
    > somehow do this programmatically?
    >
    > The idea is compare two images and check if they are the same or
    > similiar
    > based on their levels possibly comparing to a range of levels to find
    > a match.
    >
    > Can anyone give me a starting point?

    Like Chris said, this is a complex topic.  However, vImage does have
    histogram APIs, such as: vImageHistogramSpecification_ARGB8888().

    --
    ____________________________________________________________
    Sean McBride, B. Eng                <sean...>
    Rogue Research                        www.rogue-research.com
    Mac Software Developer              Montréal, Québec, Canada
previous month november 2007 next month
MTWTFSS
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30    
Go to today