Re: Finding similar images

From: Bob Richardson (bobr_at_whidbey.com)
Date: 01/22/04


Date: Thu, 22 Jan 2004 10:21:28 -0800


> > A "border" is present if there is a "line" at the outer edges of the
image
> > made up of 1 color only.
> > - Starting from the outer pixel, move inwards until color changes
> > - Then, check if the entire image edge has the same color.
> > (the borders may be of somewhat different widths, and you need to handle
> the
> > corners, where borders meet)
> >
> > Do the border test first, compare images afterwards (taking image
borders
> > into account).
>
> Border detection makes perfect sense and should be a simple enough
exercise.

On some of my digital photos, I really like to put "wooden" frames. There
are free downloads that can be used with PhotoShop which allow you to choose
among 20 or more different wood types (pine, oak, etc.), and of course there
are different styles. Thus, the test for a border is much more difficult,
since a "solid" color isn't involved...the digital wood has a nice grain
look.

Concerning height/width ratios, one of the most obvious fixes to a photo is
to crop it, which change the ratio almost every time.

You also have to consider that two photos might be identical/similar, but
just rotated 90 or 180 degrees, and certainly a grayscale conversion of a
colored pic would be "similar," or perhaps one pic slightly darkened, or
flash-filled.

If you've played with PhotoShop or any graphics program, you know that a
photo can be manipulated in a bazillion different ways.

Given all that, here's my first attempt at a process:

1. convert both pics to grayscale
2. find several, non-contiguous, major transition points in each photo.
3. if most angles between these transition points are equal, I would next
try to superimpose one picture on the other, shrinking the larger photo if
necessary. Consider ALL possible rotations-not just 90,180,270 degrees. (I
take many photos with the sea as a backdrop - and I often rotate my pics 1
or 2 degrees to level out the horizon).
4.At this point, any frame would be "hanging out" - and thus you would lop
it off. (If both pics had frames, just the larger frame would have some of
it trimmed away).
5. Remove any remaining, frame-like, border (so it won't skew your
brightness normalizing)
6. I would probably shrink both photos to a fairly small size (100 X 100 or
smaller) to make sure I'm looking at the forest, not the trees.
7. Next normalize both pics to the same brightness and contrast scale.
8. Then do a pixel by pixel comparison, testing the change in darkness
rather than the absolute level of darkness. Go left-right, up-down, and on a
diagonal.

In other words, my approach would be to dumb down both pictures so that only
the essence remains, then compare. Reducing the pics to 100 X 100 black and
whites will make the task manageable.

The hardest part will be defining transition points - from light to dark,
while not getting confused by additions to the photo. For example, two Mona
Lisa's, but one has a black tape over her lips. There will be several
"transition points" created by the tape in one pic, but not the other.
Another "fraud" might be Mona Lisa in a snow storm, or behind a chain linked
fence.

It would nice (for testing and debugging purposes) if your initial program
(while you're developing your algorithms) showed the two pics, side by side,
as the photos gradually got rotated, sized, and trimmed.



Relevant Pages

  • Re: Swan with Cygnets
    ... P.S. Forgive the 'bevel' around the edges! ... It's a bad habit I picked up early on when I first began taking photos ... I use a very narrow border around all images to set off the image from ... It's one of those frames which your eyes notice, ...
    (alt.photography)
  • Re: Flowers in the studio
    ... Are they a side-effect of a Photoshop tool, from manual retouching, or resizing for the web? ... This one is more prevalent on the upper right, and also outside the border all around. ... My comments are much more about trying to learn, rather than picking apart your excellent photos. ...
    (alt.photography)
  • Re: Layout thoughts and Ideas requested!
    ... I figured with all of the extra seams next to the binding it would be ... missing links on that one -- guess I got carried away deleting photos to ... go for part of the border. ...
    (rec.crafts.textiles.quilting)
  • Re: Layout thoughts and Ideas requested!
    ... blackish red] border, ... finished) border and then the piano keys. ... either one looked when I laid it on the board. ...  I can easily take photos of this thing, ...
    (rec.crafts.textiles.quilting)
  • Photo album - and autoshape defauls - yikes
    ... I'm trying to insert a photo album off 200 photos - all have a shadow ... When I use this feature, all 200 photos show up with that ugly ... pale blue fill,, and there is a border. ...
    (microsoft.public.powerpoint)