top of page

2D interpolation

nearneighbor.m

The interpolation uses near-neighbor algorithm for determining the value of a specific NaN pixel. A self-defined searching radius will be used to search the neighbors. The weighting is defined as taking more counts for closer pixels.

If the radius is set to 3, then the neighbors will have three levels (near to far).

  • Weighting: the nearest pixels will be counted three times, the middle ones will be counted twice and the farthest will only be counted once.

  • No weighting: All pixel values will be averaged to determine the value of the specific NaN pixel.

  • Example

Original.png
R2N.png
R4N.png
R4W.png
R3N.png
R3W.png
R2W.png

Radius= 2, no weighting

Radius= 3, no weighting

Radius= 4, no weighting

Radius= 4, with weighting

Radius= 3, with weighting

Radius= 2, with weighting

bottom of page