- #1

AVBs2Systems

- 39

- 24

- TL;DR Summary
- Bilinear spline interpolation in matlab using a spline function. MESHGRID and SURF commands needed.

Hello.

So, I must provide a solution for an image processing course I am taking (implemented in MATLAB).The task is as follows:

1. I must provide a MATLAB script that takes in a DISCRETE N x N matrix (Greyscale picture) and does Bilinear spline interpolation on it.

This is the spline function used in one dimension:

$$

\textbf{Mathematical objects}

$$

The Square matrix which represents the greyscale image:

$$

\Omega = \{1,2,3...N\} \times \{1,2,3...N\}

$$

The basic spline function for 1 D images (NOT for the matrix above!)

$$

b(x) = \text{Max}( 0, 1 - |x|)

$$

The above is equivalent to the triangle function in signal processing:

$$

b(x) = \text{Tri}\bigg(\frac{x}{2} \bigg)

$$

This was ok for interpolating simple sequences, or "1 dimensional" images.

Now, for 2dimensional images, the function gets modified, into big B (This is USED FOR ## \Omega ## )

$$

B(x,y) = \text{Max}( 0, 1 - |x|) \cdot \text{Max}( 0, 1 - |y|)

$$

The result of the interpolation is this function:

$$

u(x,y) = \displaystyle \sum_{i , j \in \Omega} u_{i,j} \cdot B_{i , j}(x,y) = \displaystyle \sum_{i,j \in \Omega} u_{i,j} \cdot \text{Max}( 0, 1 - |x - i|) \cdot \text{Max}( 0, 1 - |y - j|)

$$

Now, the task is attached as the photo below:

Now, your image is given via the matrix ## A = [ 69, 110, 196;... 50, 226, 101;... 210, 100, 206 ]## Write a Matlab script bilinearSpline.m which visualizes the corresponding interpolating function u in the domain ##[1, 3] ⊆ \mathbb{R}^{2} ## . Check help and documentation of the commands meshgrid and surf in order to visualize your function.

I am in desperate need of any help, how should I code this? and what would the result actually look like? I have some knowledge of matlab, but I am a little lost on how to implement it.

Here is what I understood:

1. Need two for loops for the array.

2. Need to define the spline function (No idea how to in matlab).

3. Need to use the meshgrid and surf command to create the plot in the 1,3 x 1,3 domain.

So, I must provide a solution for an image processing course I am taking (implemented in MATLAB).The task is as follows:

1. I must provide a MATLAB script that takes in a DISCRETE N x N matrix (Greyscale picture) and does Bilinear spline interpolation on it.

This is the spline function used in one dimension:

$$

\textbf{Mathematical objects}

$$

The Square matrix which represents the greyscale image:

$$

\Omega = \{1,2,3...N\} \times \{1,2,3...N\}

$$

The basic spline function for 1 D images (NOT for the matrix above!)

$$

b(x) = \text{Max}( 0, 1 - |x|)

$$

The above is equivalent to the triangle function in signal processing:

$$

b(x) = \text{Tri}\bigg(\frac{x}{2} \bigg)

$$

This was ok for interpolating simple sequences, or "1 dimensional" images.

Now, for 2dimensional images, the function gets modified, into big B (This is USED FOR ## \Omega ## )

$$

B(x,y) = \text{Max}( 0, 1 - |x|) \cdot \text{Max}( 0, 1 - |y|)

$$

The result of the interpolation is this function:

$$

u(x,y) = \displaystyle \sum_{i , j \in \Omega} u_{i,j} \cdot B_{i , j}(x,y) = \displaystyle \sum_{i,j \in \Omega} u_{i,j} \cdot \text{Max}( 0, 1 - |x - i|) \cdot \text{Max}( 0, 1 - |y - j|)

$$

Now, the task is attached as the photo below:

Now, your image is given via the matrix ## A = [ 69, 110, 196;... 50, 226, 101;... 210, 100, 206 ]## Write a Matlab script bilinearSpline.m which visualizes the corresponding interpolating function u in the domain ##[1, 3] ⊆ \mathbb{R}^{2} ## . Check help and documentation of the commands meshgrid and surf in order to visualize your function.

I am in desperate need of any help, how should I code this? and what would the result actually look like? I have some knowledge of matlab, but I am a little lost on how to implement it.

Here is what I understood:

1. Need two for loops for the array.

2. Need to define the spline function (No idea how to in matlab).

3. Need to use the meshgrid and surf command to create the plot in the 1,3 x 1,3 domain.

#### Attachments

Last edited: