This project demonstrates the application of numerical analysis techniques, specifically Newton Linear Interpolation and Quadratic Interpolation (Divided Differences) to restore images corrupted by salt-and-pepper noise.
In signal processing, an image can be viewed as a discrete 2D function
- Noise Simulation: Adds configurable salt-and-pepper noise to grayscale images.
- Newton Linear Interpolation: Reconstructs pixels using the nearest horizontal neighbors.
-
Bi-Directional Quadratic Interpolation:
- Fits a second-degree polynomial
$P_2(x)$ using three points. - Performs both vertical (y-axis) and horizontal (x-axis) approximations.
- Averages the two approximations for a more robust estimation.
- Fits a second-degree polynomial
- MSE Evaluation: Quantifies restoration quality using Mean Squared Error.
The first-degree interpolating polynomial is defined as:
The second-degree interpolating polynomial is defined as:
$b_0 = f[x_0]$ $b_1 = f[x_0, x_1]$ $b_2 = f[x_0, x_1, x_2] = \frac{f[x_1, x_2] - f[x_0, x_1]}{x_2 - x_0}$
The quadratic method significantly reduces MSE compared to standard linear methods by capturing the local curvature of the image intensity surface.
| Method | MSE (Approx) |
|---|---|
| Noisy Image | 1091.75 |
| Linear Restoration | 392.48 |
| Quadratic (Averaged) | 1.36 |
- Python 3.x
- NumPy
- OpenCV
- Matplotlib