6
\$\begingroup\$

I plan to shoot an object (a banana peel to be precise) and then replace the background with another image¹. What would be the most effective approach given the following conditions:

  • Canon 550D
  • Sigma 18-55mm f/2.8-4.5
  • Maximum camera to subject distance: 1.5m
  • Distance from object to wall: around 0.5m
  • No flash, but continuous household lighting²
  • I have a black cardboard backdrop of 1x0.6m. It's not a requirement to use it.
  • The background should be able to be replaced automatically. There will be a lot of photos (it will be a stop-motion), so I can't manually mask every single one.

Footnotes:
(1): The full story for those interested, (I think) this is not relevant to the question: I want to make a stop-motion featuring a banana peel as a person. I can place the peel in different positions and hold it with transparent thin fishing lines. However, I would also like to animate the background. Doing this simultaneously with the banana animation is tedious. My plan is to do a stop-motion of the background separately and then replace the banana background through some keying process.

(2): I do have an off-camera flash, but no way of syncing it. If I hook it up to my DSLR it would probably fry it as it is an old 300V flash. Household lights range from 10 to 150W.

\$\endgroup\$

6 Answers 6

7
\$\begingroup\$

Here are all the ways I know of for removing the background (in order of my preference):

  1. White Background

    This is done by using a white-ish background and lighting the background about 3 stops brighter than the subjects (exact lighting depending on your camera).

    There's no way you can do this with household lights but a flash aimed at the wall behind the subject does this easily, you can do it by shooting your subject with a very slow shutter speed and using your flash's test button or you can get a $40 flash from ebay (plus about $10 for adapters and cables to sync it off-camera).

    Note: you will want to get the subject as far from the background as possible to minimize light bouncing from the background hitting the subject.

  2. Chroma-key

    Use a solid color background (most commonly green), make sure the background is lighted evenly and that there are no shadows falling on the background.

    You can sort of do it with household lights but here it is even more important to not have light from the background hitting the subject (because it will cause a green color cast) so you will need some distance between the background and subject.

  3. Black background

    This is done by simply placing the lights very close to the subject and letting the light falloff turn the background black, the more powerful the light the easier it is to get a black background.

    Here distance to background is also important but you can manage without it if the light is powerful and very close (but a powerful light very close will create very dramatic hard light - so if you want even soft lighting this is not for you).

  4. Masking in software

    If you just carefully paint the mark for each photo you don't care what the original background is - and you don't need any special lights, however, this is obviously very tedious.

    You can make an almost-white or almost-black background, use automatic selection and then just refine the mask to save some time.

Whatever you do all of those will confuse the camera's auto mode, don't forget to meter for the subject and use manual mode and manual white balance - and to take test shots and watch them on the computer before starting with the stop motion animation.

\$\endgroup\$
2
\$\begingroup\$

When you extract the banana from your original background, you'll tend to include some background pixels. If the background is white you'll have white pixels. If you then place that on a light background, those white pixels won't show much, but against a darker background, they will stand out.

So as you're shooting the banana, if you can try to use a plain background that is similar in brightness and colour as the final background you'll be using, you will save yourself having to spend a lot of time refining the extraction. You can do a fairly rough extraction and the pixels will blend in with the animated background.

In other words you can use a contrasting background (white, black, green) to make the masking easier, but unless your masking is really good, those contrasting pixels will work against you unless you plan ahead and match them with the final background you'll be using.

\$\endgroup\$
1
  • \$\begingroup\$ The defringe command works wonders, if the resolution is high so the blended pixels at the edge are microscopic in the picture. \$\endgroup\$
    – JDługosz
    Jan 15, 2015 at 5:50
1
\$\begingroup\$

Any constant shade background that is high contrast (and doesn't use the same color) as your object will work for trying to do an automatic removal. The best quality is often still accomplished by manually extracting the object with matte or selection painting in post.

\$\endgroup\$
1
\$\begingroup\$

Another possibility is to take advantage of the "select in focus" geature now in Photoshop! I've not tried it yet but I think a fuzzy blob patches of color will look like it's way out of focus even though its still in your depth of field.

As for masking, if fringes would be a problem, or tinted reflected light from the background is a problem even when fringes are not: make two shots. One against a solid contrast or camo and use that to make the mask. Hold a yellow background behind the banana and take another shot. Apply the mask from the first to the image of the second.

I love food; it doesn't move. To set up a system for my wife to use, I went flashless. With continuous lighting she can see how it looks easily, while arranging things. Also like you, the primitive p&s camera could not talk to studio strobes anyway. The key is to use a cable release so the exposure can be as long as needed for the lamplight and/or window light.

\$\endgroup\$
0
\$\begingroup\$

You have an overly constrained problem space. The easy way to do this is to have a couple of off-camera flashes, strobes, etc. and use a white wall or piece of white seamless.

Alternatively, you could use a green-screen (paint, wall, screen), which is what all the video folks do.

See if you can borrow or rent a couple of flashes.

\$\endgroup\$
4
  • \$\begingroup\$ Thank you for your contribution. I can see why the white wall would make replacing the background easier, but I don't understand where I need the flashes for. How do they help me with my problem? \$\endgroup\$ May 26, 2013 at 22:43
  • 2
    \$\begingroup\$ @BartArondson - Household lights pulse with 50 Hz AC current. It looks to us humans like a steady flow of light, but to your camera it is dim-bright-dim-bright-dim... 50 times a second. \$\endgroup\$ May 26, 2013 at 23:04
  • \$\begingroup\$ You don't specifically need flashes, but you need to control the light on both your subject and the background. Any lighting setup that lets you do this will be fine. I suggested flashes because even the cheapest ones have variable power output, and because they are easy to rent. \$\endgroup\$ May 27, 2013 at 1:37
  • 1
    \$\begingroup\$ @esa, only some lights pulse. Incandescent lights, carbon arc, and some others use the AC mains power to heat something, and it can't cool down enough during the off cycle to matter. Florescent, LED and other lights do flicker and it can have major impact. \$\endgroup\$ May 27, 2013 at 1:39
0
\$\begingroup\$

I use the following method. I make sure the background is different in brightness and color from the object. I take pictures at the lowest ISO of 100 with the object and background using a tripod, I expose to the right and take multiple pictures (say, five). I use image stacking to average out the noise. Then I do the same with the object removed, but here I take the exposure time the same as in the pictures with the object present. Then I use the two pictures of the object plus background (A) and only the background (B) to create a mask as follows. I transform A and B to linear color space, let's call the resulting pictures A' and B'.

I then normalize B', so that A' and B' are identical in the background region. Since they were almost identically exposed, the correction factor should be close to 1. Then, working in 32 bit floating point, I subtract B' from A', and I then set the gray values of pixels equal to 0 if they are within some tolerance of zero (what value you should choose depends on the noise that you can measure after you have done the subtraction). What you then have is a picture with the background equal to zero and the object has pixels with gray values that are almost never zero (this is why you need to take the brightness of the background totally different from the object).

The next step is to set the gray values that are not equal to zero equal to 1. Then you have a mask which we can call M. You can then multiply the original picture A with M, this makes the background dark. To make the background gray you with some gray value Y, you can add to this Y*(1-M).

This will work quite well except possibly at the edges. Here you may see discoloring due to the edge pixels that belong the object but which have recorded the light from both the object and the original background. When the background was changed, the gray values of these pixels should have been modified. In case of a banana, this won't be a big deal, it's more of a problem when you have objects like faces of people, the hair at the edges will discolor due to this effect.

The only robust way to solve this problem is to take pictures of the object with two or more different backgrounds. This allows you to account for the effect of the background in the edge pixels and then replace that contribution by what it would be had the background been uniform with gray value Y. You can e.g. shine an extra light at the background only so that the object won't be affected by that except that the edge.

\$\endgroup\$
2
  • \$\begingroup\$ hmm, it's not really clear to me how I would achieve all that. Do you do this programmatically (Python, Matlab)? In Photoshop? \$\endgroup\$ Jul 1, 2015 at 5:10
  • \$\begingroup\$ @BartArondson I use ImageJ for adding/subracting/multiplying/ measuring images. I use ImageMagick for conversions e.g. to convert to linear colorspace. I use the align_image_stack program to align images, this is an executable that is part of the Hugin program. When taking multiple pictures to average out the noise, you need to align them first, even when using a tripod. All these programs are free of charge. I'll update the answer to explain exactly how to use these programs later. \$\endgroup\$ Jul 2, 2015 at 3:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.