Replacing Complex Tone/Color Backgrounds

Moderator: jsachs

den
Posts: 856
Joined: April 25th, 2009, 6:33 pm
What is the make/model of your primary camera?: Canon EOS-350D/Fuji X100T
Location: Birch Bay near Blaine, WA USA

Replacing Complex Tone/Color Backgrounds

Post by den »

In MWarren's recent DPR Retouching post (http://forums.dpreview.com/forums/read. ... e=35300586), he suggests some preplanning and a method to extract main subjects from a complex tone/color background.
The next time you have a project where you know in advance you are going to replace the background behind the subjects, try this.

Shoot two shots on a tripod. One with the subjects and one with the background only.

In post processing follow these steps:
Layer the background only image over the image with the background and the subjects.
Set the background image only layer (top layer) to difference mode.
Stamp Visible.
Use magic wand (with tolerance set to 2, contiguous off) to click on the Black background.
Type Q to enter Quick Mask to check selection and clean up any bits that should not be part of the selection. (Type Q again to leave Quick Mask Mode)
Duplicate the original image (with the subjects and background) and place on the top layer.
Inverse the Selection.
Add mask to the image layer.
Place new background image under this layer.

Try this procedure with these images. (download from: http://forums.dpreview.com/forums/read. ... e=35300586 ..den)

If you are really, really bored, try extracting the pineapple with your favorite masking program / method.
Let me know if you have any questions.

This is a great technique if you are shooting group shots at a wedding outside and the background is not so great. A little planning will save you lots of time in post.
Mike
Pre-planning considerations may include: (1) knowing that you are going to change the background; (2) that the background is static during the time it takes to make both 'shots'; (3) that the main subject backgound shadows are not of major importance; (4) remembering to switch camera 'auto' settings to manual after taking the combined main subject/backgound shot so that the camera maintains exposure, focus, and aperature for the background shot; (5) and of course, all this accomplished using a steady tripod.

A PWP5 suggested main subject mask workflow...
(1) download the OP's 'backgound_only' and 'pineapple-bkg' jpegs.

(2) click on the 'pineapple-bkg' image, open Composite-AbsoluteDifference, set Overlay = the 'background_only' image, click OK.

Creates an 'AbsoluteDifference' image where the background image areas are black with some isolated black in the main subject image areas.

(3) click on the resulting (2) image, open Mask Tool - BrightnessCurve, form, 'lower-left' Apply Add, OK a BrokenLine curve = [0,0], [10,100], [100,100].

Masks the backgound image areas surrounding the main subject with a slight outline edge gradient.

(4) click on the resulting (3) mask image, open the Mask Tool - BrightnessCurve; form and 'lower-left' Apply Add the default [0,0], [100,100] diagonal curve; and then form, 'lower-left' Apply Subtract, OK a BrokenLine curve [0,100], [50,100], [100,0].

Subtracts the black [0%] to 50% toned outline edge gradient from the mask.

(5) click on the resulting (4) mask image, open the Mask Tool - FloodFill; select large background areas [black] as needed to isolate the main subject [white with gray mix]; Invert; OK.

Eliminates the main subject non-white mask image areas inside its outline.

The resulting (5) mask image is sharp edged and will require further preferential feathering and/or blur when used to Composite-Blend the main subject with its new background...

(3), (4), and (5) resulting mask images should look something like this, left to right:
masks 3,4, and 5_400px.jpg
masks 3,4, and 5_400px.jpg (27.43 KiB) Viewed 7182 times
For the illustration below, the resulting (5) mask was feathered -2, then +1 and the new background has a 0 to 100% toned colored gradient with 3.5% guassian HSV-V noise, and a 'drop shadow' was added to the main subject...
ori-new_backgnd_400px.jpg
ori-new_backgnd_400px.jpg (47.6 KiB) Viewed 7182 times
MikeG
Posts: 243
Joined: April 25th, 2009, 4:36 pm
What is the make/model of your primary camera?: Panasonic G1
Location: Sydney, Australia

Re: Replacing Complex Tone/Color Backgrounds

Post by MikeG »

Magic! Thanks, Den.

But the pre-planning.. Should get an opportunity over the week end while it's fresh in my memory.

Mike.
doug
Posts: 111
Joined: April 24th, 2009, 10:06 am
What is the make/model of your primary camera?: Nikon D-500
Location: Toledo, Ohio USA

Re: Replacing Complex Tone/Color Backgrounds

Post by doug »

Den ...
I tried to execute your tutorial with the pineapple image. Everything was going well until I got to step #5 which involved a Mask instruction involving "FloodFill". I couldn't identify what this meant with my PWP version 4.0. I don't know what is meant by "FloodFill" and that terminology did not pop up as I passed my cursor over each of the mask tools. Can you be more expansive in your description of this step -- particularly as it applies to PWP 4.0?

Doug
den
Posts: 856
Joined: April 25th, 2009, 6:33 pm
What is the make/model of your primary camera?: Canon EOS-350D/Fuji X100T
Location: Birch Bay near Blaine, WA USA

Re: Replacing Complex Tone/Color Backgrounds

Post by den »

Doug...

FloodFill is a feature of PWP5's Mask Tool. For those using prior program versions, you will have to manually Subtract the non-white pixels inside the main subject outline of the (4) mask image with the Freehand Outline and/or Paint tools... can be somewhat tedious... At the moment I don't know of a quick way but if something occurs, I'll advise.

den
penumbra
Posts: 5
Joined: April 26th, 2009, 10:36 pm

Re: Replacing Complex Tone/Color Backgrounds

Post by penumbra »

For PW4 and earlier users, I was able to make a fairly good mask using absolute difference, then brightness curve step function (or color curves V) to map all but absolute black to white, then convert to 8-bit BW. The result needed only a small amount of touch up.
den
Posts: 856
Joined: April 25th, 2009, 6:33 pm
What is the make/model of your primary camera?: Canon EOS-350D/Fuji X100T
Location: Birch Bay near Blaine, WA USA

Re: Replacing Complex Tone/Color Backgrounds

Post by den »

A couple of additional comments...

(1) I don't know how well the suggested workflow will respond with actual working images as the 'pineapple-bkg' and its 'background_only' jpegs seem a bit contrived. Obviously, the closer you can make the background images areas of the two shots the same... no movement camera and scene, same focus, exposure, and aperature... the better the 'AbsoluteDifference' extraction.

(2) For the extraction to be believeable, the main subject outline edge of the final mask image is critical... otherwise you will have original background elements included and main subject elements excluded and the main subject will not Composite-Blend believeably with a new background... hence care is needed to preserve the "as is" outline edges of the (4) mask image when removing its interior non-white pixels. PWP5's FloodFill and its default threshold setting seems to do this satisfactorily.

(3) Here is a 1:1 resolution crop of the extracted pineapple with its new fabricated background... note that the edges are not overly contrived in appearance...
pineapple_new-bkgrnd-1to1_327px.jpg
pineapple_new-bkgrnd-1to1_327px.jpg (47.66 KiB) Viewed 7026 times
MikeG
Posts: 243
Joined: April 25th, 2009, 4:36 pm
What is the make/model of your primary camera?: Panasonic G1
Location: Sydney, Australia

Re: Replacing Complex Tone/Color Backgrounds

Post by MikeG »

Well I've now tried a couple of 'real life' examples with disappointing results.
Both were outside, with the backgound a brushwood fence - no vegetation.
I did the basics. Tripod mounted camera. Focus and exposure manual. Shots taken in quick succession.
My first attempt foundered largely due to a slight shadow cast by the subject. Obviously the shadow in not present in the background image. Also, somewhat to my surprise, it was clear that the camera was detecting slight movement in the brushwood fence, which is a sturdy fence, well supported. Admittedly it is a fairly breezy day...
I tried again, this time I eliminated any risk of shadow. Still some slight movement detected in the fence, which could be 'edited out', but the other issue was that the Absolute Difference function detecting no difference between small, but scattered, areas of the subject and the background, on the borders of the subject, thus tedious to deal with.
Losing enthusiasm for this technique!

Mike.
den
Posts: 856
Joined: April 25th, 2009, 6:33 pm
What is the make/model of your primary camera?: Canon EOS-350D/Fuji X100T
Location: Birch Bay near Blaine, WA USA

Re: Replacing Complex Tone/Color Backgrounds

Post by den »

Mike... I am with you... this technique seems to be too exacting and the proposed PWP5 workflow does not seem to provide consistent results unless: (1) there is no movement of background elements or the camera between shots; (2) there are no changes in camera exposure, focus, and aperture between shots; (3) main subject shadows into background elements if present will AbsoluteDifference with low contrasts; (4) main subject reflected colors into background elements if present will AbsoluteDifference with low contrasts; and (5) the in-camera and the post-processing of both shots are identical before the AbsoluteDifference transformation...

My trials today with a couple of working image sets did not yield a generic approach and while I did achieve acceptable results, the solutions were image set specific and not exactly as suggested in the Original Post above...
Dieter Mayr
Posts: 453
Joined: April 24th, 2009, 11:47 am
What is the make/model of your primary camera?: Nikon D700
Location: Salzburg / Austria

Re: Replacing Complex Tone/Color Backgrounds

Post by Dieter Mayr »

I think when one would be able to remove the object for making that shot of the plain background, it should also be possible to place a piece of artificial background like a fabric or cardboard behind the object to separate it from the background and then composite it with every background desired with PWP.
With object that are imobile, like trees and other fixed and/or too heavy / big objects this method is not practical anyway.
Dieter Mayr
couman
Posts: 82
Joined: April 25th, 2009, 8:44 am

Re: Replacing Complex Tone/Color Backgrounds

Post by couman »

A simpler method for making the mask (at least for this image) is:
1. generate the absolute difference image
2. use the high contrast transformation with slider at 99+% to generate the 8-bit mask

Note: This works with older PWP too
Post Reply