62
EE 4780: Introduction to Computer Vision Introduction

EE 4780: Introduction to Computer Vision Introduction

Embed Size (px)

Citation preview

Page 1: EE 4780: Introduction to Computer Vision Introduction

EE 4780: Introduction to Computer Vision

Introduction

Page 2: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 2

EE 4780

Instructor: Bahadir K. Gunturk Office: EE 225 Email: [email protected] Tel: 8-5621 Office Hours: MW 10:00 – 12:00

Page 3: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 3

EE 4780

We will learn the fundamentals of digital image processing and computer vision.

Lecture slides, problems sets, solutions, study materials, etc. will be posted on the class website. [www.ece.lsu.edu/gunturk/EE4780]

Textbook is not required. References:

Gonzalez/Woods, Digital Image Processing, Prentice-Hall, 2/e. Forsyth/Ponce, Computer Vision: A Modern Approach, Prentice-Hall. Duda, Hart, and Stork, “Pattern Classification,” John Wiley&Sons, 2001. Shapiro/Stockman, Computer Vision, Prentice-Hall. Horn, “Robot Vision,” MIT Press, 1986.

Page 4: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 4

Grading Policy

Your grade will be based on Problem Sets: 30% Midterm: 30% Final: 40%

Problem Sets Mini projects: Theoretical problems and MATLAB assignments 4-5 Problem Sets Individually or in two-person teams

Page 5: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 5

Digital Image AcquisitionSensor array

When photons strike, electron-hole pairs are generated on sensor sites.

Electrons generated are collected over a certain period of time.

The number of electrons are converted to pixel values. (Pixel is short for picture element.)

Page 6: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 6

Digital Image Acquisition

Two types of quantization:1. There are finite number of

pixels. (Spatial resolution)2. The amplitude of pixel is

represented by a finite number of bits. (Gray-scale resolution)

Page 7: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 7

Digital Image Acquisition

Take a look at this cross section

Page 8: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 8

Digital Image Acquisition• 256x256 - Found on very cheap

cameras, this resolution is so low that the picture quality is almost always unacceptable. This is 65,000 total pixels.

• 640x480 - This is the low end on most "real" cameras. This resolution is ideal for e-mailing pictures or posting pictures on a Web site.

• 1216x912 - This is a "megapixel" image size -- 1,109,000 total pixels -- good for printing pictures.

• 1600x1200 - With almost 2 million total pixels, this is "high resolution." You can print a 4x5 inch print taken at this resolution with the same quality that you would get from a photo lab.

• 2240x1680 - Found on 4 megapixel cameras -- the current standard -- this allows even larger printed photos, with good quality for prints up to 16x20 inches.

• 4064x2704 - A top-of-the-line digital camera with 11.1 megapixels takes pictures at this resolution. At this setting, you can create 13.5x9 inch prints with no loss of picture quality.

Page 9: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 9

Image Resolution

Don’t confuse image size and resolution.

Page 10: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 10

Bit Depth – Grayscale Resolution

8 bits 7 bits

6 bits 5 bits

Page 11: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 11

Bit Depth – Grayscale Resolution

4 bits 3 bits2 bits 1 bit

Page 12: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 12

Matrix Representation of Images A digital image can be written as a matrix

1 2

[0,0] [0,1] [0, 1]

[1,0] [1,1] [1, 1][ , ]

[ 1,0] [ 1, 1]MxN

x x x N

x x x Nx n n

x M x M N

35 45 20

43 64 52

10 29 39

Page 13: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 13

Digital Color Images

1 2[ , ]Rx n n

1 2[ , ]Gx n n

1 2[ , ]Bx n n

Page 14: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 14

Color Displays

CRT

LCD

Polarize to control the amount of light passed.

Page 15: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 15

Video

= vertical position

= horizontal position

= frame number

1 2 3[ , , ]x n n n

1n

2n

3n

~24 frames per second.

Page 16: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 16

Why do we process images?

To facilitate their storage and transmission To prepare them for display or printing To enhance or restore them To extract information from them To hide information in them

Page 17: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 17

Image Processing Example

Image Restoration

Original image Blurred Restored by Wiener filter

Page 18: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 18

Image Processing Example

Noise Removal

Noisy image Denoised by Median filter

Page 19: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 19

Image Processing Example

Image Enhancement

Histogram equalization

Page 20: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 20

Image Processing Example Artifact Reduction in Digital Cameras

Original scene Captured by a digital camera

Processed to reduce artifacts

Page 21: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 21

Image Processing Example

Image Compression

Original image 64 KB

JPEG compressed 15 KB

JPEG compressed 9

KB

Page 22: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 22

Image Processing Example

Object Segmentation

“Rice” image Edges detected using Canny filter

Page 23: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 23

Image Processing Example

Resolution Enhancement

Page 24: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 24

Image Processing Example

Watermarking

Original image

Hidden message

Generate watermark

Watermarked image

Secret key

Page 25: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 25

Image Processing Example

Face Recognition

Surveillance video

Search in the database

Page 26: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 26

Image Processing Example

Fingerprint Matching

Page 27: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 27

Image Processing Example

Segmentation

Page 28: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 28

Image Processing Example

Texture Analysis and Synthesis

Pattern repeated Computer generated

Photo

Page 29: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 29

Image Processing Example

Face detection and tracking

http://www-2.cs.cmu.edu/~har/faces.html

Page 30: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 30

Image Processing Example

Face Tracking

Page 31: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 31

Image Processing Example

Object Tracking

Page 32: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 32

Image Processing Example

Virtual Controls

Page 33: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 33

Image Processing Example

Visually Guided Surgery

Page 34: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 34

Cameras

First camera was invented in 16th century. It used a pinhole to focus light rays onto a wall or

translucent plate.

Take a box, prick a small hole in one of its sides with a pin, and then replace the opposite side with a translucent plate.

Place a candle on the pinhole side, you will see an inverted image of the candle on the translucent plate.

Page 35: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 35

Perspective Projection

Perspective projection equations

' ' 'x y z

x y z

Page 36: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 36

Pinhole Camera Model If the pinhole were really reduced to a point, exactly one light ray would

pass through each point in the image plane. In reality, each point in the image place collects light from a cone of rays.

Page 37: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 37

Pinhole Cameras

Pinhole too big - many directions are averaged, blurring the image Pinhole too small - diffraction effects blur the image

Page 38: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 38

Cameras With Lenses

Most cameras are equipped with lenses. There are two main reasons for this:

To gather light. For an ideal pinhole, a single light ray would reach each point the image plane. Real pinholes have a finite size, so each point in the image plane is illuminated by a cone of light rays. The larger the hole, the wider the cone and the brighter the image => blurry pictures. Shrinking the pinhole produces sharper images, but reduces the amount of light and may introduce diffraction effects.

To keep the picture in sharp focus while gathering light from a large area.

Page 39: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 39

Compound Lens Systems

Page 40: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 40

Real Lenses

Rays may not focus at a single point.

Spherical aberration

Spherical aberration can be eliminated completely by designing aspherical lenses.

Page 41: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 41

Real Lenses

Chromatic aberration

The index of refraction is a function of wavelength. Light at different wavelengths follow different paths.

Page 42: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 42

Real Lenses

Chromatic Aberration

Page 43: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 43

Real Lenses Special lens systems using two or more pieces of glass with different

refractive indeces can reduce or eliminate this problem. However, not even these lens systems are completely perfect and still can lead to visible chromatic aberrations.

Page 44: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 44

Real Lenses Barrel Distortion & Pincushion Distortion

Stop (Aperture)

Causes of distortion

(normal)

Chief ray

Page 45: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 45

Real Lenses Barrel Distortion & Pincushion Distortion

Distorted Corrected

http://www.vanwalree.com/optics/distortion.htmlhttp://www.dpreview.com/learn/?/Image_Techniques/Barrel_Distortion_Correction_01.htm

Page 46: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 46

Real Lenses

Vignetting effect in a two-lens system. The shaded part of the beam never reaches the second lens. The brightness drop in the image perimeter.

Page 47: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 47

Real Lenses

Optical vignetting example. Left: f/1.4. Right: f/5.6.

f-number

focal length to diameter ratio

Page 48: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 48

Real Lenses

Long exposure time

Short exposure time

Page 49: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 49

Real Lenses

Flare

Hood may prevent flares

Page 50: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 50

Real Lenses

Flare

Page 51: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 51

Compound Lens Systems

http://www.dpreview.com/learn/?/glossary/http://www.cartage.org.lb/en/themes/Sciences/Physics/Optics/Optical/Lens/Lens.htmhttp://www.vanwalree.com/optics.html

Page 52: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 52

Digital Camera Pipeline

Auto-exposure algorithms measure brightness over discrete scene regions to compensate for overexposed or underexposed areas by manipulating shutter speed and/or aperture size. The net goals here are to maintain relative contrast between different regions in the image and to achieve a good overall quality.

(from Katz and Gentile)

Page 53: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 53

Digital Camera Pipeline

Auto-focus algorithms divide into two categories. Active methods use infrared or ultrasonic emitters/receivers to estimate the distance between the camera and the object being photographed. Passive methods, on the other hand, make focusing decisions based on the received image in the camera.

Page 54: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 54

Digital Camera Pipeline

Lens distortion correctionThis set of algorithms accounts for the physical properties of lenses that warp the output image compared to the actual scene the user is viewing. Different lenses can cause different distortions; for instance, wide-angle lenses create a "barrel distortion", while telephoto lenses create a "pincushion distortion“.

Page 55: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 55

Digital Camera Pipeline

Vignetting (shading distortion) reduces image brightness in the area around the lens. Chromatic aberration causes color fringes around an image. The media processor needs to mathematically transform the image in order to correct for these distortions.

Page 56: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 56

Digital Camera Pipeline

Sensor's output needs to be gamma-corrected to account for eventual display, as well as to compensate for nonlinearities in the sensor's capture response.

Page 57: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 57

Digital Camera Pipeline

Image stability compensation, or hand-shaking correction is another area of preprocessing. Here, the processor adjusts for the translational motion of the received image, often with the help of external transducers that relate the real-time motion profile of the sensor.

Page 58: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 58

Digital Camera Pipeline

White balance is another important stage of preprocessing. When we look at a scene, regardless of lighting conditions, our eyes tend to normalize everything to the same set of natural colors. For instance, an apple looks deep red to us whether we're indoors under fluorescent lighting, or outside in sunny weather. However, an image sensor's "perception" of color depends largely on lighting conditions, so it needs to map its acquired image to appear natural in its final output. This mapping can be done either manually or automatically.

Page 59: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 59

Digital Camera Pipeline

Demosaicking (Bayer interpolation) estimates missing color samples in single-chip cameras.

Page 60: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 60

Digital Camera Pipeline

In this stage, the interpolated RGB image is transformed to the targeted output color space (if not already in the right space). For compression or display to a television, this will usually involve an RGBYCbCr matrix transformation, often with another gamma correction stage to accommodate the target display. The YCbCr outputs may also be chroma subsampled at this stage to the standard 4:2:2 format for color bandwidth reduction with little visual impact.

Page 61: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 61

Digital Camera Pipeline

PostprocessingIn this phase, the image is perfected via a variety of filtering operations before being sent to the display and/or storage media. For instance, edge enhancement, pixel thresholding for noise reduction, and color-artifact removal are all common at this stage.

Page 62: EE 4780: Introduction to Computer Vision Introduction

Bahadir K. Gunturk 62

Digital Camera Pipeline

Display / Compress / StoreOnce the image itself is ready for viewing, the image pipe branches off in two different directions. In the first, the postprocessed image is output to the target display, usually an integrated LCD screen (but sometimes an NTSC/PAL television monitor, in certain camera modes). In the second, the image is sent to the media processor's compression algorithm, where industry-standard compression techniques (JPEG, for instance) are applied before the picture is stored locally in some storage medium (e.g., Flash memory card).