← all projects
Computer Vision · September 2024 · 2 min read

Filters & Frequencies — Edges, Hybrid Images, and Blending

Working in the frequency domain to extract edges, create hybrid images that change meaning with viewing distance, and blend images seamlessly via Laplacian pyramids. Ends with the famous 'oraple.'

PythonNumPySciPyComputer Vision

Most of classical image processing is frequency analysis in disguise. Edge detection is a high-pass filter. Sharpening is the same operation with the original added back. Hybrid images combine one picture’s high frequencies with another’s low frequencies — your brain picks which one to see based on viewing distance. Seamless image blending splits images into frequency bands, blends each band with an appropriately-sized mask, then reconstructs.

edge detectionFinite difference + Gaussian-smoothed derivatives (DoG) sharpeningUnsharp mask: I + α(I − G*I) hybrid imagesLow-freq(A) + High-freq(B) → dual-interpretation blendingLaplacian pyramid with Gaussian-blurred mask

Edge Detection

Partial derivatives encode edge orientation; their magnitude encodes edge strength. Gaussian smoothing before differentiation (Derivative-of-Gaussian filters) dramatically reduces noise — a first-order derivative applied to noisy pixels just produces more noise.

Unsharp Masking

Sharpening is artificial, but in a controlled way. The blurred version of an image contains only low frequencies; subtracting it from the original isolates high frequencies. Adding those high frequencies back, scaled by α, amplifies edges without changing overall tonality. Applied here to a Taj Mahal photograph and an Inception film frame.

Hybrid Images

Look closely: flowers and a ladybug. Step back: just a ladybug. Get closer to your screen: just a flower. Hybrid images exploit the fact that low-frequency content dominates perception at distance, while high-frequency content dominates up close. Each image here combines high-frequency components of one photo with low-frequency components of another.

Multiresolution Blending

The “oraple” — half orange, half apple — is the classic demo. Naive cut-and-paste produces a hard visible seam. Laplacian pyramid blending splits each image into frequency bands, applies a mask of appropriate softness to each band (hard cut for high frequencies, soft blur for low), then sums the result. The transition becomes invisible because high-frequency mismatches are localized while low-frequency color differences are gradually interpolated.

#image-filters#frequency-domain#hybrid-images#pyramid-blending

Related projects