Point Processing
A point process, or point operation, changes each pixel using only that pixel’s own value:
Here is the input gray level, is the output gray level, and is one function applied at every pixel. Position and neighbors play no role, which separates point processing from filtering and from warping. Gray levels run over , with for 8-bit images.The negative is . The log map compresses large values, and it is the standard way to display a Fourier magnitude spectrum. The power-law or gamma map, with and normalized to , is
The exponent sets the shape of the curve. A brightens dark regions and spreads out detail in the shadows. A darkens the image and spreads out detail in the highlights. Contrast stretching is a piecewise-linear through two control points and . With , and , it becomes thresholding.The histogram counts the pixels at each level, , and for an image of pixels. The cumulative histogram at level is , the fraction of pixels at or below . Histogram equalization uses times the cumulative histogram as the map:
The output histogram is roughly flat, so the image uses the full range of gray levels. Color transfer (Reinhard, Ashikhmin, Gooch and Shirley, 2001) applies a point process to each channel of a decorrelated color space, . It shifts and scales each channel so that its mean and standard deviation match those of a target image. Point processing cannot use spatial context. Two images with the same histogram, such as a photo and a random shuffle of its pixels, receive identical treatment.
Intuition
The numbers in an image file are already a squeezed view of the scene. A pixel’s value follows , with reflectance in and illumination anywhere in . The lecture’s examples of real scenes span relative brightness values from to , while a stored picture holds to . The exposure picks which slice of that range fits. The last stage of the camera pipeline then remaps sensor values to pixel values with a curve, which is itself a point process (1.1. Digital Images). Point processing remaps the stored values again, for display or analysis. The name says that each pixel is treated as an isolated point.
\usepackage{tikz}
\begin{document}
\definecolor{lift}{HTML}{2F80ED}
\definecolor{sink}{HTML}{D9483B}
\definecolor{mid}{HTML}{8A8A8A}
\begin{tikzpicture}[scale=4.5,>=latex,font=\small]
\draw[->] (0,0) -- (1.1,0) node[right] {$r$};
\draw[->] (0,0) -- (0,1.1) node[above] {$s$};
\draw[mid!50] (1,0) -- (1,1) -- (0,1);
\node[below] at (0,0) {$0$};
\node[below] at (1,0) {$1$};
\node[left] at (0,1) {$1$};
\draw[very thick,lift,domain=0.0001:1,samples=200] plot (\x,{pow(\x,0.4)});
\draw[very thick,mid] (0,0) -- (1,1);
\draw[very thick,sink,domain=0:1,samples=200] plot (\x,{pow(\x,2.5)});
\node[lift,above left] at (0.3,0.62) {$\gamma = 0.4$};
\node[mid,above left] at (0.55,0.55) {$\gamma = 1$};
\node[sink,below right] at (0.7,0.41) {$\gamma = 2.5$};
\end{tikzpicture}
\end{document}Every is a choice of which gray levels to spread apart. Where the curve is steeper than the diagonal, nearby input levels move apart and contrast grows. Where it is flatter, they move together and contrast shrinks. The curve above is steep near , so it opens up the shadows at the cost of the highlights. Histogram equalization picks the slope from the data. It makes steep where many pixels sit and flat where few do.
Properties
(Why the CDF Flattens) The cumulative histogram sends each pixel to its rank, and ranks are spread evenly.
Treat the gray level of a random pixel as a continuous random variable with density . Its cumulative distribution is the fraction of pixels darker than . If is strictly increasing, the new level satisfies , so is uniform on . Multiplying by stretches it over the full range. With discrete levels, equalization can merge input levels but cannot split one. A crowded level stays crowded, and some output levels stay empty. The result is only roughly flat, as the figure shows for the image in the Medium example.
\usepackage{tikz}
\begin{document}
\definecolor{bar}{HTML}{2F80ED}
\definecolor{map}{HTML}{D9483B}
\begin{tikzpicture}[x=0.6cm,y=1cm,>=latex,font=\small]
\foreach \k/\n in {0/22,1/30,2/24,3/14,4/6,5/3,6/1,7/0} {\fill[bar!40] ({\k-0.3},0) rectangle ({\k+0.3},{\n/10});}
\draw[->] (-0.6,0) -- (7.8,0) node[below right] {$r_k$};
\draw[->] (-0.6,0) -- (-0.6,3.8) node[above] {$n_k$};
\foreach \k in {0,...,7} {\node[below] at (\k,0) {\scriptsize $\k$};}
\foreach \v in {10,20,30} {\draw (-0.65,{\v/10}) -- (-0.55,{\v/10}) node[left=2pt] {\scriptsize $\v$};}
\draw[map,thick,dashed] (0,0.77) -- (1,1.82) -- (2,2.66) -- (3,3.15) -- (4,3.36) -- (5,3.465) -- (6,3.5) -- (7,3.5);
\foreach \k/\s in {0/2,1/4,2/5,3/6,4/7,5/7,6/7,7/7} {\fill[map] (\k,{\s/2}) circle (2.2pt);}
\draw[map,->] (8.3,0) -- (8.3,3.8) node[above] {$s_k$};
\foreach \s in {0,...,7} {\draw[map] (8.25,{\s/2}) -- (8.35,{\s/2}) node[right=1pt] {\scriptsize $\s$};}
\node[map,anchor=west] at (0.2,3.95) {$7 \times$ cumulative histogram};
\begin{scope}[xshift=7.5cm]
\foreach \k/\n in {2/22,4/30,5/24,6/14,7/10} {\fill[bar!40] ({\k-0.3},0) rectangle ({\k+0.3},{\n/10});}
\draw[->] (-0.6,0) -- (7.8,0) node[below right] {$s$};
\draw[->] (-0.6,0) -- (-0.6,3.8) node[above] {count};
\foreach \k in {0,...,7} {\node[below] at (\k,0) {\scriptsize $\k$};}
\foreach \v in {10,20,30} {\draw (-0.65,{\v/10}) -- (-0.55,{\v/10}) node[left=2pt] {\scriptsize $\v$};}
\node[anchor=west] at (0.2,3.95) {after equalization};
\end{scope}
\end{tikzpicture}
\end{document}(Lookup Tables) A point process is applied by computing once per gray level and indexing.
Since depends only on , an 8-bit image needs only evaluations of , stored in an array lut. The output is lut[img], one table lookup per pixel, whatever the cost of . Increasing maps never swap the order of two gray levels, so edges stay where they were. Their strength does change. Discussion 3 notes that a Sobel edge response ignores a constant brightness shift but not a contrast change such as histogram equalization. The negative is decreasing, so it reverses the sign of every edge.
(Gamma on 8-Bit Values) The formula with assumes values in .
For 8-bit values the map is . Applied to raw levels with , a map would send to . The lecture’s plot draws the curves on , and all of them pass through , which matches . The slope grows without bound near when , which is why shadows open up. The lecture’s washed-out aerial photo goes the other way. Maps with , and darken it and bring back detail in its bright areas.
(Color Transfer Formula) Each channel is shifted and scaled so that its mean and standard deviation match the target’s.
For a channel with source mean and standard deviation , and target statistics and , every pixel value becomes
A pixel that sat one standard deviation above the source mean ends up one standard deviation above the target mean. Reinhard et al. work in , where is lightness and and are yellow-blue and red-green opponent channels. In RGB the channels are strongly correlated, since a brighter surface is usually brighter in all three. Changing RGB channels one at a time therefore tends to create odd colors. In the channels are close to independent, so per-channel matching behaves well. The space of 2.9. JPEG Compression and the Lab space of 8.3. Image Colorization separate lightness from color in a similar way.
(Blind to Position) A point process cannot denoise, sharpen, or correct light that varies across the image.
The lecture shows a photo and a noise image with the same histogram. Any point process changes them in exactly the same way, because it sees only the list of values. Removing noise or sharpening edges requires comparing a pixel with its neighbors, as linear filters do. A histogram discards position in the same way. Texture descriptors therefore count filter responses, which encode local structure, instead of raw pixel values (9.3. Texture Histograms).
Examples
(Easy) Opening Up the Shadows
A photo has normalized gray levels. Two shadow pixels have and . Two highlight pixels have and .
Apply and then . How does the gap between each pair change? What does do to the 8-bit value ? With the four values become , , and . The shadow gap grows from to . The highlight gap shrinks from to . With the values become , , and . The shadow gap shrinks to and the highlight gap grows to .
For 8-bit data, , which rounds to . A pixel near black moves almost a third of the way up the range.
(Medium) Equalizing a Dark 8-Level Image
A image has gray levels. Its histogram is for levels to , so most pixels are dark.
Compute the equalization map, the output histogram, and the mean level before and after. Is the output histogram flat? pixels, . The cumulative histogram is . Multiplying by gives , which rounds to The output histogram over levels to is . The four brightest input levels merge into level . The crowded levels , and move apart, with gaps of and . The mean level rises from to .
With
The output is not flat. Levels , and are empty, and level still holds pixels. Equalization cannot split a level, so a crowded level stays crowded. The darkest pixels also land at and not at . A common variant subtracts the smallest nonzero cumulative value first, computing . Here that gives and uses the bottom of the range.
(Hard) A Shadow Across a Page
A printed page is photographed with part of it in shadow. Paper has reflectance and ink has reflectance . The illumination is in the lit part and in the shadow.
Compute the four pixel values. Can any point process make all paper white and all ink black? , lit paper is , lit ink is , shaded paper is , and shaded ink is .
Using
Lit ink and shaded paper both have the value . A point process sees only that value, so it must send both pixels to the same output. No choice of , increasing or not, can make one white and the other black. The product of reflectance and illumination causes this. A dark surface in bright light can match a bright surface in dim light. Fixing it requires information from the neighborhood, such as an estimate of the illumination from a heavily blurred copy of the page.
See Also
- 1.1. Digital Images, for image formation, dynamic range and the acquisition pipeline.
- 2.2. Fourier Transform in Images, where the log map makes magnitude spectra visible.
- 8.1. Parametric Texture Synthesis, which matches histograms of filter responses instead of pixel values.
- 9.3. Texture Histograms, for what histograms keep and what they discard.