Product Photography Background Removal: Magic Wand Tool
by Darian Muresan, Ph.D.
In two earlier articles, entitled Practical Algorithms for Product Photography Background Removal and iPhone Product Photography & Removing Backgrounds, we discussed several approaches, our team at Iconasys has taken to automate product photography background removal in our Shutter Stream and Shutter Stream 360 Product Photography Software. Both software offer three types of product photography background removal algorithms:
- Magic Wand Tool
- Background Removal using a Reference Image
- Chroma Keying (also known as green screen removal)
Click for additional info on all Product Photography Background Removal Tools
This article takes a closer look at the first option, product photography background removal using the magic wand tool on a single or batch set of images.
The Magic Wand Tool takes an input color, determined by the color of the pixel a user selects via color picker tool, and labels as background pixels all the pixels that have similar colors and are, optionally using Contiguous Mode, connected to the clicked pixel. The Magic Wand Tool can efficiently remove backgrounds as long as the following parameters are met:
- There is a clear color contrast between the background and the foreground object
- Shadows are eliminated or minimized
- The background is fairly uniform.
Next, let’s look at how these three requirements can be achieved using Shutter Stream Product Photography Software, an Iconasys 360 Product Photography Turntable, 360 Acrylic Riser and an Iconasys’ Product Photography Lighting Solutions.
Shutter Stream Product Photography Software
A compatible camera (Canon, Sony, Nikon, Android, iOS camera) is connected to the software (Wirelessly or via USB). This will stream the live view from the camera in high resolution to the Live View Window inside Shutter Stream Product Photography Software (as shown in Figure 1). With the camera set to Manual Mode, users have the ability to control three key settings on the camera: (a) aperture, (b) ISO (c) shutter speed. Understanding these three settings is important in order to achieve maximum contrast between the background and the foreground images. Let’s briefly review the three settings.
Aperture in Product Photography
Aperture measures the size of the opening through which light enters into the camera and reaches the imaging sensor. It has a direct effect on the following three variables: (a) the amount of light entering the lens, (b) the depth of field and (c) the amount of light diffractions.
First, aperture size is given by the f/number, which is the ration of the focal length to the diameter of the aperture:
f/number = f / Diameter
The larger the Diameter, the smaller the f/number. Aperture settings on the camera are usually marked f/22, f/16, f/11, f/8, f/5.6, f/4, f/2.8, f/2.0, f/1.4 and f/1.0 (in Shutter Stream we only show the number and not the “f/” part, so one sees 22, 16, … 1.4, 1.0). In the above sequence the aperture diameter changes by square of 2. In the above sequence, the amount of light entering the lens changes by the square of the diameter or by a factor of two each time we go from one f/number to the next. For example, going from f/1.4 to f/2.0 decreases the diameter by square root of 2 and the amount of light decreases by 2.
Second, besides controlling the amount of light entering the lens, the aperture also controls the depth of field, which is defined as the distance from the camera where an object is in focus. Depth of field becomes extremely important when shooting macro photography and/or long objects. An example of the effects of aperture on the depth of field are shown in Figure 2.
The requirement that a lens is in focus when all the parallel rays are focused in one point can be relaxed to say that a lens is in focus when the parallel lines converge within an error δ of the actual focus. This is shown in Figure 2. The distance between the start and end locations, for which error δ is satisfied, is the depth of field (DOF). For the continuous red rays, the DOF is ∆-small and for the dotted red rays, the DOF is ∆-big. Thus, a smaller aperture generates a higher depth of field.
Third, a small aperture size causes more light diffraction, which may decrease pixel resolution, especially for higher end cameras.
Therefore, when setting the aperture, all three conditions: (a) the amount of light, (b) the depth of field and (c) light diffraction should be considered. We recommend that the aperture is set to be as large as possible (i.e. as small as possible f/number) to keep only the object of interest in focus and ideally the background is out of focus. The sweet sport for Aperture – meaning highest quality images (pending camera and lens) is often around 8 – however you may need to increase this number (decrease aperture size) in order to get your product in focus from front to back.
ISO (Film Speed) in Product Photography
The ISO refers to the sensitivity of the imaging sensor. The higher the ISO the more sensitive the sensor is. A good analogy to sensor sensitivity is shown in Figure 3, with the two glasses of water. The glass is the imaging sensor and the water in the glass it the light charge accumulating on the sensor. Each of the two sensors are scaled between empty (or zero) and full (or maximum value). A higher ISO means that less water will fill the glass, while a lower ISO means that it takes more water to fill the glass.
A few things to notice about the ISO and the analogy with different size water glasses.
First, if both glasses are divided into the same number of sub-divisions, then smaller variations in the volume of water will trigger different levels, more quickly. As a result, higher ISOs images are more likely to appear noisier, while at the same time, if biased correctly, they will also provide a higher dynamic range. In some cases, especially in textured objects where it’s difficult to determine noise, a slightly higher ISO may provide an additional level of realism.
Second, since the smaller glass will fill up faster, higher ISOs require less exposure times than lower ISOs. This makes higher ISOs good for situations when there’s low lighting (i.e. night) or fast action (i.e. things need to be captured quickly). However, this is an artifact of higher ISOs and it’s not really leveraged in product photography, unless capturing action, such as a splashing liquid.
Shutter Speed in Product Photography
The last component that controls the quality of our images is the shutter speed. This refers to the amount of time the shutter is opened. For product photography, shutter speed can, in most cases, be set towards the longer side of time. However, the longer the exposure times, the more prone the resulting images are to camera shake and environment vibrations, which can blur the resulting image (however this should not be a problem when using shooting product photography on a tripod)
Acrylic Risers in Product Photography
In Figure 1, our object is pictured on a white background, a common technique in product photography. However, object shadows are clearly visible, making it difficult for the magic wand tool to remove the background (as there is a larger variance in background colors). Using a clear suspended riser (ex. glass or clear acrylic), shadows can be significantly reduced, as shown in Figure 4.
In Figure 4, the shadows of Figure 1 have been replaced by image reflections. In order to minimize reflections, we recommend using an active light back panel, such as an Iconasys LumiPad Light Panel. With the active back panel and the acrylic riser, shadows are completely minimized, as shown in Figure 5.
The final step is to adjust the camera settings in order to separate the background contrast from the objects, as much as possible. Here are our recommended steps:
- Set the aperture to be as large as possible (i.e. choose the smallest f/number) such that the entire object is in focus. This guarantees the largest amount of light and the minimum amount of light diffraction. Further, keeping only the object in focus guarantees that the background is more uniform (i.e. blurred out), which is a goal of our photography technique.
- Adjust the shutter speed and ISO to create the maximum contrast possible. Ideally, try to keep the ISO as small as possible (ex. 100), but for certain objects, increasing the ISO slightly, may add enough dynamic range, where the object may feel more real, even though it may look slightly noisier.
- Apply the magic wand tool, as shown in Figure 6 through Figure 9.
Product Photography Background Removal Conclusion
In conclusion, this article described how to effectively and efficiently shoot and edit a product image with a white background. The entire process should take just seconds using Shutter Stream Product Photography Software.
If you are interested in learning more about product photography and how Iconasys Product Photography Software, Lighting and 360 Photography Turntables can help streamline your processes while enabling you to create high quality product images with white backgrounds, please see: https://www.iconasys.com or contact us to learn more. Iconasys is a leading provider of product photography tools that enable users to create still and 360 product views in house.
About the author: Darian Muresan manages the software and hardware development at Iconasys and is a key contributor to Iconasys’ image processing algorithms. Darian has undergraduate degrees in Electrical Engineering and Mathematics from University of Washington (Seattle, WA.); and a Masters and Ph.D. degree in Electrical and Computer Engineering from Cornell University (Ithaca, NY.).