Re: Identical Pix

Discussion in 'Digital Photography' started by Chris Malcolm, Aug 15, 2012.

  1. Dudley Hanks <> wrote:
    > I had this great idea to write a Perl script to help isolate my subjects
    > from their backgrounds...


    > I thought I could take two pics, one without the subject and one with, both
    > shot in manual mode with the same settings, shot only moments apart.


    > Then, I thought I could run through the pixels and change the pixels that
    > were the same for a different background colour, leaving the subject intact,
    > as it would have pixels different from the first image.


    > I assumed that the pixels should be the same in the background but different
    > where the subject was situated.


    > Interestingly, even though there is no apparent difference when viewed side
    > by side, individual RGB values can vary by more than +/-25 per red, green or
    > blue component on virtually every pixel.


    > In spite of shooting in RAW and using lossless png source files, all but a
    > couple of hundred thousand pixels were unique between images.


    > I've only conducted the experiment after using Irfanview to convert the RAW
    > files to png, so it could be something in this particular application. I'll
    > check it out a bit more thoroughly, tomorrow, using Adobe, but it looks as
    > though each shot is truly unique, regardless of how similar they might
    > appear.


    > BTW, as a control, I compared two copies of the same file, and as one would
    > expect, the whole image went black, so it would seem that the script is
    > working properly, it's just that the rgb values are unique when pics are
    > shot moments apart.


    > Anyone out there have any experience with trying this technique, but with
    > more success?


    > Take Care,
    > Dudley


    This is a classic machine vision problem. The pixel differences are
    there for so many hard to control reasons which others have mentioned
    that you have to live with them. To isolate subject from background
    you must first noise reduce the images until the backgrounds are the
    same within a small tolerance. You could help this process by first
    optically smoothing and noise reducing the background, i.e. having it
    out of focus, the better bokeh the easier :)

    Unless you have carefully controlled constant lighting conditions
    (mains powered lighting is rarely constant unless you use long
    exposures) there will so much variation in how much noise reduction
    and how much tolerance will do the job that you'll either have to tune
    these manually or use a smart adaptive value optimising
    algorithm. Having used that process to delineate subject from
    background you will then need to go back to the original effectively
    higher resolution image and map the delineation back onto it. Some
    care in that mapping back will be necessary to avoid visually obvious
    tiny high contrast oddities in the edge which will look like careless
    scissor work in a real cut and paste.

    If the new background is going to be other than simple flat single
    colour or too blurred to show any detail it will need to have
    appropriately similar lighting conditions to avoid looking like a cut
    and paste job.

    That's the hard way. As always it may be possible in some circs for
    some images to find a quick and dirty short cut fix which will work
    surprisingly well. Making people seem to float in the air by by using
    two images, one without subject and support, and using those to
    subtract only the support which holds them up is a popular trick. It's
    usually done the hard way by hand painting the background from one
    image over the support in the other, but some determined people
    suffering from the Programmer's Delusion might have succeeded in
    building automated versions of that trick with ideas you might find
    useful.

    Here's another idea. Hit the subject with so much nearby local light
    that the background is at least a stop darker than the dark bits of
    the subject. Then in converting from RAW just raise the black level
    until the background goes completely black. Powerful studio strobe
    lights can do that even in sunlight. The sun can even do it all by
    itself if you pose the subject against a deeply shaded background.

    [The Programmer's Delusion: "This is a tedious process which will take
    me a few hours of painstaking work. Hm. I could save myself a
    lot of time by writing a program which would do it in less than a
    minute!"

    The delusion is of course not considering that saving a few hours of
    tedious painstaking work will take several days of tedious painstaking
    coding and debugging.]

    --
    Chris Malcolm
    Chris Malcolm, Aug 15, 2012
    #1
    1. Advertising

  2. Chris Malcolm <> wrote:

    > [The Programmer's Delusion: "This is a tedious process which will take
    > me a few hours of painstaking work. Hm. I could save myself a
    > lot of time by writing a program which would do it in less than a
    > minute!"


    > The delusion is of course not considering that saving a few hours of
    > tedious painstaking work will take several days of tedious painstaking
    > coding and debugging.]


    The other delusions are that
    a) (mostly) blind people can do such visual tedious
    painstaking work --- especially in a few hours
    b) such a task happens only so rarely that
    "x * a few hours" < "1 * several days" is still true
    c) it's not a good use of time to create such a program because
    people are only interested in photography
    d) noone else would be interested in the working program, because
    they all prefer painstaking work for hours instead of a one
    minute program run

    However, my guess is that you'd need to be well versed in machine
    vision (and can build on the libraries of others in that area)
    to manage to program sich a tool in several days. The obvious
    naive solution, as Dudley found, doesn't work.

    -Wolfgang
    Wolfgang Weisselberg, Aug 16, 2012
    #2
    1. Advertising

  3. Wolfgang Weisselberg <> wrote:
    > Chris Malcolm <> wrote:


    >> [The Programmer's Delusion: "This is a tedious process which will take
    >> me a few hours of painstaking work. Hm. I could save myself a
    >> lot of time by writing a program which would do it in less than a
    >> minute!"


    >> The delusion is of course not considering that saving a few hours of
    >> tedious painstaking work will take several days of tedious painstaking
    >> coding and debugging.]


    > The other delusions are that
    > a) (mostly) blind people can do such visual tedious
    > painstaking work --- especially in a few hours


    You misunderstood. Of course I know Dudley can't do that kind of
    thing. What I was suggesting was that for that reason some of the
    "flying in the air" photographic tricksters might have developed some
    simple software he could use.

    > b) such a task happens only so rarely that
    > "x * a few hours" < "1 * several days" is still true
    > c) it's not a good use of time to create such a program because
    > people are only interested in photography


    Unless of course they happen to be programmers with an interest in
    machine vision :)

    --
    Chris Malcolm
    Chris Malcolm, Aug 18, 2012
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Saucy Levine
    Replies:
    1
    Views:
    604
    Walter Roberson
    Dec 8, 2003
  2. PeterN

    Re: Identical Pix

    PeterN, Aug 14, 2012, in forum: Digital Photography
    Replies:
    3
    Views:
    317
    Martin Brown
    Aug 15, 2012
  3. PeterN

    Re: Identical Pix

    PeterN, Aug 15, 2012, in forum: Digital Photography
    Replies:
    0
    Views:
    221
    PeterN
    Aug 15, 2012
  4. otter

    Re: Identical Pix

    otter, Aug 15, 2012, in forum: Digital Photography
    Replies:
    0
    Views:
    213
    otter
    Aug 15, 2012
  5. Whisky-dave

    Re: Identical Pix

    Whisky-dave, Aug 15, 2012, in forum: Digital Photography
    Replies:
    0
    Views:
    240
    Whisky-dave
    Aug 15, 2012
Loading...

Share This Page