image processing part ii. 2 classes of digital filters global filters transform each pixel uniformly...

36
Image Processing Image Processing Part II Part II

Upload: hannah-dawson

Post on 20-Jan-2016

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Image Processing Part II. 2 Classes of Digital Filters global filters transform each pixel uniformly according to the function regardless of its location

Image ProcessingImage ProcessingPart IIPart II

Page 2: Image Processing Part II. 2 Classes of Digital Filters global filters transform each pixel uniformly according to the function regardless of its location

2 Classes of Digital Filters

• global filters transform each pixel uniformly according to the function regardless of its location in the image

• local filters transform a pixel depending upon its relation to surrounding ones

Page 3: Image Processing Part II. 2 Classes of Digital Filters global filters transform each pixel uniformly according to the function regardless of its location

Global Filters: REVIEW

• Brightness and Contrast control

• Histogram thresholding

• Histogram stretching or equalization

• Color corrections

• Inversions

Page 4: Image Processing Part II. 2 Classes of Digital Filters global filters transform each pixel uniformly according to the function regardless of its location

Local FiltersLocal Filters

Blurring

• Sharpening

• Unsharp Masking

• Edge and line detection

• Noise filters

Page 5: Image Processing Part II. 2 Classes of Digital Filters global filters transform each pixel uniformly according to the function regardless of its location

Blurring AlgorithmBlurring Algorithm

For (every pixel in column x)

{ For (every pixel in row y of column x){

average image[x,y] with it’s neighbors;

}

}

Page 6: Image Processing Part II. 2 Classes of Digital Filters global filters transform each pixel uniformly according to the function regardless of its location

Blurring

• Average each pixel with its neighbors by :

multiplying each pixel and its neighbors by 1:

=

- add multiplied pixels and divide by 9

- store result in a new array• The new array contains a blurred image.

1 1 1

1 1 1

1 1 1

Page 7: Image Processing Part II. 2 Classes of Digital Filters global filters transform each pixel uniformly according to the function regardless of its location

Gaussian Blur

Multiply neighbors by less than middle

Page 8: Image Processing Part II. 2 Classes of Digital Filters global filters transform each pixel uniformly according to the function regardless of its location

Blur Demo

•Photoshop

–Filter->Blur->Blur

–Filter->Blur->Gaussian Blur

Page 9: Image Processing Part II. 2 Classes of Digital Filters global filters transform each pixel uniformly according to the function regardless of its location

Local FiltersLocal Filters

• Blurring SharpeningUnsharp Masking

• Edge and line detection

• Noise filters

Page 10: Image Processing Part II. 2 Classes of Digital Filters global filters transform each pixel uniformly according to the function regardless of its location

• Subtract neighboring pixels by :

multiplying each pixel and its neighbors by:

=

- add multiplied pixels

- store result in a new array• The new array contains a sharpened image.

Sharpening

0 -1 0

0 0

-1-1

-1

+5

Page 11: Image Processing Part II. 2 Classes of Digital Filters global filters transform each pixel uniformly according to the function regardless of its location

Unsharp Masking

• Unsharp masking also sharpens an image• The Algorithm:

1. call the original (unblurred) image A

2. blur the image (call it B)

3. subtract B from the unblurred image (let C = A-B)

4. Multiply C by some number, k (k > 1)

5. Sharpened Image = A + kC

Page 12: Image Processing Part II. 2 Classes of Digital Filters global filters transform each pixel uniformly according to the function regardless of its location

Sharpen/Unsharp mask

• Photoshop– Filter->Sharpen->Sharpen– Filter->Sharpen->Unsharp mask

Page 13: Image Processing Part II. 2 Classes of Digital Filters global filters transform each pixel uniformly according to the function regardless of its location

Local FiltersLocal Filters

• Blurring

• Sharpening

• Unsharp MaskingEdge and line detection

• Noise filters

Page 14: Image Processing Part II. 2 Classes of Digital Filters global filters transform each pixel uniformly according to the function regardless of its location

Edge and Line Detection

• Multiply each pixel and its neighbors by

the following corresponding patterns (numbers)

- add results

- clip to 255

- result =

“Edge” image

-1 0

+1-1

-1 0

0

+1

+1

-1 -1 -1

00

+1 +1

0

+1 Gets Gets

Vertical Edges Horizontal Edges

Page 15: Image Processing Part II. 2 Classes of Digital Filters global filters transform each pixel uniformly according to the function regardless of its location

Edge Detection• edge detection is often used to recognized objects of

interest in the image

Page 16: Image Processing Part II. 2 Classes of Digital Filters global filters transform each pixel uniformly according to the function regardless of its location

Edge Detection

• Photoshop– Filter->Stylize->Find Edges

Page 17: Image Processing Part II. 2 Classes of Digital Filters global filters transform each pixel uniformly according to the function regardless of its location

Local FiltersLocal Filters

• Blurring

• Sharpening

• Unsharp Masking

• Edge and line detectionNoise filters

Page 18: Image Processing Part II. 2 Classes of Digital Filters global filters transform each pixel uniformly according to the function regardless of its location

Noise Filters• A median filter takes away “salt & pepper” noise

(speckles)

Page 19: Image Processing Part II. 2 Classes of Digital Filters global filters transform each pixel uniformly according to the function regardless of its location

Noise Filter

• Photoshop– Filter->Noise->Median Filter

Page 20: Image Processing Part II. 2 Classes of Digital Filters global filters transform each pixel uniformly according to the function regardless of its location

Kernel Filtering

1 1 1

1 1 1

1 1 1

Blur

0 -1 0

0 0

-1-1

-1

+5

Sharpen-1 0

+1-1

-1 0

0

+1

+1

-1 -1 -1

00

+1 +1

0

+1

Edges

Apply same algorithm at every pixel using different kernel values

Page 21: Image Processing Part II. 2 Classes of Digital Filters global filters transform each pixel uniformly according to the function regardless of its location

ImageImageEditingEditing

Page 22: Image Processing Part II. 2 Classes of Digital Filters global filters transform each pixel uniformly according to the function regardless of its location

Image Editing

Selection Tools

• Painting Tools

• Cut & Paste

• Cloning

• Layers and Blending

Page 23: Image Processing Part II. 2 Classes of Digital Filters global filters transform each pixel uniformly according to the function regardless of its location

Selection Tools

• Lasso Tool- manually draw outline (free hand)

- manually outline (line segments)

- magnetic lasso (semi-automated)

• Magic Wand

DEMOS

ToolBar

Page 24: Image Processing Part II. 2 Classes of Digital Filters global filters transform each pixel uniformly according to the function regardless of its location

Image Editing

• Selection ToolsPainting Tools

• Cut & Paste

• Cloning

• Layers and Blending

Page 25: Image Processing Part II. 2 Classes of Digital Filters global filters transform each pixel uniformly according to the function regardless of its location

Painting Tools

• Airbrush Tool

• Paint Bucket Tool• Paintbrush Tool

• Pencil Tool

DEMOS

Page 26: Image Processing Part II. 2 Classes of Digital Filters global filters transform each pixel uniformly according to the function regardless of its location

Image Editing

• Selection Tools

• Painting ToolsCut & Paste

• Cloning

• Layers and Blending

Page 27: Image Processing Part II. 2 Classes of Digital Filters global filters transform each pixel uniformly according to the function regardless of its location

Cut & Paste

• Word Processors

- cut & paste strings of characters (1D arrays)

• Image Editing

- cut & paste pixels (2D arrays)

- replace old pixels with new pixels

A s t r i n g65 32 115 116 114 105 110 103

0 1 2 3 4 5 6 7

Page 28: Image Processing Part II. 2 Classes of Digital Filters global filters transform each pixel uniformly according to the function regardless of its location

Image Editing

• Selection Tools

• Painting Tools

• Cut & PasteCloning

• Layers and Blending

Page 29: Image Processing Part II. 2 Classes of Digital Filters global filters transform each pixel uniformly according to the function regardless of its location

Cloning• Copy pixels from

one part of an image

- to another part of an image ... Interactively DEMO

Page 30: Image Processing Part II. 2 Classes of Digital Filters global filters transform each pixel uniformly according to the function regardless of its location

Image Editing

• Selection Tools

• Painting Tools

• Cut & Paste

• CloningLayers and Blending

Page 31: Image Processing Part II. 2 Classes of Digital Filters global filters transform each pixel uniformly according to the function regardless of its location

Can create arbitrary number of layers for

- animation

- special effects in movies

- morphing

Layers and Blending

Layer 1

Layer 2

Layer n

Page 32: Image Processing Part II. 2 Classes of Digital Filters global filters transform each pixel uniformly according to the function regardless of its location

• The idea: Blended image

= .3 x + .7 x

is a weighted combination (sum) of

two or more other images.

Blending

Page 33: Image Processing Part II. 2 Classes of Digital Filters global filters transform each pixel uniformly according to the function regardless of its location

Example Blend

.3 x +.7 x

= Bearastronaut

Page 34: Image Processing Part II. 2 Classes of Digital Filters global filters transform each pixel uniformly according to the function regardless of its location

• The idea: Create another image

where the value of pixels is the

weighting term for a blend operation:

Masking

Page 35: Image Processing Part II. 2 Classes of Digital Filters global filters transform each pixel uniformly according to the function regardless of its location

Image Editing

• Selection Tools

• Painting Tools

• Cut & Paste

• Cloning

• Layers and Blending

Page 36: Image Processing Part II. 2 Classes of Digital Filters global filters transform each pixel uniformly according to the function regardless of its location

Review• Local Filters

- Blurring- Sharpening- Edge Detection- Noise removal

• Image Editing• Selection Tools• Painting Tools• Cut & Paste• Cloning• Layers and Blending