CS Fundamentals Trainer · Guides
Point versus neighbourhood processing: what each can and cannot do
The two families of image operations side by side: lookup tables for point operations, sliding windows for neighbourhood ones. What each can and cannot do, why a nonlinear tone curve and a filter do not commute, the operations that live in both worlds, and the default order for a pipeline: denoise, tone, sharpen.
7 min read
Image processing operations fall into two families that look similar in code and behave very differently: point processing, where each output pixel depends only on the input pixel at the same place, and neighbourhood processing, where it depends on a window around that place. Knowing which family an operation belongs to tells you what it can do, what it cannot do, what it costs, and in which order to combine it with the others. This guide builds that map.
1. Two definitions
Point processing (an intensity transformation) is written s = T(r): the output value s depends only on the input value r at the same pixel. The neighbours and the position play no role. Negative, log, power-law (gamma), contrast stretching, thresholding and histogram equalization (global) are all point operations.
Neighbourhood processing (spatial filtering) is written g(x, y) = a function of the pixels around (x, y). A linear spatial filter is the special case where the function is a weighted sum with a kernel. Box and Gaussian smoothing, the median, the Laplacian, Sobel and unsharp masking are all neighbourhood operations.
Diagram: Point versus neighbourhood processing
2. Side-by-side
| Point | Neighbourhood | |
|---|---|---|
| Input to the output at a pixel | one value | m × n values |
| Implementation | a lookup table of L entries (256 for 8 bits), built once | sliding window over the image, with padding at the border |
| Cost per pixel | one table lookup, whatever the image | about mn operations (m + n if separable) |
| Knows about shapes, edges, texture | no | yes |
| Changes the histogram | yes, by design | as a side effect |
| Can reduce noise | not by itself: it cannot tell noise from detail (it can still raise or lower the noise amplitude) | yes |
| Can sharpen or blur | no | yes |
| Can fix global brightness or contrast | yes | not directly |
| Border problem | none | yes, padding needed |
The lookup table is worth underlining: an 8-bit image has only 256 possible inputs, so any point operation, however complicated the formula, is computed 256 times and then applied with one lookup per pixel.
3. What each family cannot do
A point operation cannot use context. Two pixels with the same value always get the same output, so it cannot make an edge crisper (the edge is a relation between neighbours), cannot remove a noisy pixel (it has no way to tell it from a real one) and cannot flatten uneven illumination (the same grey means different things on the bright and dark sides).
A point operation does change how large the noise is, and whether it grows or shrinks depends on the transform and on the signal level. A curve with a slope above 1 in some range magnifies the differences between pixels in that range, noise included; a slope below 1 shrinks them; clipping removes them where the signal saturates. What it cannot do is separate the noise from the detail.
A normalised smoothing filter cannot change global tone. Its kernel sums to 1, so a flat region keeps its value. It will not brighten a dark image or stretch contrast.
Two operations from different families do not commute. This is the subtle one. A convolution followed by another convolution can be done in either order, because convolution is commutative. A nonlinear point operation followed by a filter is a different thing from the filter followed by the point operation. A simple case: take two neighbouring pixels of value 0 and 1 and apply a power law with exponent 2, then average. You get (0 + 1) / 2 = 0.5. Averaging first and then squaring gives 0.5² = 0.25. Same two operations, answers a factor of two apart.
This matters in practice. Image files hold gamma-encoded values, so averaging them directly (for blurring or for scaling an image down) averages the encoded numbers rather than the light. For physically meaningful smoothing, convert to a linear scale first, filter, and convert back. For ordinary enhancement the choice is usually a matter of taste, but you should make it on purpose.
4. Operations that live in both worlds
Some techniques cross the line:
- Local histogram equalization is a point operation (an equalizing curve) whose curve is computed from a neighbourhood. Its cost is the neighbourhood cost, and it can amplify noise in flat regions, which is why limits are put on its contrast.
- Local statistics (mean and variance in a window) steer a point-like gain: boost contrast where the local variance is low, leave busy areas alone.
- Unsharp masking is a neighbourhood step (the blur) combined with point-wise arithmetic (the subtraction and the weighted sum).
- Fuzzy rule-based processing can be either. A contrast rule such as "if a pixel is dark, make it darker" is a point operation. A boundary rule that looks at the differences to the eight neighbours is a neighbourhood operation.
A useful test is to ask: "if I shuffle all the pixels of the image randomly, does the operation's result at each pixel stay the same?" If yes, it is a point operation.
5. Choosing the order in a pipeline
Pipelines usually mix both families, and the order is not arbitrary. A sensible default, to be checked against your images and your implementation, is:
- Neighbourhood: reduce noise first. Stretching tone curves (slope above 1) and sharpeners multiply the differences between pixels, noise included. A gamma below 1 has a slope above 1 in the dark part of the range, so it makes dark noise more visible. Doing the denoising first lets you remove the noise before the other steps magnify it.
- Point: fix the tone. Gamma or a contrast stretch, chosen from the histogram.
- Neighbourhood: sharpen last. Sharpening is the most sensitive to noise, and tone changes alter edge contrast, so you want to judge sharpness on the final tones.
- Point: clip or rescale for display. Do it once, at the end, so intermediate values with negative or large numbers are not lost.
Exceptions exist (shading correction is better done early, since it removes a smooth additive-like pattern that would otherwise confuse every later step), but you should be able to say why you are breaking the default.
6. A quick selection table
| You want to… | Family | Tool |
|---|---|---|
| make the picture lighter or darker | point | gamma, log, linear map |
| use the full range of grey levels | point | contrast stretch, histogram equalization |
| show detail in dark regions | point | power law with γ < 1, log |
| highlight a range of intensities | point | slicing, bit planes |
| reduce noise | neighbourhood | Gaussian, median |
| sharpen | neighbourhood | unsharp mask, Laplacian |
| find edges | neighbourhood | Sobel gradient, Laplacian |
| remove uneven illumination | neighbourhood, then point | lowpass estimate, then a division |
| adapt contrast to local content | both | local histogram equalization with a contrast limit |
7. Self-check questions
- Why can a lookup table implement any point operation on an 8-bit image, but not any neighbourhood operation?
- A teammate says "gamma correction will remove the grain in the dark areas." Why is that wrong for a gamma below 1?
- You blur an image and then apply a log transform. A colleague applies the log first and then blurs. Which result is brighter around a bright dot on a dark background, and why?
- Why is the order "denoise, tone, sharpen" a good default?
Further reading
- Digital Image Processing, 4th edition, chapter 3 (intensity transformations, histogram processing and spatial filtering).
- Gamma correction, Histogram equalization and Adaptive histogram equalization.
- Kernel (image processing)).
Practise this topic: Computer Vision