BookNotesSlidesP-sets Syllabusdraft · v0.2.49.1
◀▲⌂▶
💬Comments welcome. To leave a note, select any text and click the note / highlight button that pops up — or open the panel with the tab at the top-right (‹). Notes are visible only inside our private review group.

35.1 Flash photography⧉

A flash is the simplest piece of computational illumination there is: a single, brief, known burst of light fired in sync with the shutter. For a century it was used in the obvious way, to add light when the scene was too dark, and it earned a deserved reputation for ugliness. An on-camera flash points straight down the lens axis, so it flattens every shape it touches, blows out near objects, leaves far ones black, throws a hard shadow onto the wall behind, and turns the back of the eye red. The computational-photography move is to stop thinking of the flash as the light and start thinking of it as a second condition. You now have two images of the same scene under different, controlled illuminations: a warm, atmospheric, but dark and noisy ambient frame, and a bright, sharp, but harsh flash frame. The interesting question is no longer "which one is better" but "how do I fuse them so the result keeps the ambient mood and the flash's clean detail at once." That reframing, plus the physics of where flash light goes (down the axis, falling off as $1/d^2$), organizes the chapter.

35.1.1 Flash / no flash⧉

Take two photographs of the same scene back to back: one with the flash off, one with it on. The no-flash image records the ambient lighting, such as the warm tungsten glow of a restaurant or the blue cast of dusk, but because the ambient light is dim, the camera had to choose between a long exposure (motion blur) and a shorter exposure with higher gain (fewer photons and more visible noise), so the no-flash frame is typically dark, noisy, and soft. A flash can provide a sharper, higher-SNR guide, because the flash dumped a lot of clean light in a millisecond, but it has lost the ambient mood: the warm restaurant now looks flat and harshly lit, colors are wrong, and a harsh shadow has appeared. Neither image is the one you want. The one you want has the no-flash ambience and color and the flash detail and low noise.

Petschnigg et al. (2004) and, in parallel, Eisemann and Durand (2004) showed how to get it, and the key tool is the cross-bilateral (or joint bilateral) filter from Chapter 10.1, Bilateral filtering. A bilateral filter smooths an image while preserving its edges by weighting neighbors by both spatial and range (color) distance; the cross-bilateral variant computes those range weights from a second, guide image rather than from the image being filtered. This works for a simple reason: you want to denoise the noisy no-flash image without blurring its edges, but the no-flash image is too noisy to find its own edges reliably. The flash image, however, has the same scene's edges rendered cleanly. So you filter the no-flash color using the flash image as the edge guide, with a joint bilateral filter, and the flash's sharp edges stop the smoothing from crossing real boundaries while the ambient color and tone are preserved. Detail that survives only in the flash frame can then be transferred onto the denoised ambient image as a detail layer (a ratio of the flash image to its own bilateral-smoothed version), so fine texture comes from the flash while large-scale color and lighting come from the ambient (Figure 35.1.2, referenced).

Eisemann and Durand's framing makes the decoupling explicit: they separate each image into a large-scale layer (overall color and lighting "mood") and a detail layer, take the mood from the no-flash image and the detail from the flash image, and recombine them. The result is an intrinsic relighting of the scene that keeps the ambient atmosphere while borrowing the flash's clarity. Both papers also handle the flash's two signature artifacts: the harsh cast shadow (detected from a weak added-flash response after exposure normalization, then handled using ambient information) and specular highlights the flash strikes off glossy surfaces.

Figure 35.1.1 runs Eisemann and Durand's pipeline in the page on their own photographs.

fig-flash-no-flash
Figure 35.1.1, stage 3. Intrinsic relighting computed on the paper's own photographs Eisemann & Durand 2004. Top: the no-flash frame (shown brightened), the flash frame and the result. Bottom: the three layers the result is built from. Each image is split into intensity and color; the intensity is a weighted sum of R, G and B whose weights are the flash's own channels, so a saturated red does not come out too bright. A bilateral filter of $\log_{10}$ intensity ($\sigma_s$ 1.5% of the diagonal, $\sigma_r = 0.4$) gives the large scale, and the detail is what remains. The result takes the large scale of the no-flash frame, which carries the room's light, and the detail and color of the flash, then puts back a fraction $t$ of the ambient white balance (0.2 in the paper). On the cake the no-flash frame is too dark and blocky to find its own edges: "cross bilateral" computes its large scale with range weights from the flash, as the paper does for its Figure 1. "The paper's result" puts the published image in place of ours. Click a picture to zoom.
fig-flash-relighting-1
Figure 35.1.2. (Reproduced with permission, Eisemann & Durand 2004.) The no-flash/flash pair and the fused result. The dark, noisy no-flash frame (left) keeps the scene's warm ambient mood; the flash frame (middle) is sharp and clean but harshly lit and wrongly colored; the fused output (right) carries the ambient color and atmosphere of the first with the low noise and fine detail of the second. The fusion denoises the ambient image using the flash image as a cross-bilateral edge guide and transfers the flash's detail layer onto the ambient color.
fig-flash-relighting-2
Figure 35.1.3. (Reproduced with permission, Eisemann & Durand 2004.) Decoupling mood from detail. Each frame is split into a large-scale layer (overall color and lighting) and a detail layer; the result takes the ambient large-scale layer (preserving the warm, directional "mood" the photographer saw) and the flash detail layer, so texture and sharpness come from the burst while the look comes from the room.
fig-flash-relighting-3
Figure 35.1.4. (Reproduced with permission, Eisemann & Durand 2004.) Detail transfer plus flash-shadow handling. The flash's fine detail is transferred onto the ambient color image, and the hard shadow the flash casts is detected (dark under flash, not under ambient) and corrected from the no-flash frame, so the fused image gains clarity without inheriting the flash's harsh shadow.

The last stage of Figure 35.1.1 runs the shadow treatment step by step.

fig-flash-no-flash
Figure 35.1.1, stage 4. Flash shadows, on the same photographs. The difference $\Delta I$ between the flash and no-flash frames is small wherever the flash did not reach. The umbra is where $\Delta I$ falls below the first minimum of its histogram (inset); the penumbra is where the flash's gradient is stronger than the no-flash's, next to umbra pixels. Inside the mask the result takes its color from flash pixels outside the shadow whose no-flash color is similar, and its detail from the no-flash frame, scaled to the flash's level of detail. Compare the wall to the right of the head before and after. Black objects are detected too (the jacket, the pupil), and copying colors leaves them black. $\Delta I$ is taken here on the cameras' encoded values, where the paper's coarse cutoff of 0.2 makes sense; on linear values the first minimum only separates the black jacket. With the cross bilateral the paper corrects no shadow, since the flash's shadow edges enter the filter.

The modern learned successors to these hand-built fusion rules need data, specifically many real flash/ambient pairs, and that is what Aksoy et al. crowdsourced in their FAID dataset Aksoy et al. 2018 (FAID flash/ambient dataset): thousands of flash / no-flash image pairs captured in the wild by hundreds of people, now a standard training and benchmark set for learned flash photography (denoising, illumination decomposition, relighting). It is cataloged with the book's other corpora in Chapter 45.16, Datasets.

35.1.2 Ramesh's multiflash⧉

Raskar, Tan, Feris, Yu and Turk (2004) turned the flash's worst habit, casting hard shadows, into a feature, and used it to find a scene's geometry rather than its color. Their multi-flash camera mounts four small flashes around the lens, at left, right, top, and bottom, and fires them one at a time, capturing one image per flash. Because each flash sits a few centimeters off the lens axis, it casts a thin shadow just past every depth discontinuity, the silhouette where a near object occludes a farther surface. The geometric key: the shadow always falls on the side of the silhouette opposite the flash. The left flash throws a shadow sliver to the right of an object's edge; the top flash throws one below; and so on (Figure 35.1.5).

That gives a simple detector for depth edges. At a true depth discontinuity, some flash will cast a shadow there, whichever one is on the occluding side, so a pixel that goes dark in at least one of the four flash images, in the characteristic shadow-opposite-the-flash pattern, sits on a silhouette. Texture and material edges often retain similar structure under these nearby flash directions (they are not occlusions, they cast no parallax shadow), so the method rejects them. Combining the four images, for example by taking the ratio of each flash image to the per-pixel maximum and then tracing where the shadows begin, yields an estimate of depth edges, with failures from specularities, weak signals, overlapping shadows, and motion, the occluding contours of the scene, with the intensity and texture edges filtered out. They called the device a non-photorealistic (NPR) camera, because once you have the scene's silhouettes you can render it in stylized, line-drawing-like ways: outline the objects, abstract away texture, or composite the depth edges back over a de-emphasized interior. By offsetting a known light and reading the shadows, a flat camera recovers a piece of 3-D structure that no single image contains.

fig-multiflash-depth-edges
Figure 35.1.5. Multi-flash depth-edge detection. Four small flashes ring the lens (left, right, top, bottom) and fire one at a time. Because each is offset from the optical axis, it casts a thin shadow on the far side of every depth discontinuity, always on the side opposite that flash (the left flash shadows the right of an object, the top flash shadows below it, and so on). A depth edge therefore appears shadowed in at least one of the four images, while texture and material edges, which cast no parallax shadow, look the same under every flash and are rejected. Taking the per-pixel ratio to the maximum and locating where shadows begin yields a clean depth-edge (silhouette) map, the basis of the non-photorealistic camera.

35.1.3 Removing flash artifacts⧉

Even when you only want the flash image, it arrives with artifacts that the pair of images lets you remove. Agrawal, Raskar, Nayar and Li (2005) gave a general gradient-domain treatment. The observation is that a flash and an ambient image of the same scene share the same true scene structure but differ in the artifacts each introduces: the flash adds specular highlights and hot spots off glossy surfaces and reflections in windows, while the ambient adds noise; and an artifact gradient in one image is typically not aligned with the corresponding scene gradient in the other. They use gradient coherence to identify artifacts and project gradients from the contaminated image onto the direction supplied by the cleaner guide. For self-reflection removal, the ambient gradients are projected onto the flash gradients; flash-highlight removal uses the ambient structure to constrain the repair. They then reintegrate (a Poisson solve, as in Chapter 10.8, Poisson image editing) to reduce the targeted artifacts. The same machinery removes reflections off glass (shoot through a window with and without flash; the flash reflection is a gradient present in one image but not the scene) and the flash's own hot spots.

This is a recurring pattern: two aligned images under different illumination can distinguish some lighting-dependent artifacts from shared scene structure. Genuine shading changes, motion, and misregistration also create inconsistent gradients, so inconsistency alone is not proof of an artifact. Noise is inconsistent (random), specular highlights are inconsistent (they move with the light), reflections are inconsistent (they depend on the illumination geometry), and the scene, the thing you want, is the consistent part. Flash/no-flash denoising, multi-flash depth edges, and flash de-reflection are three faces of that single idea.

35.1.4 Dark flash and covert infrared photography⧉

The flash/no-flash story has one stubborn flaw: the flash is blinding and disruptive. It dazzles the subject, ruins the candid moment, and is forbidden in museums, theatres, and wildlife photography. Krishnan and Fergus (2009) proposed a simple fix: move most of the flash energy outside the visible band. A silicon camera sensor is sensitive well beyond the visible spectrum, into the near-ultraviolet and the near-infrared, bands the human eye cannot see at all. So build a dark flash that emits in those out-of-band wavelengths (just below 400 nm and just above 700 nm): it floods the scene with light the camera records brightly with much less visible brightness, reducing dazzle and it remains usable in a "dark" room (Figure 35.1.6).

The dark-flash image is, like an ordinary flash image, sharp and low-noise, but it is recorded in the wrong wavelengths, so its colors are meaningless (skin, foliage, and fabrics reflect UV and IR quite differently from how they reflect visible light). It plays exactly the role the flash image played in flash/no-flash fusion: a clean detail and edge guide for denoising the noisy, dim, but correctly-colored visible ambient image. Krishnan and Fergus fuse the two with a cross-channel scheme. They borrow high-frequency detail and edge structure from the dark-flash image, keep low-frequency color from the visible ambient image, and exploit statistical relationships between the bands to suppress the places where UV/IR reflectance diverges from visible. The result is a flash-quality photograph taken with a much less visible flash. Spectral mismatch remains a reconstruction limitation, and low visibility does not by itself make a source suitable for every subject or venue.

fig-darkflash-spectrum
Figure 35.1.6. Dark flash: lighting the scene outside the visible band. Along the wavelength axis, the human eye's sensitivity is confined to roughly 400–700 nm, while a silicon camera sensor responds well into the near-ultraviolet and near-infrared. A "dark flash" emits in those out-of-band regions (just below 400 nm and just above 700 nm): it is bright to the sensor and invisible to the subject, so there is no dazzle or disruption and it remains usable in a dark room. The dark-flash frame supplies clean, low-noise detail and edges (its colors, recorded in UV/IR, are not meaningful), which are fused with the dim but correctly-colored visible ambient image, just as in flash/no-flash. The same physics underlies older covert infrared night photography.
fig-dark-flash-1
Figure 35.1.7. The dark flash in action on faces: for each subject, the dim, noisy but correctly-colored visible ambient frame, the sharp low-noise dark-flash frame (recorded in UV/IR, so its colors are meaningless), and the fused result borrows detail and edges from the invisible flash while keeping ambient color. Eye close-ups show that the subject never perceived the burst Krishnan & Fergus 2009 (Dark Flash).