+ All Categories
Home > Documents > IMAGE PROCESSING: GEOMETRIC OPERATIONSreeves.csc.ncsu.edu/.../image-processing-geometric.pdf ·...

IMAGE PROCESSING: GEOMETRIC OPERATIONSreeves.csc.ncsu.edu/.../image-processing-geometric.pdf ·...

Date post: 16-Oct-2020
Category:
Upload: others
View: 5 times
Download: 0 times
Share this document with a friend
25
IMAGE PROCESSING: GEOMETRIC OPERATIONS N. C. State University CSC557 Multimedia Computing and Networking Fall 2001 Lecture # 12
Transcript
Page 1: IMAGE PROCESSING: GEOMETRIC OPERATIONSreeves.csc.ncsu.edu/.../image-processing-geometric.pdf · IMAGE PROCESSING: GEOMETRIC OPERATIONS N. C. State University CSC557 ♦Multimedia

IMAGE PROCESSING: GEOMETRIC OPERATIONS

N. C. State University

CSC557 ♦ Multimedia Computing and Networking

Fall 2001

Lecture # 12

Page 2: IMAGE PROCESSING: GEOMETRIC OPERATIONSreeves.csc.ncsu.edu/.../image-processing-geometric.pdf · IMAGE PROCESSING: GEOMETRIC OPERATIONS N. C. State University CSC557 ♦Multimedia

2Copyright 2001 Douglas S. Reeves (http://reeves.csc.ncsu.edu)

Geometric Operations

• Affine transformations

— rotation

— translation

— scaling

• Other transformations— mirroring

— perspective

— warping

Page 3: IMAGE PROCESSING: GEOMETRIC OPERATIONSreeves.csc.ncsu.edu/.../image-processing-geometric.pdf · IMAGE PROCESSING: GEOMETRIC OPERATIONS N. C. State University CSC557 ♦Multimedia

3Copyright 2001 Douglas S. Reeves (http://reeves.csc.ncsu.edu)

Forward Vs. Inverse Mapping

• Output pixels Q and input pixels P— with dimensions MQ x NQ and MP x NP

• Pixel (0,0) is the upper-left-hand corner

Page 4: IMAGE PROCESSING: GEOMETRIC OPERATIONSreeves.csc.ncsu.edu/.../image-processing-geometric.pdf · IMAGE PROCESSING: GEOMETRIC OPERATIONS N. C. State University CSC557 ♦Multimedia

4Copyright 2001 Douglas S. Reeves (http://reeves.csc.ncsu.edu)

Mapping (cont’d)

• Forward mapping: to what output pixel does an input pixel map?— problem: potential for "holes”

— ex: output pixel i,j may not have any input pixel mapped to it

• Inverse mapping: from what input pixel (P) does an output pixel (Q) map?— problem: non-integer input pixel boundaries (interpolation

needed)

— ex: output pixel i,j maps from input pixel at position 20.6,100.8

Page 5: IMAGE PROCESSING: GEOMETRIC OPERATIONSreeves.csc.ncsu.edu/.../image-processing-geometric.pdf · IMAGE PROCESSING: GEOMETRIC OPERATIONS N. C. State University CSC557 ♦Multimedia

5Copyright 2001 Douglas S. Reeves (http://reeves.csc.ncsu.edu)

Forward Vs. Inverse Pixel Mapping

(0,0)

(0,1)

(1,0)

(1,1)

(0,0)

(0,2)

(2,0)

(2,2)

(0,0)

(0,1)

(1,0)

(1,1)

(0,0)

(0,2)

(2,0)

(0,1)

(0,3)

(1,0) (3,0)

(2,1)(1,1) (3,1)

(2,2)(1,2) (3,2)

(2,3)(1,3) (3,3)

???

? ?

?

?

?

Page 6: IMAGE PROCESSING: GEOMETRIC OPERATIONSreeves.csc.ncsu.edu/.../image-processing-geometric.pdf · IMAGE PROCESSING: GEOMETRIC OPERATIONS N. C. State University CSC557 ♦Multimedia

6Copyright 2001 Douglas S. Reeves (http://reeves.csc.ncsu.edu)Pixel Interpolation (Dealing with Fractional Pixel Boundaries)

• Nearest-neighbor interpolation— e.g., just use the value from the nearest pixel

• Bi-linear interpolation (see next slide)

• Higher-order interpolation (not covering)

Page 7: IMAGE PROCESSING: GEOMETRIC OPERATIONSreeves.csc.ncsu.edu/.../image-processing-geometric.pdf · IMAGE PROCESSING: GEOMETRIC OPERATIONS N. C. State University CSC557 ♦Multimedia

7Copyright 2001 Douglas S. Reeves (http://reeves.csc.ncsu.edu)

Interpolation Example

ORIGINAL INPUTBi-linear Interpolation

Bi-cubic Interpolation Nearest Neighbor Interpolation

Page 8: IMAGE PROCESSING: GEOMETRIC OPERATIONSreeves.csc.ncsu.edu/.../image-processing-geometric.pdf · IMAGE PROCESSING: GEOMETRIC OPERATIONS N. C. State University CSC557 ♦Multimedia

8Copyright 2001 Douglas S. Reeves (http://reeves.csc.ncsu.edu)

Bilinear Interpolation Algorithm

1. Given nwpixel, nepixel, swpixel, sepixel, inx, iny; example: nwpixel=(2,5), nepixel=(3,5) swpixel=(2,6), sepixel=(3,6)

2. ewweight = inx - inx ; example: 2.7 – 2 = .7

3. nsweight = iny - iny ; example: 5.2 – 5 = .2

4. northval = nwpixel + ewweight*(nepixel-nwpixel)5. southval = swpixel + ewweight*(sepixel-swpixel)

6. Output pixel value = northval + nsweight*(southval-northval)

Page 9: IMAGE PROCESSING: GEOMETRIC OPERATIONSreeves.csc.ncsu.edu/.../image-processing-geometric.pdf · IMAGE PROCESSING: GEOMETRIC OPERATIONS N. C. State University CSC557 ♦Multimedia

9Copyright 2001 Douglas S. Reeves (http://reeves.csc.ncsu.edu)

Bilinear Interpolation Example

(northval)(southval)

(output pixel value)

Page 10: IMAGE PROCESSING: GEOMETRIC OPERATIONSreeves.csc.ncsu.edu/.../image-processing-geometric.pdf · IMAGE PROCESSING: GEOMETRIC OPERATIONS N. C. State University CSC557 ♦Multimedia

10Copyright 2001 Douglas S. Reeves (http://reeves.csc.ncsu.edu)

Translation (Move)

• Move a portion of the image to a new location— fill “vacated” region with solid color?

• q(x, y) = p(x - ∆x, y - ∆y)— use bilinear interpolation when ∆x,∆y are not integers

— ∆x > 0 means move to the right, ∆y >0 moves move down

Page 11: IMAGE PROCESSING: GEOMETRIC OPERATIONSreeves.csc.ncsu.edu/.../image-processing-geometric.pdf · IMAGE PROCESSING: GEOMETRIC OPERATIONS N. C. State University CSC557 ♦Multimedia

11Copyright 2001 Douglas S. Reeves (http://reeves.csc.ncsu.edu)

Translation (cont’d)

• If ∆x and ∆y are allowed to vary, results in a distortion effect— The set of ∆x and ∆y values are expressed in a translation map

(same size as image)

• When translation is combined with mixing, the result is a smearing effect

Page 12: IMAGE PROCESSING: GEOMETRIC OPERATIONSreeves.csc.ncsu.edu/.../image-processing-geometric.pdf · IMAGE PROCESSING: GEOMETRIC OPERATIONS N. C. State University CSC557 ♦Multimedia

12Copyright 2001 Douglas S. Reeves (http://reeves.csc.ncsu.edu)

Translation / Distortion Examples

Original

Windy Ripple

Frosted Glass

Page 13: IMAGE PROCESSING: GEOMETRIC OPERATIONSreeves.csc.ncsu.edu/.../image-processing-geometric.pdf · IMAGE PROCESSING: GEOMETRIC OPERATIONS N. C. State University CSC557 ♦Multimedia

13Copyright 2001 Douglas S. Reeves (http://reeves.csc.ncsu.edu)

Scaling (Resizing)

• Scale factors α and β— Mq = Mp*α, Nq = NP*β

— to preserve aspect ratio, make α = β

• q(x,y) = p(x/α, y/β)

Page 14: IMAGE PROCESSING: GEOMETRIC OPERATIONSreeves.csc.ncsu.edu/.../image-processing-geometric.pdf · IMAGE PROCESSING: GEOMETRIC OPERATIONS N. C. State University CSC557 ♦Multimedia

14Copyright 2001 Douglas S. Reeves (http://reeves.csc.ncsu.edu)

RESIZING/SCALING EXAMPLE

Page 15: IMAGE PROCESSING: GEOMETRIC OPERATIONSreeves.csc.ncsu.edu/.../image-processing-geometric.pdf · IMAGE PROCESSING: GEOMETRIC OPERATIONS N. C. State University CSC557 ♦Multimedia

15Copyright 2001 Douglas S. Reeves (http://reeves.csc.ncsu.edu)

Rotation

• Given— rotation angle φ (measured as angle from dest source)

— center of rotation pixel (xcenter, ycenter)

• Notes— If outside the input range, fill with solid color

— May need to adjust image size also (MQ and NQ)

— If φ is a multiple of 90º, just transpose the pixel values instead

Xsource = xcenter + (x-xcenter)*cos(φ) + (y-ycenter)*sin(φ)Ysource = ycenter + (y-ycenter)*cos(φ) - (x-xcenter)*sin(φ)q(x,y) = p(xsource, ysource) ; interpolation may be needed

Page 16: IMAGE PROCESSING: GEOMETRIC OPERATIONSreeves.csc.ncsu.edu/.../image-processing-geometric.pdf · IMAGE PROCESSING: GEOMETRIC OPERATIONS N. C. State University CSC557 ♦Multimedia

16Copyright 2001 Douglas S. Reeves (http://reeves.csc.ncsu.edu)

Rotation Example

xcenter = 80, ycenter = 130, φ = 30°

pixel to be mapped is q(x,y) = q(50,170)

xsource = 80 + (50-80) * cos(30°) + (170-130) * sin(30°) = 80 – 26.0 + 20.0 = 74.0

ysource = 130 + (170-130) * cos(30°) – (50-80) * sin(30°) = 130 + 34.64 + 15 = 179.64

0,0

Center = (80,130)

Input p(xsource,ysource) = (74.0,179.64)

Output q(50,170) 30°

Page 17: IMAGE PROCESSING: GEOMETRIC OPERATIONSreeves.csc.ncsu.edu/.../image-processing-geometric.pdf · IMAGE PROCESSING: GEOMETRIC OPERATIONS N. C. State University CSC557 ♦Multimedia

17Copyright 2001 Douglas S. Reeves (http://reeves.csc.ncsu.edu)

Rotation Example

Page 18: IMAGE PROCESSING: GEOMETRIC OPERATIONSreeves.csc.ncsu.edu/.../image-processing-geometric.pdf · IMAGE PROCESSING: GEOMETRIC OPERATIONS N. C. State University CSC557 ♦Multimedia

18Copyright 2001 Douglas S. Reeves (http://reeves.csc.ncsu.edu)

Mirroring (Flipping)

• Simple exchange of pixels located symmetrically about X median value or Y median value

Page 19: IMAGE PROCESSING: GEOMETRIC OPERATIONSreeves.csc.ncsu.edu/.../image-processing-geometric.pdf · IMAGE PROCESSING: GEOMETRIC OPERATIONS N. C. State University CSC557 ♦Multimedia

19Copyright 2001 Douglas S. Reeves (http://reeves.csc.ncsu.edu)

Mirroring Example

Page 20: IMAGE PROCESSING: GEOMETRIC OPERATIONSreeves.csc.ncsu.edu/.../image-processing-geometric.pdf · IMAGE PROCESSING: GEOMETRIC OPERATIONS N. C. State University CSC557 ♦Multimedia

20Copyright 2001 Douglas S. Reeves (http://reeves.csc.ncsu.edu)

Warp Example

Page 21: IMAGE PROCESSING: GEOMETRIC OPERATIONSreeves.csc.ncsu.edu/.../image-processing-geometric.pdf · IMAGE PROCESSING: GEOMETRIC OPERATIONS N. C. State University CSC557 ♦Multimedia

21Copyright 2001 Douglas S. Reeves (http://reeves.csc.ncsu.edu)

Warping

Page 22: IMAGE PROCESSING: GEOMETRIC OPERATIONSreeves.csc.ncsu.edu/.../image-processing-geometric.pdf · IMAGE PROCESSING: GEOMETRIC OPERATIONS N. C. State University CSC557 ♦Multimedia

22Copyright 2001 Douglas S. Reeves (http://reeves.csc.ncsu.edu)

Warp (Distort) Example

Page 23: IMAGE PROCESSING: GEOMETRIC OPERATIONSreeves.csc.ncsu.edu/.../image-processing-geometric.pdf · IMAGE PROCESSING: GEOMETRIC OPERATIONS N. C. State University CSC557 ♦Multimedia

23Copyright 2001 Douglas S. Reeves (http://reeves.csc.ncsu.edu)

Morphing

• Movie showing transformation from one object or shape, into another

• Combination of warping and fading

• Fading may be non-linear, or applied selectively to objects

Page 24: IMAGE PROCESSING: GEOMETRIC OPERATIONSreeves.csc.ncsu.edu/.../image-processing-geometric.pdf · IMAGE PROCESSING: GEOMETRIC OPERATIONS N. C. State University CSC557 ♦Multimedia

24Copyright 2001 Douglas S. Reeves (http://reeves.csc.ncsu.edu)

Morphing Example

Page 25: IMAGE PROCESSING: GEOMETRIC OPERATIONSreeves.csc.ncsu.edu/.../image-processing-geometric.pdf · IMAGE PROCESSING: GEOMETRIC OPERATIONS N. C. State University CSC557 ♦Multimedia

25Copyright 2001 Douglas S. Reeves (http://reeves.csc.ncsu.edu)

Sources Of Info

• [Crane97] A Simplified Approach to Image Processing— Chapter 4

— Part of Chapter 8

• [Watkins93] Modern Image Processing: Warping, Morphing, and Classical Techniques


Recommended