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.
Computational Photography, an AI-powered Slopendium — 19 Layers, transparency, compositing, and matting
expand to📖 Full book outline1 parts · 4 chapters · 9 sections · 24 figures embedded · 20 placeholders · double-click a figure to enlarge
▸Part 19 LAYERS, TRANSPARENCY, COMPOSITING, AND MATTING⧉
<!--uid: layers-transparency-compositing-and-matting-->
▸19.1 Transparency and compositing⧉
⬜ figure not yet created
`fig-premultiplied-alpha-demo` (**interactive** — filter a transparent cutout two ways: straight RGB (haloed/fringed) vs premultiplied (clean) fig-premultiplied-alpha-demo
fig-ewa-warp-demo
fig-ewa-warp-demo · **interactive** anisotropic resampling / EWA (6.2): a receding checkerboard floor compared under nearest / bilinear / trilinear-MIP / EWA filtering, with a draggable probe whose back-projected footprint ellipse is drawn in texture space — shows why an isotropic filter over- or under-blurs a stretched footprint ✅
fig-segmentation-graphcut
fig-segmentation-graphcut · binary segmentation as a min-cut on a grid graph wired to source/sink terminals; the cut is the object boundary (GrabCut inset) 🟨
fig-blend-twoscale-split
fig-blend-twoscale-split · a source split into low and high bands, the low band blended smoothly and the high band composited winner-take-all, plus a hard-cut / feather / two-scale comparison 🟨
⬜ figure not yet created
GrabCut rectangle → mask)
⬜ figure not yet created
`fig-graphcut-segmentation-demo` (**interactive** — scribble/rectangle graph-cut segmenter with a $\lambda$ smoothness slider and the live min-cut mask) fig-graphcut-segmentation-demo
fig-segmentation-three-framings
fig-segmentation-three-framings · three framings of segmentation — min-cut, normalized-cut, and least-cost path (intelligent scissors) — on the same boundary 🟨
fig-matting-equation
fig-matting-equation · the matting equation — one boundary pixel is $\alpha F + (1-\alpha)B$: a foreground color, a background color, and a soft coverage $\alpha$ 🟨
⬜ figure not yet created
`fig-trimap-to-alpha` (user trimap FG/BG/unknown → recovered continuous $\alpha$ over the unknown band) fig-trimap-to-alpha
fig-chroma-key
fig-chroma-key · **interactive** green/blue-screen matting (8.9, camera-capable): pull an $\alpha$ matte from color distance to the key (green/blue/eyedropped), tune tolerance/softness/spill, composite over a new background; source = built-in green-screen frame, upload, or live webcam ✅
⬜ figure not yet created
`fig-harmonization` (a correct-$\alpha$ cutout pasted raw ("stickered on") vs Poisson-blended vs color/lighting-harmonized → "belongs") fig-harmonization
The previous chapters fixed *one* image — denoise, deblur, recover detail. Now we **combine** images: separate a subject (above all a **person**) from its background and lay it over another. This is the most-used and least-solved editing operation — it drives portrait-mode **fake depth of field**, sky replacement, green-screen VFX, "select subject" — and it is still an **open problem**: even learning and generative methods are not quite there, partly because true mattes are nearly impossible to measure (training leans on **synthetic composites**). The chapter goes **compositing → segmentation → matting**: the forward, easy `over` operator and the alpha channel (the data model of Photoshop's layer stack) first, then the binary cut, then the soft one. The honest twist is that "which pixels are the subject" has no crisp answer at hair, fur, motion blur and glass — so the right object is not a binary mask but a **soft $\alpha$**, governed by one line, $C = \alpha F + (1-\alpha)B$, which is both ill-posed *and* non-linear.
equations
**compositing / matting equation** $C = \alpha F + (1-\alpha)B,\ \alpha\in[0,1]$ — *forward* = composite, *inverse* = matting (under-determined: 3 knowns, 7 unknowns per pixel)
**graph-cut segmentation energy** $E(\mathbf{L}) = \sum_p D_p(L_p) + \lambda \sum_{(p,q)\in\mathcal N} V_{pq}(L_p,L_q)$ with **data term** $D_p$ (color fit FG vs BG) and **edge-aware smoothness** $V_{pq}\propto \exp(-\lVert C_p-C_q\rVert^2/2\sigma^2)$ (an **affinity**, **L4.21**), minimized **exactly** for two labels by min-cut/max-flow (**L6.4**)
**closed-form matting** $\hat\alpha = \arg\min_\alpha \alpha^\top L\,\alpha$ s.t. trimap, where $L$ is the **matting Laplacian** (a pixel-affinity matrix from a local color-line model) — *the same affinity-Laplacian as colorization*
▸19.2 Segmentation⧉
⬜ figure not yet created
`fig-premultiplied-alpha-demo` (**interactive** — filter a transparent cutout two ways: straight RGB (haloed/fringed) vs premultiplied (clean) fig-premultiplied-alpha-demo
fig-ewa-warp-demo
fig-ewa-warp-demo · **interactive** anisotropic resampling / EWA (6.2): a receding checkerboard floor compared under nearest / bilinear / trilinear-MIP / EWA filtering, with a draggable probe whose back-projected footprint ellipse is drawn in texture space — shows why an isotropic filter over- or under-blurs a stretched footprint ✅
fig-segmentation-graphcut
fig-segmentation-graphcut · binary segmentation as a min-cut on a grid graph wired to source/sink terminals; the cut is the object boundary (GrabCut inset) 🟨
fig-blend-twoscale-split
fig-blend-twoscale-split · a source split into low and high bands, the low band blended smoothly and the high band composited winner-take-all, plus a hard-cut / feather / two-scale comparison 🟨
⬜ figure not yet created
GrabCut rectangle → mask)
⬜ figure not yet created
`fig-graphcut-segmentation-demo` (**interactive** — scribble/rectangle graph-cut segmenter with a $\lambda$ smoothness slider and the live min-cut mask) fig-graphcut-segmentation-demo
fig-segmentation-three-framings
fig-segmentation-three-framings · three framings of segmentation — min-cut, normalized-cut, and least-cost path (intelligent scissors) — on the same boundary 🟨
fig-matting-equation
fig-matting-equation · the matting equation — one boundary pixel is $\alpha F + (1-\alpha)B$: a foreground color, a background color, and a soft coverage $\alpha$ 🟨
⬜ figure not yet created
`fig-trimap-to-alpha` (user trimap FG/BG/unknown → recovered continuous $\alpha$ over the unknown band) fig-trimap-to-alpha
fig-chroma-key
fig-chroma-key · **interactive** green/blue-screen matting (8.9, camera-capable): pull an $\alpha$ matte from color distance to the key (green/blue/eyedropped), tune tolerance/softness/spill, composite over a new background; source = built-in green-screen frame, upload, or live webcam ✅
⬜ figure not yet created
`fig-harmonization` (a correct-$\alpha$ cutout pasted raw ("stickered on") vs Poisson-blended vs color/lighting-harmonized → "belongs") fig-harmonization
The previous chapters fixed *one* image — denoise, deblur, recover detail. Now we **combine** images: separate a subject (above all a **person**) from its background and lay it over another. This is the most-used and least-solved editing operation — it drives portrait-mode **fake depth of field**, sky replacement, green-screen VFX, "select subject" — and it is still an **open problem**: even learning and generative methods are not quite there, partly because true mattes are nearly impossible to measure (training leans on **synthetic composites**). The chapter goes **compositing → segmentation → matting**: the forward, easy `over` operator and the alpha channel (the data model of Photoshop's layer stack) first, then the binary cut, then the soft one. The honest twist is that "which pixels are the subject" has no crisp answer at hair, fur, motion blur and glass — so the right object is not a binary mask but a **soft $\alpha$**, governed by one line, $C = \alpha F + (1-\alpha)B$, which is both ill-posed *and* non-linear.
equations
**compositing / matting equation** $C = \alpha F + (1-\alpha)B,\ \alpha\in[0,1]$ — *forward* = composite, *inverse* = matting (under-determined: 3 knowns, 7 unknowns per pixel)
**graph-cut segmentation energy** $E(\mathbf{L}) = \sum_p D_p(L_p) + \lambda \sum_{(p,q)\in\mathcal N} V_{pq}(L_p,L_q)$ with **data term** $D_p$ (color fit FG vs BG) and **edge-aware smoothness** $V_{pq}\propto \exp(-\lVert C_p-C_q\rVert^2/2\sigma^2)$ (an **affinity**, **L4.21**), minimized **exactly** for two labels by min-cut/max-flow (**L6.4**)
**closed-form matting** $\hat\alpha = \arg\min_\alpha \alpha^\top L\,\alpha$ s.t. trimap, where $L$ is the **matting Laplacian** (a pixel-affinity matrix from a local color-line model) — *the same affinity-Laplacian as colorization*
▸19.3 Blue and green screen matting, chroma key⧉
⬜ figure not yet created
`fig-premultiplied-alpha-demo` (**interactive** — filter a transparent cutout two ways: straight RGB (haloed/fringed) vs premultiplied (clean) fig-premultiplied-alpha-demo
fig-ewa-warp-demo
fig-ewa-warp-demo · **interactive** anisotropic resampling / EWA (6.2): a receding checkerboard floor compared under nearest / bilinear / trilinear-MIP / EWA filtering, with a draggable probe whose back-projected footprint ellipse is drawn in texture space — shows why an isotropic filter over- or under-blurs a stretched footprint ✅
fig-segmentation-graphcut
fig-segmentation-graphcut · binary segmentation as a min-cut on a grid graph wired to source/sink terminals; the cut is the object boundary (GrabCut inset) 🟨
fig-blend-twoscale-split
fig-blend-twoscale-split · a source split into low and high bands, the low band blended smoothly and the high band composited winner-take-all, plus a hard-cut / feather / two-scale comparison 🟨
⬜ figure not yet created
GrabCut rectangle → mask)
⬜ figure not yet created
`fig-graphcut-segmentation-demo` (**interactive** — scribble/rectangle graph-cut segmenter with a $\lambda$ smoothness slider and the live min-cut mask) fig-graphcut-segmentation-demo
fig-segmentation-three-framings
fig-segmentation-three-framings · three framings of segmentation — min-cut, normalized-cut, and least-cost path (intelligent scissors) — on the same boundary 🟨
fig-matting-equation
fig-matting-equation · the matting equation — one boundary pixel is $\alpha F + (1-\alpha)B$: a foreground color, a background color, and a soft coverage $\alpha$ 🟨
⬜ figure not yet created
`fig-trimap-to-alpha` (user trimap FG/BG/unknown → recovered continuous $\alpha$ over the unknown band) fig-trimap-to-alpha
fig-chroma-key
fig-chroma-key · **interactive** green/blue-screen matting (8.9, camera-capable): pull an $\alpha$ matte from color distance to the key (green/blue/eyedropped), tune tolerance/softness/spill, composite over a new background; source = built-in green-screen frame, upload, or live webcam ✅
⬜ figure not yet created
`fig-harmonization` (a correct-$\alpha$ cutout pasted raw ("stickered on") vs Poisson-blended vs color/lighting-harmonized → "belongs") fig-harmonization
The previous chapters fixed *one* image — denoise, deblur, recover detail. Now we **combine** images: separate a subject (above all a **person**) from its background and lay it over another. This is the most-used and least-solved editing operation — it drives portrait-mode **fake depth of field**, sky replacement, green-screen VFX, "select subject" — and it is still an **open problem**: even learning and generative methods are not quite there, partly because true mattes are nearly impossible to measure (training leans on **synthetic composites**). The chapter goes **compositing → segmentation → matting**: the forward, easy `over` operator and the alpha channel (the data model of Photoshop's layer stack) first, then the binary cut, then the soft one. The honest twist is that "which pixels are the subject" has no crisp answer at hair, fur, motion blur and glass — so the right object is not a binary mask but a **soft $\alpha$**, governed by one line, $C = \alpha F + (1-\alpha)B$, which is both ill-posed *and* non-linear.
equations
**compositing / matting equation** $C = \alpha F + (1-\alpha)B,\ \alpha\in[0,1]$ — *forward* = composite, *inverse* = matting (under-determined: 3 knowns, 7 unknowns per pixel)
**graph-cut segmentation energy** $E(\mathbf{L}) = \sum_p D_p(L_p) + \lambda \sum_{(p,q)\in\mathcal N} V_{pq}(L_p,L_q)$ with **data term** $D_p$ (color fit FG vs BG) and **edge-aware smoothness** $V_{pq}\propto \exp(-\lVert C_p-C_q\rVert^2/2\sigma^2)$ (an **affinity**, **L4.21**), minimized **exactly** for two labels by min-cut/max-flow (**L6.4**)
**closed-form matting** $\hat\alpha = \arg\min_\alpha \alpha^\top L\,\alpha$ s.t. trimap, where $L$ is the **matting Laplacian** (a pixel-affinity matrix from a local color-line model) — *the same affinity-Laplacian as colorization*
▸19.4 Matting⧉
⬜ figure not yet created
`fig-premultiplied-alpha-demo` (**interactive** — filter a transparent cutout two ways: straight RGB (haloed/fringed) vs premultiplied (clean) fig-premultiplied-alpha-demo
fig-ewa-warp-demo
fig-ewa-warp-demo · **interactive** anisotropic resampling / EWA (6.2): a receding checkerboard floor compared under nearest / bilinear / trilinear-MIP / EWA filtering, with a draggable probe whose back-projected footprint ellipse is drawn in texture space — shows why an isotropic filter over- or under-blurs a stretched footprint ✅
fig-segmentation-graphcut
fig-segmentation-graphcut · binary segmentation as a min-cut on a grid graph wired to source/sink terminals; the cut is the object boundary (GrabCut inset) 🟨
fig-blend-twoscale-split
fig-blend-twoscale-split · a source split into low and high bands, the low band blended smoothly and the high band composited winner-take-all, plus a hard-cut / feather / two-scale comparison 🟨
⬜ figure not yet created
GrabCut rectangle → mask)
⬜ figure not yet created
`fig-graphcut-segmentation-demo` (**interactive** — scribble/rectangle graph-cut segmenter with a $\lambda$ smoothness slider and the live min-cut mask) fig-graphcut-segmentation-demo
fig-segmentation-three-framings
fig-segmentation-three-framings · three framings of segmentation — min-cut, normalized-cut, and least-cost path (intelligent scissors) — on the same boundary 🟨
fig-matting-equation
fig-matting-equation · the matting equation — one boundary pixel is $\alpha F + (1-\alpha)B$: a foreground color, a background color, and a soft coverage $\alpha$ 🟨
⬜ figure not yet created
`fig-trimap-to-alpha` (user trimap FG/BG/unknown → recovered continuous $\alpha$ over the unknown band) fig-trimap-to-alpha
fig-chroma-key
fig-chroma-key · **interactive** green/blue-screen matting (8.9, camera-capable): pull an $\alpha$ matte from color distance to the key (green/blue/eyedropped), tune tolerance/softness/spill, composite over a new background; source = built-in green-screen frame, upload, or live webcam ✅
⬜ figure not yet created
`fig-harmonization` (a correct-$\alpha$ cutout pasted raw ("stickered on") vs Poisson-blended vs color/lighting-harmonized → "belongs") fig-harmonization
The previous chapters fixed *one* image — denoise, deblur, recover detail. Now we **combine** images: separate a subject (above all a **person**) from its background and lay it over another. This is the most-used and least-solved editing operation — it drives portrait-mode **fake depth of field**, sky replacement, green-screen VFX, "select subject" — and it is still an **open problem**: even learning and generative methods are not quite there, partly because true mattes are nearly impossible to measure (training leans on **synthetic composites**). The chapter goes **compositing → segmentation → matting**: the forward, easy `over` operator and the alpha channel (the data model of Photoshop's layer stack) first, then the binary cut, then the soft one. The honest twist is that "which pixels are the subject" has no crisp answer at hair, fur, motion blur and glass — so the right object is not a binary mask but a **soft $\alpha$**, governed by one line, $C = \alpha F + (1-\alpha)B$, which is both ill-posed *and* non-linear.
equations
**compositing / matting equation** $C = \alpha F + (1-\alpha)B,\ \alpha\in[0,1]$ — *forward* = composite, *inverse* = matting (under-determined: 3 knowns, 7 unknowns per pixel)
**graph-cut segmentation energy** $E(\mathbf{L}) = \sum_p D_p(L_p) + \lambda \sum_{(p,q)\in\mathcal N} V_{pq}(L_p,L_q)$ with **data term** $D_p$ (color fit FG vs BG) and **edge-aware smoothness** $V_{pq}\propto \exp(-\lVert C_p-C_q\rVert^2/2\sigma^2)$ (an **affinity**, **L4.21**), minimized **exactly** for two labels by min-cut/max-flow (**L6.4**)
**closed-form matting** $\hat\alpha = \arg\min_\alpha \alpha^\top L\,\alpha$ s.t. trimap, where $L$ is the **matting Laplacian** (a pixel-affinity matrix from a local color-line model) — *the same affinity-Laplacian as colorization*