Docsity

Image Resizing: Linear Mapping and Interpolation for Pixel Values - Prof. Shawn Newsam, Assignments of Computer Science

Toggle sidebar
bg1
Homework #2
Due Wed. 10/15 by midnight
(submit under my office door, by email, or to the TA in lab)
1. Problem 2.11 in the text.
2. Problem 2.15 in the text.
3. Problem 2.18 in the text.
4. Problem 2.19 in the text.
5. This problem will help with your project on image resizing.
Geometric transformations of an image, such as resizing, produce images whose pixels typically
don’t align with pixels in the original image. This raises the question of what values to assign to
the pixels in the transformed image. This can be accomplished using interpolation. Most
interpolation approaches estimate the pixel values in the transformed image using the values of
the “closest” pixels in the original image.
Note that rethinking the transformation helps with solving this problem. All we really want are
the pixel values in the transformed image. So, rather than computing where the pixels in the
original image are mapped to, such as in the diagram below,
is mapped to
⋅ ⋅
⋅
⋅
x
°
xx
we know the
values at pixels
marked by ·
we seek the values
at pixels marked
by x
⋅ ⋅
⋅
⋅
x x x
resize
⋅ ⋅
⋅
⋅
x x x
x x x
x x x
original transformed
we instead compute where the pixels in the transformed image are mapped from, as in the
diagram below,
is mapped from
⋅ ⋅
⋅
⋅
x
xx
°
we know the
values at pixels
marked by ·
we seek the values
at pixels marked
by x
⋅ ⋅
⋅
⋅
x
xx
resize
⋅ ⋅
⋅
⋅
x
xx
x
xx
x
xx
original transformed
pf3

Partial preview of the text

Download Image Resizing: Linear Mapping and Interpolation for Pixel Values - Prof. Shawn Newsam and more Assignments Computer Science in PDF only on Docsity!

Homework

Due Wed. 10/15 by midnight

(submit under my office door, by email, or to the TA in lab)

  1. Problem 2.11 in the text.
  2. Problem 2.15 in the text.
  3. Problem 2.18 in the text.
  4. Problem 2.19 in the text.
  5. This problem will help with your project on image resizing.

Geometric transformations of an image, such as resizing, produce images whose pixels typically don’t align with pixels in the original image. This raises the question of what values to assign to the pixels in the transformed image. This can be accomplished using interpolation. Most interpolation approaches estimate the pixel values in the transformed image using the values of the “closest” pixels in the original image.

Note that rethinking the transformation helps with solving this problem. All we really want are the pixel values in the transformed image. So, rather than computing where the pixels in the original image are mapped to, such as in the diagram below,

is mapped to

⋅ ⋅ ⋅ ⋅ ° x x^ x

we know the values at pixels marked by ·

we seek the values at pixels marked

⋅ ⋅ ⋅ ⋅ by x

resize x^ x^ x

⋅ ⋅ ⋅ ⋅ x^ x^ x

x x x

x x x

original transformed

we instead compute where the pixels in the transformed image are mapped from, as in the diagram below,

is mapped from

⋅ ° ⋅ ⋅ ⋅ x^ x x

we know the values at pixels marked by ·

we seek the values at pixels marked

⋅ ⋅ ⋅ ⋅ by x

resize x^ x x

⋅ ⋅ ⋅ ⋅ x^ x x

x x x

x x x

original transformed

Thus, we actually perform the inverse mapping.

Once we have computed where the pixel is mapped from, we can use the values of surrounding pixels in the original image (whose values we know) to estimate the value of the pixel in the transformed image. Nearest neighbor interpolation uses the value of the closest pixel. Bilinear interpolation uses the values of the four closest pixels. In this problem, you will explore how to determine these pixels.

To simplify the problem, we will work in 1D. Instead of determining the closest pixels in an image, we will only consider the closest pixels in an array. The extension to 2D is straightforward. We will also only consider resizing as the geometric transformation.

We will model a 1D M pixel “image” as follows

pixel boundaries pixel locations

1 2 3 M

0.5 1.0 1.5 2.0 2.5 3.0 3.5 M-0.5 M M+0.

image boundary

Now, the inverse mapping of a pixel in a transformed image of size M’ to an original image of size M can be viewed as follows

original 1 2 3 … M

x

m’ (^) M’ 1 2 … …

0.5 1.0 1.5 2.0 2.5 3.0 3.5 M-0.5 M M+0.

0.5 1.0 1.5 2.0 2.5 m’ M’-0.5 M’ M’+0.

transformed