AI Glossary / Computer vision and multimodal AI / Intermediate

Linear filter

Definition

A linear filter transforms a signal or image while preserving superposition: filtering a weighted sum of inputs gives the same result as taking the corresponding weighted sum of their separately filtered outputs. Many common image filters compute fixed weighted sums of pixel values. Examples include certain smoothing, derivative, and sharpening operations, provided additional steps such as clipping do not break linearity.

What it means

Linear has a precise meaning here. If a filter is called T, then T(a times x plus b times y) must equal a times T(x) plus b times T(y), for inputs x and y and scalar weights a and b.

This property makes the filter easier to analyze because complex inputs can be separated into simpler components. Each component's response can be calculated independently and combined to obtain the final response.

Linearity does not require a filter to smooth, nor does it require the same rule at every image position. Shift invariance is a separate property. A filter whose fixed weights vary with position can be linear while not being shift-invariant. When both properties hold, convolution provides a particularly useful representation.

How it works

For a simple local filter, choose weights for neighboring samples and compute their weighted sum. The weights must be independent of the input values for this fixed-weight operation to remain linear.

A three-sample average uses weights of one third, one third, and one third. A difference filter might use negative and positive weights to respond to changes. Weight signs and sums determine important aspects of the behavior, but do not by themselves decide linearity.

Consider the entire implementation, including boundary handling and output conversion. Adding a fixed nonzero offset makes an operation affine rather than linear. Clipping, thresholding, and some rounding effects also mean that a practical output pipeline may fail exact superposition even when its central weighted-sum calculation is linear.

Three practical examples

1. Noise reduction: A vision pipeline applies a fixed averaging or Gaussian filter to reduce rapid intensity variation before a later analysis step.

2. Edge information: A derivative filter computes directional intensity changes using positive and negative coefficients, producing a signed response that can support edge analysis.

3. Signal analysis: An imaging engineer studies how a fixed filter responds to simple patterns, then uses superposition to understand its behavior on more complex images.

Think of it this way

Think of a recipe that always combines fixed amounts of three ingredients. Doubling every ingredient doubles the resulting mixture, and combining two prepared input mixtures gives the same result as processing them separately and adding the results. The analogy breaks if the recipe changes its amounts after tasting the ingredients, just as data-dependent filter weights may break linearity.

Worked example

Let T average three values. For input x = (3, 6, 9), T(x) = 6. For input y = (0, 3, 6), T(y) = 3.

Their sum is x + y = (3, 9, 15), whose average is 9. This equals T(x) + T(y) = 6 + 3. Doubling x gives (6, 12, 18), with average 12, equal to 2 times T(x). These examples demonstrate additivity and scaling for this averaging operation.

Now append a rule that clips every output above 10 to 10. The original x still produces 6, but doubled x produces 10 after clipping instead of 12. The combined operation therefore fails the scaling test.

One successful pair of examples would not prove an arbitrary filter is linear for all possible inputs. Here the general fixed weighted-sum formula provides that proof; the numbers make the property visible. The clipping example also shows why an implementation's final exported image can behave differently from its intermediate floating-point filter response.

Illustrative case study

Fictional case study: A machine-vision team develops a preprocessing stage for images of printed packaging. Its fixed blur behaves predictably in a floating-point prototype, but a deployed version produces unexpected differences on bright regions.

The engineers find that an intermediate image was converted to a limited integer range and clipped before the next operation. Tests based only on ordinary midrange values had not exposed the issue.

They preserve sufficient numerical range until the intended display or conversion step and check synthetic bright patterns as well as representative photographs. The case illustrates the distinction between a mathematical linear filter and a complete processing pipeline. It does not claim that linear filtering is always the best preprocessing choice for printed text.

Common misconceptions and mistakes

Linear does not mean that the output looks like straight lines. It describes the relationship between input combinations and output combinations.

A median filter is generally nonlinear, even though it can smooth noise. A filter's purpose does not determine its mathematical class.

Weights that sum to one may preserve constant brightness in suitable circumstances, but that condition is not the definition of linearity. Derivative filters can be linear with weights summing to zero.

Linear and shift-invariant are different properties. Do not assume every linear image operator is a single convolution with one kernel.

Clipped or thresholded outputs should not be used to demonstrate exact linearity of the underlying arithmetic without accounting for those extra operations.

Business use

Linear filters are useful building blocks because their behavior can be reasoned about, reproduced, and often implemented efficiently. They support denoising, feature extraction, resampling, and many other imaging tasks.

Select the filter based on the task rather than its mathematical simplicity alone. Smoothing can remove small but important features, and derivative filters can emphasize noise. Evaluate downstream performance alongside filter response, and document kernel coefficients, boundary rules, numerical precision, and any nonlinear postprocessing when consistency matters across systems.

People also ask

Is every blur a linear filter?

No. Some blurs use fixed linear weights, while others adapt to image values or use nonlinear operations.

Can a linear filter sharpen an image?

Yes. Suitable weighted combinations can emphasize detail; smoothing is only one possible behavior.

Does adding a constant preserve linearity?

A nonzero fixed offset makes the overall mapping affine, so it no longer satisfies the standard linearity definition.

Check your understanding

A proposed filter maps zero input to a constant image of value 5. Can it be linear?

Answer: No. A linear operator must map zero to zero. The fixed offset violates that requirement.

Related terms

  • Convolution
  • Kernel
  • Nonlinear filter
  • Superposition
  • shift invariance
  • Gaussian filter
  • derivative filter

Learn next

Test additivity and scaling on a fixed weighted average, a median operation, and an average followed by clipping. Then study the additional shift-invariance property and why it connects many practical filters to convolution.

  • Weighted average
  • Convolution

More in Computer vision and multimodal AI

  • Light field - A light field describes light traveling through space as a function of position and direction.
  • Light transport - Light transport describes how light moves through a scene and interacts with surfaces and media before reaching a sensor or observer.
  • Line intersection - Line intersection is the geometric relationship in which two lines share one or more points.
  • Linear interpolation - Linear interpolation estimates a value between two known samples by following the straight line that connects them.
  • Linear inverse problem - A linear inverse problem estimates an unknown quantity from measurements related to it by a linear forward model.
  • Linear light - Linear light describes an image representation in which numerical values are proportional to the represented light quantity within a defined color and...

Sources

Steven W. Smith, The Scientist and Engineer's Guide to Digital Signal Processing, Linear Systems: https://www.analog.com/media/en/technical-documentation/dsp-book/dsp_book_Ch5.pdf

The author's technical text was opened. Numerical filter examples and the packaging-inspection scenario are original teaching material.

Previous: Linear Dynamical System Next: Linear hashing

  • Home
  • Daily AI Updates
  • Blog
  • AIFBL Academy
  • AI Glossary
  • Products and Tools
  • Store
  • Free CFO AI Prompt Pack
  • About Shihan Sheriff
  • Privacy Policy
  • Terms of Use
  • Refund Policy
  • Cookie Policy
  • Earnings Disclaimer