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

PointNeighbourhood
Input to the output at a pixelone valuem × n values
Implementationa lookup table of L entries (256 for 8 bits), built oncesliding window over the image, with padding at the border
Cost per pixelone table lookup, whatever the imageabout mn operations (m + n if separable)
Knows about shapes, edges, texturenoyes
Changes the histogramyes, by designas a side effect
Can reduce noisenot by itself: it cannot tell noise from detail (it can still raise or lower the noise amplitude)yes
Can sharpen or blurnoyes
Can fix global brightness or contrastyesnot directly
Border problemnoneyes, 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:

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:

  1. 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.
  2. Point: fix the tone. Gamma or a contrast stretch, chosen from the histogram.
  3. 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.
  4. 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…FamilyTool
make the picture lighter or darkerpointgamma, log, linear map
use the full range of grey levelspointcontrast stretch, histogram equalization
show detail in dark regionspointpower law with γ < 1, log
highlight a range of intensitiespointslicing, bit planes
reduce noiseneighbourhoodGaussian, median
sharpenneighbourhoodunsharp mask, Laplacian
find edgesneighbourhoodSobel gradient, Laplacian
remove uneven illuminationneighbourhood, then pointlowpass estimate, then a division
adapt contrast to local contentbothlocal histogram equalization with a contrast limit

7. Self-check questions

Further reading

Practise this topic: Computer Vision

More guides