Docsity

Digital Image Interpolation, Lecture notes of Digital Image Processing

Toggle sidebar
bg1
1
Digital Image interpolation
It happens anytime you resize or remap (distort) your image from one pixel grid to another without distorting
edges and contours. Image resizing is necessary when you need to increase or decrease the total number of pixels
(resolution of images). Actually, Even if the same image resize or remap is performed, the results can vary
significantly depending on the interpolation algorithm. It is only an approximation, therefore an image will
always lose some quality each time interpolation is performed.
Interpolation Algorithms
We use crop process to select a small portion of the image (sub image ) and cutting it away from the rest of the
image. After we cropped a sub image from the original image we can zoom in on it by enlarge it. The zoom
process can be done in numerous ways:
1. Pixel replication
A. Zero-Order hold: Is performed by repeating previous pixel values.
Example: if we have an image of size(n*n), we can zooming it using zero order method with size (2n)*(2n)
Interpolation used to
simplify data for
further processing
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13

Partial preview of the text

Download Digital Image Interpolation and more Lecture notes Digital Image Processing in PDF only on Docsity!

1

Digital Image interpolation

It happens anytime you resize or remap (distort) your image from one pixel grid to another without distorting

edges and contours. Image resizing is necessary when you need to increase or decrease the total number of pixels

(resolution of images). Actually, Even if the same image resize or remap is performed, the results can vary

significantly depending on the interpolation algorithm. It is only an approximation, therefore an image will

always lose some quality each time interpolation is performed.

Interpolation Algorithms

We use crop process to select a small portion of the image (sub image ) and cutting it away from the rest of the

image. After we cropped a sub image from the original image we can zoom in on it by enlarge it. The zoom

process can be done in numerous ways:

1. Pixel replication

A. Zero-Order hold: Is performed by repeating previous pixel values.

Example: if we have an image of size(nn), we can zooming it using zero order method with size ( 2 n)( 2 n)

Interpolation used to simplify data for further processing

2

REPEAT Rows REPEAT Colms 1 1 3 3 5 5 7 7 1 1 3 3 5 5 7 7 2 2 4 4 6 6 8 8 2 2 4 4 6 6 8 8 7 7 5 5 3 3 1 1 7 7 5 5 3 3 1 1 8 8 6 6 4 4 2 2 8 8 6 6 4 4 2 2 a-Original image b- cropped image c- zoomed image

Advantage and disadvantage:

One of the advantage of this zooming technique is , it is very simple.

You just have to copy the pixels and nothing else.

The disadvantage of this technique is that image got zoomed but the

output is very blurry. And as the zooming factor increased , the image

got more and more blurred. That would eventually result in fully

blurred image.

4 Original image cropped image zooming image This method allows us to enlarge an N×N sized image to a size of ( 2 N- 1 ) ×( 2 N- 1 ) and be repeated as desired.

We can implement the previous interpolation

methods by using Convolution: this method requires a

mathematical process to enlarge an image. This

method required two steps:

1. Extend the image by adding rows and

columns of zeros between the existing rows

and columns.

2. Perform the convolution. The image is

extended as follows:

Advantages and disadvantage. One of the advantage of this zooming technique , that it does not create as blurry

picture as compare to the zero order hold method. But it also has a disadvantage that it can only run on the

multiply by 2. if image dimensions equal to 3 x 3. Then you will zoom it again and you will get dimensions equal to

5 x 5. Now if you will do it again, you will get dimensions equal to 9 x 9 and so on.

Next, we use convolution mask, which is slide a cross the extended image, and perform simple

arithmetic operation at each pixel location

The convolution process requires us to overlay the mask on the image, multiply the coincident values and

sum all these results. This is equivalent to finding the vector inner product of the mask with underlying sub

image. The vector inner product is found by overlaying mask on sub image. Multiplying coincident terms,

and summing the resulting products. For example, if we put the mask over the upper-left corner of the

image, we obtain (from left to right, and top to bottom):

Note the existing image values do not change.

B. Move the mask one pixel to the right

, multiply coincident terms sum , and

place the new results into the buffer at

the location that corresponds to the new

center location of the convolution mask

which is now at (r,c)=( 2 , 3 ), continue to

the end of the row.

C Move the mask down on row and

repeat the process until the mask is

convolved with the entire image.

Note that we lose the outer row(s)

and columns(s).

Not only first-order hold be performed via convolution, but zero-order hold can also achieved by extending

the image with zeros and using the following convolution mask.

Note that for this mask we will need to put the result in the pixel location corresponding to the lower-right

corner because there is no center pixel.

Zero added 1 /^41 /^21 /^4 1 / 2 1 1 / 2 1 / 4 1 / 2 1 / 4 The mask

Example: Convolution

Resulted Image

13

As a result of this simplistic interpolation scheme, nearest neighbor doesn't have subpixel accuracy and generates

strong discontinuities, especially when arbitrary rotations and scale changes are involved. The only interesting

property of this algorithm is the fact that it preserves the original noise distribution in the transformed image,

which can be useful in some image analysis applications.

14 K-Times zooming: K times is a zooming method we are going to discuss. It is one of the most

perfect zooming algorithm discussed so far. It caters the challenges of both nearest neighbors and

pixel replication. K in this zooming algorithm stands for zooming factor.

It works like this way.

 First of all , you have to take two adjacent pixels as you did in the pixel repetition. Then you have to subtract

the smaller from the greater one.

 Divide the output with the zooming factor(K). We call this output (OP)

 Now you have to add the result (Op)to the smaller value and put the result in between those two values.

 Add the value OP again to the value you just put and place it again next to the previous putted value. You

have to do it till you place k- 1 values in it.

 sort the inserted values in ascending order , so there remains a symmetry between them

 Repeat the same step for all the rows and the columns , and you get a zoomed images.

For example: Suppose you have an image of 2 rows and 3 columns , which is given below. And you have to

zoom it three times.

K in this case is 3. K = 3.

The number of values that should be inserted is k- 1 = 3 - 1 = 2.

  1. K-Times zooming

The best way to calculate the formula for the dimensions of a new image is to compare the dimensions of the original image and the final image. The dimensions of the original image were 2 X 3. And the dimensions of the new image are 4 x 7. The formula thus is: (K *(number of rows - 1 ) + 1 ) X (K *(number of cols - 1 ) + 1 ) Advantages and disadvantages The one of the clear advantage that k time zooming algorithm has that it is able to compute zoom of any factor which was the power of pixel replication algorithm also it gives improved result (less blurry) which was the power of zero order hold method. So hence It comprises the power of the two algorithms. The only difficulty this algorithm has that it has to be sort in the end , which is an additional step , and thus increases the cost of computation.

A slightly more sophisticated interpolation method. Bilinear interpolation can be used where perfect image

transformation with pixel matching is impossible, so that one can calculate and assign appropriate intensity

values to pixels.

  1. Bilinear interpolation

Linear Interpolation Formula f(n)

a (^1) - a f(n+ 1 ) f(n+a) f(n+a)=( 1 - a)f(n)+a  f(n+ 1 ), 0 <a< 1 Example:- f(n)=[0,120,180,120,0] Numerical Examples 1 D Q : what is the interpolated value at f(n+a)?

In mathematics, bilinear interpolation is an extension of linear interpolation for interpolating functions of two

variables (e.g., x and y). Unlike other interpolation techniques such as nearest neighbor interpolation, bilinear

interpolation uses only the 4 nearest pixel values which are located in diagonal directions from a given pixel in

order to find the appropriate color intensity values of that pixel.

f(x)=[0,60,120,150,180,150,120,60,0], a=0.

As seen in the example on the right, the intensity value at the pixel computed to be at row 20.2, column 14.5 can be calculated by first linearly interpolating between the values at column 14 and 15 on each rows 20 and 21 , giving This algorithm reduces some of the visual distortion caused by resizing an image to a non-integral zoom factor, as opposed to nearest neighbor interpolation, which will make some pixels appear larger than others in the resized image.