AI Glossary / Computer vision and multimodal AI / Beginner

Bilinear interpolation

Definition

Bilinear interpolation estimates a value between four neighboring samples on a rectangular grid by interpolating in two directions. In imaging, it is commonly used to calculate pixel values when resizing, rotating or otherwise resampling a picture.

What it means

An image contains measurements at discrete positions. A transformation often asks for the color at a position that falls between those measurements. Bilinear interpolation answers by blending the four surrounding grid values according to the requested position.

The word “bilinear” means linear in each coordinate separately. It does not mean the complete two-dimensional surface must be a single flat plane. The formula can contain a product of the horizontal and vertical coordinates.

For an everyday example, enlarging a photograph creates more output pixels than the source contains. Bilinear interpolation supplies intermediate values, making transitions less blocky than simply copying the nearest pixel. It cannot recover details that the original photograph never recorded.

How it works

For a point inside a grid cell, let u describe its fractional horizontal position and v its fractional vertical position. Both range from 0 to 1. Label the corner values A at the upper left, B at the upper right, C at the lower left and D at the lower right.

The estimate is (1−u)(1−v)A + u(1−v)B + (1−u)vC + uvD. An equivalent procedure interpolates between A and B, then between C and D, and finally between those two results.

Inside the cell, the weights are nonnegative and sum to one. Image software also needs rules for coordinate alignment, boundary positions, color channels and numerical rounding. These choices can explain small differences between implementations using the same interpolation name.

Three practical examples

1. Website images: A preview service enlarges a small photograph using bilinear sampling. Edges look smoother than nearest-neighbor enlargement, but text and fine patterns may become soft.

2. Image alignment: A program shifts a photograph by half a pixel to align it with another capture. Bilinear interpolation estimates values at the newly requested source positions.

3. Measurement displays: A dashboard enlarges a regularly sampled heat map for presentation. Smooth colors help viewing, while the original sample locations remain available so viewers do not mistake interpolation for additional measurements.

Think of it this way

Think of estimating a temperature between four weather stations arranged at the corners of a rectangle, using position to blend their readings. A point near one corner receives more influence from that corner.

This analogy describes the arithmetic, not weather physics. Real temperature may vary sharply between stations. Likewise, interpolation assumes a useful local transition and cannot prove that the missing image values truly followed that transition.

Worked example

Take four corner values: upper left A = 0, upper right B = 10, lower left C = 20 and lower right D = 30. Estimate the value one-quarter of the way from left to right and halfway from top to bottom, so u = 0.25 and v = 0.5.

The upper horizontal estimate is 0.75 × 0 + 0.25 × 10 = 2.5. The lower horizontal estimate is 0.75 × 20 + 0.25 × 30 = 22.5. Blending them equally gives 12.5.

The direct four weights are 0.375, 0.125, 0.375 and 0.125. They sum to one and produce the same result. If the output format stores only integers, its rounding rule determines the saved value. This example uses a scalar channel; color images require an appropriate channel and color-space treatment.

Illustrative case study

Fictional case: Fern Events redesigns its booking website and resizes older venue photographs. The team compares nearest-neighbor and bilinear previews. Bilinear interpolation gives less blocky enlarged pictures, but signs inside the photographs remain blurred because the originals contain too few pixels.

The team uses suitable interpolation for previews and requests better source photographs for prominent placements. It also discovers that its floor-plan category masks must retain exact labels. Those masks use a label-preserving resampling method instead of the photo setting. The case illustrates choosing a method for the data type, not a measured business improvement.

Common misconceptions and mistakes

Interpolation does not add verified detail. A larger image can contain more pixels without containing more original information.

Bilinear interpolation is not the bilinear transform used in digital filter design. The shared adjective refers to different mathematical contexts.

Smooth appearance does not mean aliasing has been prevented. Reducing image size may require additional low-pass filtering; a simple four-sample interpolation calculation is not a complete downsampling strategy.

Blending numerical category labels can create meaningless intermediate labels. Also, interpolating encoded color values is not always equivalent to interpolating linear-light values. The appropriate choice depends on the application and its intended color behavior.

Business use

Bilinear interpolation offers a useful compromise between simple nearest-neighbor sampling and more elaborate resampling methods. It is often suitable for responsive previews, coordinate transformations and continuous-valued visual data.

Teams should assess sharpness, aliasing and boundary behavior using representative inputs. For scientific or business measurement displays, retain the underlying data and disclose that a smooth image includes estimated values. For repeated transformations, combining transformations into one resampling step can help avoid unnecessary cumulative softness.

People also ask

Does bilinear interpolation use four pixels?

The basic two-dimensional estimate uses the four surrounding samples. A resizing implementation may include additional filtering, especially when shrinking.

Is it always better than nearest neighbor?

No. Nearest neighbor is useful when exact discrete labels or a pixel-art appearance must be preserved.

Can it produce values outside the four corner values?

Within a cell, the standard nonnegative weighted blend stays within their range. Extrapolation outside the cell is a different situation.

Check your understanding

A segmentation mask uses 1 for road and 2 for building. Why is an interpolated value of 1.5 problematic?

Answer: It is not one of the defined categories. Blending label identifiers does not create a meaningful halfway category. Use a resampling approach appropriate to categorical data, or interpolate meaningful probabilities before making a separate classification decision.

Related terms

  • Aliasing (factorial experiments)
  • Affine transformation
  • Linear interpolation
  • nearest-neighbour interpolation
  • bicubic interpolation
  • image resampling
  • aliasing
  • antialiasing

Learn next

Calculate the value at the center of a four-corner grid and confirm that it is the average of the corners. Then enlarge a small photograph and a labeled mask with different methods. Compare not just appearance but which original numerical meanings each operation preserves.

More in Computer vision and multimodal AI

  • Bidirectional similarity - Bidirectional similarity is an image-comparison objective that checks patch matches in both directions between a source and a result.
  • Bilateral filtering - Bilateral filtering is an edge-preserving smoothing method that weights neighboring pixels by both spatial closeness and similarity in value.
  • Bilateral grid - A bilateral grid is a data structure that organizes image information by both pixel location and a guiding value, such as brightness.
  • Bilinear transform - The bilinear transform is a mathematical substitution used to convert a continuous-time filter description into a discrete-time filter.
  • Binary decision - A binary decision is a choice between two defined alternatives, such as yes or no, accept or reject, or object present or absent.
  • Binary image - A binary image is an image whose pixels have only two possible values.

Sources

Primary documentation: MathWorks, interp2, https://www.mathworks.com/help/matlab/ref/interp2.html ; and imresize, https://www.mathworks.com/help/matlab/ref/imresize.html . These document interpolation methods and image-resizing behaviour. The worked example is an original calculation and does not prescribe every library's coordinate alignment or antialiasing defaults.

Previous: Bilevel optimization Next: Bilinear transform

  • 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