27
Image Processing Jung Lee

Image Processingkucg.korea.ac.kr/.../CNCE340/tutor/14image_processing.pdf · 2002-01-16 · Image Resolution • Intensity Resolution Each pixel has only “Depth” bits for colors/intensities

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Image Processingkucg.korea.ac.kr/.../CNCE340/tutor/14image_processing.pdf · 2002-01-16 · Image Resolution • Intensity Resolution Each pixel has only “Depth” bits for colors/intensities

Image Processing

Jung Lee

Page 2: Image Processingkucg.korea.ac.kr/.../CNCE340/tutor/14image_processing.pdf · 2002-01-16 · Image Resolution • Intensity Resolution Each pixel has only “Depth” bits for colors/intensities

Korea University Computer Graphics Lab.

Jung Lee | September 26, 2012 | # 2 KUCG |

What is an Image?

• An image is a 2D rectilinear array of pixels

[Continuous Image] [Digital Image]

Page 3: Image Processingkucg.korea.ac.kr/.../CNCE340/tutor/14image_processing.pdf · 2002-01-16 · Image Resolution • Intensity Resolution Each pixel has only “Depth” bits for colors/intensities

Korea University Computer Graphics Lab.

Jung Lee | September 26, 2012 | # 3 KUCG |

Quantization

• Artifact due to the limited intensity resolution

Frame buffers have limited number of bits per pixel

Physical devices have limited dynamic range

255 150 75 0

255 150 75 0

255 150 75 0

255 150 75 0

255 150 75 0

255 150 75 0

255 150 75 0

255 150 75 0

255 150 75 0

255 150 75 0

255 150 75 0

255 150 75 0

255 150 75 0

255 150 75 0

255 150 75 0

Blue Channel

Green Channel

Red Channel

Page 4: Image Processingkucg.korea.ac.kr/.../CNCE340/tutor/14image_processing.pdf · 2002-01-16 · Image Resolution • Intensity Resolution Each pixel has only “Depth” bits for colors/intensities

Korea University Computer Graphics Lab.

Jung Lee | September 26, 2012 | # 4 KUCG |

Image Resolution

• Intensity Resolution

Each pixel has only “Depth” bits for colors/intensities

• Spatial Resolution

Image has only “Width” x “Height” pixels

• Temporal Resolution

Monitor refreshes images at only “Rate” Hz

Page 5: Image Processingkucg.korea.ac.kr/.../CNCE340/tutor/14image_processing.pdf · 2002-01-16 · Image Resolution • Intensity Resolution Each pixel has only “Depth” bits for colors/intensities

Image Processing Operations

Brightness

Contrast

Blurring

Edge Detection

Page 6: Image Processingkucg.korea.ac.kr/.../CNCE340/tutor/14image_processing.pdf · 2002-01-16 · Image Resolution • Intensity Resolution Each pixel has only “Depth” bits for colors/intensities

Korea University Computer Graphics Lab.

Jung Lee | September 26, 2012 | # 6 KUCG |

Brightness Control

• Simply scale pixel components

Luminance = 0.30xR + 0.59xG + 0.11xB

Must clamp to range (e.g., 0 to 255)

Page 7: Image Processingkucg.korea.ac.kr/.../CNCE340/tutor/14image_processing.pdf · 2002-01-16 · Image Resolution • Intensity Resolution Each pixel has only “Depth” bits for colors/intensities

Korea University Computer Graphics Lab.

Jung Lee | September 26, 2012 | # 7 KUCG |

Contrast Control

• Compute mean luminance L for all pixels

• Scale deviation from L for each pixel component

Must clamp to range (e.g. 0 to 255)

Page 8: Image Processingkucg.korea.ac.kr/.../CNCE340/tutor/14image_processing.pdf · 2002-01-16 · Image Resolution • Intensity Resolution Each pixel has only “Depth” bits for colors/intensities

Korea University Computer Graphics Lab.

Jung Lee | September 26, 2012 | # 8 KUCG |

Blurring

• A kind of image filtering techniques

Each pixel gets a weighted average of its neighbors

• By the given filter

161

162

161

162

164

162

161

162

161

Filter

Page 9: Image Processingkucg.korea.ac.kr/.../CNCE340/tutor/14image_processing.pdf · 2002-01-16 · Image Resolution • Intensity Resolution Each pixel has only “Depth” bits for colors/intensities

Korea University Computer Graphics Lab.

Jung Lee | September 26, 2012 | # 9 KUCG |

Edge Detection

• A kind of image filtering techniques

Finds differences between neighbor pixels

111

181

111

Filter

Page 10: Image Processingkucg.korea.ac.kr/.../CNCE340/tutor/14image_processing.pdf · 2002-01-16 · Image Resolution • Intensity Resolution Each pixel has only “Depth” bits for colors/intensities

Image Warping

Page 11: Image Processingkucg.korea.ac.kr/.../CNCE340/tutor/14image_processing.pdf · 2002-01-16 · Image Resolution • Intensity Resolution Each pixel has only “Depth” bits for colors/intensities

Korea University Computer Graphics Lab.

Jung Lee | September 26, 2012 | # 11 KUCG |

Image Warping

• Move pixels of image

Mapping

Resampling

Warp

Page 12: Image Processingkucg.korea.ac.kr/.../CNCE340/tutor/14image_processing.pdf · 2002-01-16 · Image Resolution • Intensity Resolution Each pixel has only “Depth” bits for colors/intensities

Korea University Computer Graphics Lab.

Jung Lee | September 26, 2012 | # 12 KUCG |

cf.) Image Morphing

• Transition effect between two images

[‘Black or White’, Michael Jackson, 1992]

Page 13: Image Processingkucg.korea.ac.kr/.../CNCE340/tutor/14image_processing.pdf · 2002-01-16 · Image Resolution • Intensity Resolution Each pixel has only “Depth” bits for colors/intensities

Korea University Computer Graphics Lab.

Jung Lee | September 26, 2012 | # 13 KUCG |

Image Warping Overview

• Mapping

Forward

Reverse

• Resampling

Point sampling

Bilinear interpolation

Gaussian filter

Page 14: Image Processingkucg.korea.ac.kr/.../CNCE340/tutor/14image_processing.pdf · 2002-01-16 · Image Resolution • Intensity Resolution Each pixel has only “Depth” bits for colors/intensities

Korea University Computer Graphics Lab.

Jung Lee | September 26, 2012 | # 14 KUCG |

Mapping

• Define the transformation of pixels

Describe the destination (x, y) for every location (u, v) in

the source

• Or vice-versa, if invertible

u

v

x

y

Page 15: Image Processingkucg.korea.ac.kr/.../CNCE340/tutor/14image_processing.pdf · 2002-01-16 · Image Resolution • Intensity Resolution Each pixel has only “Depth” bits for colors/intensities

Korea University Computer Graphics Lab.

Jung Lee | September 26, 2012 | # 15 KUCG |

Mapping Example : Scaling

• Scale by factor :

x = factor * u

y = factor * v

u

v

x

y

Scale (0.8)

Page 16: Image Processingkucg.korea.ac.kr/.../CNCE340/tutor/14image_processing.pdf · 2002-01-16 · Image Resolution • Intensity Resolution Each pixel has only “Depth” bits for colors/intensities

Korea University Computer Graphics Lab.

Jung Lee | September 26, 2012 | # 16 KUCG |

• Rotate by θ degrees:

x = u cos θ – v sin θ

y = u sin θ + v cos θ

Mapping Example : Rotation

u

v

x

y

Rotate (30)

Page 17: Image Processingkucg.korea.ac.kr/.../CNCE340/tutor/14image_processing.pdf · 2002-01-16 · Image Resolution • Intensity Resolution Each pixel has only “Depth” bits for colors/intensities

Korea University Computer Graphics Lab.

Jung Lee | September 26, 2012 | # 17 KUCG |

Other Mapping Examples

[Fish Eye] [Swirl] [Rain]

Page 18: Image Processingkucg.korea.ac.kr/.../CNCE340/tutor/14image_processing.pdf · 2002-01-16 · Image Resolution • Intensity Resolution Each pixel has only “Depth” bits for colors/intensities

Korea University Computer Graphics Lab.

Jung Lee | September 26, 2012 | # 18 KUCG |

• Just assign the color of (u, v) to the (x, y)

(x, y) = f(u, v)

Forward Mapping Overview

[Source Image] [Destination Image]

(x, y)

f

(u, v)

Page 19: Image Processingkucg.korea.ac.kr/.../CNCE340/tutor/14image_processing.pdf · 2002-01-16 · Image Resolution • Intensity Resolution Each pixel has only “Depth” bits for colors/intensities

Korea University Computer Graphics Lab.

Jung Lee | September 26, 2012 | # 19 KUCG |

Artifacts of Forward Mapping

Rotate (30)

u

v

x

y

Many source pixels might be mapped to the same destination pixel

Some destination pixels might not be mapped by any source pixel

Page 20: Image Processingkucg.korea.ac.kr/.../CNCE340/tutor/14image_processing.pdf · 2002-01-16 · Image Resolution • Intensity Resolution Each pixel has only “Depth” bits for colors/intensities

Korea University Computer Graphics Lab.

Jung Lee | September 26, 2012 | # 20 KUCG |

• Based on pixels of the destination image

Not the source image

(u, v) = f-1(x, y)

Reverse Mapping Overview

[Source Image] [Destination Image]

(x, y)

f-1

(u, v)

Page 21: Image Processingkucg.korea.ac.kr/.../CNCE340/tutor/14image_processing.pdf · 2002-01-16 · Image Resolution • Intensity Resolution Each pixel has only “Depth” bits for colors/intensities

Korea University Computer Graphics Lab.

Jung Lee | September 26, 2012 | # 21 KUCG |

Effect of Reverse Mapping

• Many destination pixels might be still mapped to

the same source pixel

But no holes in the destination image

u

v

x

y

Rotate (30)

Page 22: Image Processingkucg.korea.ac.kr/.../CNCE340/tutor/14image_processing.pdf · 2002-01-16 · Image Resolution • Intensity Resolution Each pixel has only “Depth” bits for colors/intensities

Korea University Computer Graphics Lab.

Jung Lee | September 26, 2012 | # 22 KUCG |

Image Warping Overview

• Mapping

Forward

Reverse

• Resampling

Point sampling

Bilinear interpolation

Gaussian filter

Page 23: Image Processingkucg.korea.ac.kr/.../CNCE340/tutor/14image_processing.pdf · 2002-01-16 · Image Resolution • Intensity Resolution Each pixel has only “Depth” bits for colors/intensities

Korea University Computer Graphics Lab.

Jung Lee | September 26, 2012 | # 23 KUCG |

Point Sampling

• Take value of the nearest pixel from (x, y)

• Simple but causes aliasing

u

v

x

y

Rotate (30)

Page 24: Image Processingkucg.korea.ac.kr/.../CNCE340/tutor/14image_processing.pdf · 2002-01-16 · Image Resolution • Intensity Resolution Each pixel has only “Depth” bits for colors/intensities

Korea University Computer Graphics Lab.

Jung Lee | September 26, 2012 | # 24 KUCG |

• So called stairstep effect

Aliasing from Point Sampling

Page 25: Image Processingkucg.korea.ac.kr/.../CNCE340/tutor/14image_processing.pdf · 2002-01-16 · Image Resolution • Intensity Resolution Each pixel has only “Depth” bits for colors/intensities

Korea University Computer Graphics Lab.

Jung Lee | September 26, 2012 | # 25 KUCG |

Bilinear Interpolation

• Bilinearly interpolate four closest pixels

a = linear interpolation of src(u1, v2) and src(u2, v2)

b = linear interpolation of src(u1, v1) and src(u2, v1)

dest(x, y) = linear interpolation of ‘a’ and ‘b’

(u1, v2)

(u1, v1)

(u2, v2)

(u2, v1)

a

b

(u, v)

Page 26: Image Processingkucg.korea.ac.kr/.../CNCE340/tutor/14image_processing.pdf · 2002-01-16 · Image Resolution • Intensity Resolution Each pixel has only “Depth” bits for colors/intensities

Korea University Computer Graphics Lab.

Jung Lee | September 26, 2012 | # 26 KUCG |

Gaussian Filtering

• Compute weighted sum of the neighbor pixels

Weights are normalized values from Gaussian filter

(u, v)

Page 27: Image Processingkucg.korea.ac.kr/.../CNCE340/tutor/14image_processing.pdf · 2002-01-16 · Image Resolution • Intensity Resolution Each pixel has only “Depth” bits for colors/intensities

Korea University Computer Graphics Lab.

Jung Lee | September 26, 2012 | # 27 KUCG |

Comparison of Filtering Methods

• Trade-offs

Aliasing vs. blurring

Computational cost

[Point Sampling] [Bilinear Interpolation] [Gaussian Filtering]