Docsity

Image Processing Part 2-Computer Graphics-Lecture Slides, Slides of Computer Graphics

Partial preview of the text

Download Image Processing Part 2-Computer Graphics-Lecture Slides and more Slides Computer Graphics in PDF only on Docsity!

Computer GraphicsLecture 16: Image Processing

Image Warping  Move pixels of image^ ^ Mapping^ ^ Resampling

Warp Source Image

Destination Image

Mapping^ ^ Define transformation^ ^ Describe the destination (x, y) for every location (u, v) in thesource (or vice-versa, if invertible)

u v

x y

Example Mappings^ ^ Scale by

factor :  x =factor * u  y =factor * v

Scale0.8 u v

x y

Example Mappings^ ^ Shear in X by

factor :

^ x = u +

factor * v

^ y = v  Shear in Y by

factor :

^ x = u ^ y = v +

factor * u

Shear X1.3 u v

x y Shear Y1.3 u v

x y

docsity.com

Other Mappings^ ^ Any function of u and v :^ ^ x = f

(u, v)x  y = f(u, v)y (^) Fish-eye^

Swirl^

Rain

Forwarding Mapping^ ^ Iterate over source image

Rotate-30 u

v

x

y

Forwarding Mapping

–^ NOT

^ Iterate over source image

Rotate-30 u

v

x

y

Many source pixelscan map to samedestination pixel

Image Warping ImplementationII  Reverse mapping

for(int

x=0;^

x<xmax;

x++)^

for(int

y=0;^

y<ymax;

y++)^

float^

-1u = f x (x,y); float^

-1v = f y (x,y); dst(x,y)

=^ src(u,v); } } Source Image

Destination Image

(u, v)^

(x, y) f

docsity.com

Resampling

^ Evaluate source image at arbitrary (u, v)

(u, v) does not usuallyhave integer coordinates

Source Image

Destination Image

(u, v)^

(x, y)

Triangle Filtering^ ^ Convolve with triangle filter

Input^

Output

Triangle Filtering^ ^ Bilinearly interpolate four closest pixels^ ^ a = linear interpolation of src(u

, v) and src(u 12

, v) 22

^ b = linear interpolation of src(u

, v) and src(u 11

, v) 21

^ dst(x, y) = linear interpolation of

“a”^ and^

“b”

(u^ , v)^12 (u^ , v)^11

(u^ , v)^22 (u^ , v)^21 a (u, v) b

Gaussian Filtering^ ^ Compute weighted sum of pixel neighborhood :^ ^ Weights are normalized values of Gaussian function

(u, v)

Filtering Methods Comparison^ ^ Trade-offs^ ^ Aliasing versus blurring^ ^ Computation speed

Point^

Gaussian