You are on page 1of 3

SUBMITTING BY: SUMMRA AROOJ (CIIT/FA14/BCE/022/ATK)

SUBMITTING TO: ENGR.FAYYAZ

COURSE: Digital Image Processing

LAB NUMBER#05

POST LAB TASK

“GEOMETRIC TRANFORMATION”

TASK#01: Write the generalized function for two methods like nearest neighbor
interpolation and bilinear interpolation code in MATLAB?
Objective:
1.To understand nearest neighbor interpolation.
2.To understand bilinear interpolation.
Mathematical Steps:
The assign value is taken from the pixel closest to the generated loaction:

The closest neighbor is chossen, by rounding the “new” indexes to original image’s coordinates.As
shown below:

Let the image as shown below:


Resulted nearest neighbors interpolation is:

Flow Chart:

Code:
Result:

By entering the scaling factor 2 one row and one column is inserted replace that pixels By nearest
neighbor and bilinear(By taking averge of neighbors ).If you enter choice 1 then nearest neighbor
is implement and if choice is 2 then bilinear is implemented.First fill the columns and then rows.e.g
If choice is 1 the simple replicate the neighbor as shown above.If choice is 2 the taking average of
neighbors as shown above.
(1+2)/2=1.5 & (1+6)?2=3.5 similarly this done with all inserted pixels and obtained the above
results.

You might also like