Weighted Image Reconstruction

By Marc-Daniel DALEBA
Last updated: September 2026

1. Introduction

In this article, we will see how we can reconstruct an image using Accumulative Weighted Interpolation.
The full program is available here: https://github.com/blueberry077/Weighted-Image-Reconstruction

Image reconstruction with 100 initial points
(a) 100 initial points
Image reconstruction with 1000 initial points
(b) 1000 initial points
Image reconstruction with 10000 initial points
(c) 10000 initial points
Reconstructed using exponent \( p = 3 \). A higher power parameter was chosen because lower values caused the predominant green background in the test image to bleed excessively across distant pixels.

2. Interpolation Formulation

Let \( A \), \( B \) and \( C \) be points in an Euclidean plane and each with a known attribute, \( F(A) \) and \( F(B) \). Let's calculate the unknown attribute \( F(C) \).

In order to calculate \( \mathcal{P}(C) \), we need the distance \( d_A \) and \( d_B \), respectively the length of \( \left[ AC \right] \) and \( \left[ BC \right] \)

\[ d_A=\sqrt{(x_A-x_C)^2+(y_A-y_C)^2} \quad \text{and} \quad d_B=\sqrt{(x_B-x_C)^2+(y_B-y_C)^2} \]

These distances allow us to calculate the weights \( w_A \) and \( w_B \) that will influence \( F(C) \).

To give more influence to the closest point, we assign weights inversely proportional to the distances. We then normalize them so that their sum equals 1:

\[ \bbox[8px, border: 1px solid black]{ w_{A} = \frac{d_B}{d_A+d_B}} \quad \text{and} \quad \bbox[8px, border: 1px solid black]{ w_{B} = \frac{d_A}{d_A+d_B}} \]

If \( d_A \gt d_B \) then \( w_A \lt w_B \)

If \( d_A \lt d_B \) then \( w_A \gt w_B \)

Then we can calculate \( F(C) \) the weighted average of the attributes at \( A \) and \( B \) to \( C \):

\[ \bbox[8px, border: 1px solid black]{ F(C)=w_{A}F(A)+w_{B}F(B) } \]

3. Generalization to Multiple Points

Now, in an Euclidean plane, say we have \( n \) points: \( P_0,P_1,P_2,...,P_n \) and attributes \( F_0,F_1,F_2,...,F_n \) and a point \( C \), to which we want to calculate the attribute \( F(C) \).

For each point \( P_i \), we calculate the distance \( d_i \) to \( C \):

\[ d_i=\sqrt{(x_i-x_C)^2+(y_i-y_C)^2} \]

Then we calculate the weight \( w_i \) of the point \( P_i \).

Since we don't have directly the "other" distance like in section 2, the inverse of the distance, ensuring that closer points have greater influence.

\[ w_{i}=\frac{1/d_i^p}{\sum_{j=0}^{n}1/d_j^p} \quad \text{ with }p\text{ as the exponent to control the influence.} \]

The interpolated attribute is therefore \( F(C) \)

\[ \bbox[8px, border: 1px solid black]{ F(C)=\sum_{i=0}^{n}w_{i}\cdot F_i } \]

4. Notes

Apparently this exists as Inverse Distance Weighting (IDW).
I had fun learning LaTeX and figuring out a solution for a small prototype.