Hybrid Images

A hybrid image is a single picture that shows one scene from far away and a different scene up close. The method is due to Oliva, Torralba and Schyns (SIGGRAPH 2006). A hybrid is the sum of a low-pass filtered image and a high-pass filtered image :

Here is a 2D Gaussian with standard deviation pixels, and is the unit impulse. The lecture calls the high-pass kernel a Laplacian filter. Up close, the high frequencies of dominate perception. From far away the eye cannot resolve them, and only the low frequencies of remain visible.

By linearity of the Fourier transform, the hybrid’s spectrum is . At a frequency of cycles per pixel, a Gaussian’s gain is . A convenient cutoff is the frequency where this gain equals :

The low-pass keeps below its cutoff, and the high-pass keeps above its own cutoff. For a clean split the low-pass cutoff should lie at or below the high-pass cutoff, which means . Both values are tuned by experiment. The two images must be aligned first, with matching scale, rotation and position of key features such as the eyes. Project 2 checks a result by showing the log-magnitude Fourier transforms of both inputs, both filtered images and the hybrid. Project 3 builds hybrids with a flow model instead of fixed filters, as described in 8.6. Flow-Based Image Editing.

Intuition

Up close, the eye resolves fine detail, and perception follows the detail when it is available. Far away, the same detail covers a tiny angle and falls below what the eye can resolve, so only coarse shapes remain. A hybrid image stores coarse shapes from one picture and fine detail from another in the same pixels. The “hybrid” is one image with two readings, one for each range of frequencies. In the lecture’s example from the paper, a viewer near the print sees a woman’s face, and a viewer across the room sees an angry man. The lecture also shows a blurred elephant combined with the sharp outline and spots of a leopard. Dalí used the same effect by hand in his 1976 painting that becomes a portrait of Lincoln at 30 meters.

The construction uses only the blur and detail images from sharpening. A Gaussian blur gives the low-pass part. The image minus its blur gives the high-pass part. The diagram shows the pipeline.

\usepackage{tikz}
\begin{document}
\definecolor{low}{HTML}{2F80ED}
\definecolor{high}{HTML}{D9483B}
\definecolor{mid}{HTML}{8A8A8A}
\begin{tikzpicture}[>=latex,font=\small,
  img/.style={draw,thick,minimum width=1.7cm,minimum height=1.1cm,align=center},
  op/.style={draw,rounded corners,minimum width=2.2cm,minimum height=0.8cm,align=center}]
\node[img,low] (I1) at (0,1.4) {$I_1$\\ \footnotesize far percept};
\node[img,high] (I2) at (0,-1.4) {$I_2$\\ \footnotesize near percept};
\node[op,low] (G1) at (3.4,1.4) {$* \, G_{\sigma_1}$\\ \footnotesize low-pass};
\node[op,high] (G2) at (3.4,-1.4) {$* \, (e - G_{\sigma_2})$\\ \footnotesize high-pass};
\node[img,low] (L) at (6.6,1.4) {$I_1 * G_{\sigma_1}$};
\node[img,high] (Hh) at (6.6,-1.4) {$I_2 - I_2 * G_{\sigma_2}$};
\node[draw,circle,thick,mid] (S) at (8.9,0) {$+$};
\node[img,mid] (H) at (10.6,0) {hybrid $H$};
\draw[->,thick,low] (I1) -- (G1); \draw[->,thick,low] (G1) -- (L); \draw[->,thick,low] (L) -- (S);
\draw[->,thick,high] (I2) -- (G2); \draw[->,thick,high] (G2) -- (Hh); \draw[->,thick,high] (Hh) -- (S);
\draw[->,thick,mid] (S) -- (H);
\end{tikzpicture}
\end{document}

Properties

(Cutoff Gap) The two cutoffs decide whether the images separate cleanly, compete, or both fade.

The diagram plots both gains for and . The low-pass gain falls to at cycles per pixel, and the high-pass gain rises to at . Between them lies a gap where both gains are weak. A wide gap leaves the middle frequencies faint in both images, so neither reading is strong at middle distances. A large overlap, with , lets both images show at every distance, and they compete as a ghosted double image. With the two gains add to exactly at every frequency, and the hybrid simplifies to .

\usepackage{tikz}
\begin{document}
\definecolor{low}{HTML}{2F80ED}
\definecolor{high}{HTML}{D9483B}
\definecolor{mid}{HTML}{8A8A8A}
\begin{tikzpicture}[x=60cm,y=4cm,>=latex,font=\small]
\draw[->,mid] (0,0) -- (0.13,0) node[right] {$s$ (cycles/pixel)};
\draw[->,mid] (0,0) -- (0,1.15) node[above] {gain};
\foreach \s in {0.02,0.04,0.06,0.08,0.10,0.12} \draw[mid] (\s,0.02) -- (\s,-0.02) node[below] {\footnotesize \s};
\foreach \g in {0.5,1} \draw[mid] (0.002,\g) -- (-0.002,\g) node[left] {\footnotesize \g};
\draw[very thick,low,domain=0:0.125,samples=120] plot (\x,{exp(-2*pi*pi*64*\x*\x)});
\draw[very thick,high,domain=0:0.125,samples=120] plot (\x,{1-exp(-2*pi*pi*9*\x*\x)});
\draw[dashed,mid] (0,0.5) -- (0.125,0.5);
\draw[dashed,low] (0.0234,0) -- (0.0234,0.5);
\draw[dashed,high] (0.0625,0) -- (0.0625,0.5);
\node[low,right] at (0.026,0.85) {$\hat{G}_{\sigma_1}(s)$, $\sigma_1 = 8$};
\node[high,left] at (0.098,0.93) {$1 - \hat{G}_{\sigma_2}(s)$, $\sigma_2 = 3$};
\node[mid,align=center] (gap) at (0.047,0.66) {\footnotesize gap: both gains weak};
\draw[->,mid] (gap) -- (0.042,0.21);
\end{tikzpicture}
\end{document}

(Viewing Distance) Moving away from a hybrid raises the number of cycles per degree of visual angle at every image frequency.

A pattern with cycles across an image of width , seen from distance , has cycles per degree, with the angle in degrees. Doubling the distance roughly doubles this number. Human contrast sensitivity drops at high cycles per degree, as the lecture’s Campbell-Robson chart shows. Stepping back therefore pushes the band of into the range the eye barely sees. The band of moves into the range where the eye is most sensitive. Shrinking the image on a screen has the same effect as stepping back.

(Alignment) The two images must line up feature by feature, or both readings appear at once.

When the eyes, mouth and outline of the two faces coincide, the fine detail of sits on coarse shapes of that have the same layout. The visual system then groups everything into one face at each distance. Misaligned features leave the detail of floating over the wrong parts of , and the viewer sees two faces. Project 2 supplies starter code that aligns the pair before filtering. The choice of roles also matters. The image whose identity lives in fine texture, such as a cat’s fur, is the natural high-pass image.

(Range and Display) The high-pass image has a mean near and negative values, so the sum needs care before display.

The kernel sums to , so the high-pass image averages to about and is negative on the dark side of every edge. Shown alone, it needs an offset such as on a scale. The sum can leave and must be clipped. Averaging the two parts instead of adding them keeps the range but halves the contrast of both. In color, the low-pass image carries broad regions of color, and the high-pass image carries color only along edges. Project 2 asks, as an experiment, which part benefits more from color.

(Frequency Analysis) The log-magnitude spectra show directly whether the cutoffs worked.

The spectrum of is bright only inside a central disk whose radius is about the low-pass cutoff. The spectrum of the high-pass image has a dark hole in the center with a radius of about the high-pass cutoff. The hybrid’s spectrum is their sum, because the Fourier transform is linear. A disk that is too large, or a hole that is too small, shows overlap before any viewing test.

Examples

(Easy) From to Feature Size

A hybrid of two aligned face photos uses pixels for the low-pass and pixels for the high-pass.

(Medium) Printing a Hybrid for a Hallway

The hybrid from the previous example is pixels wide and is printed cm wide. One viewer stands m away and another m away.

(Hard) Reading the Gain Table

Use and , and the continuous gains .

See Also