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

Post on 20-Jan-2016

214 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Image ProcessingImage ProcessingPart IIPart II

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

Global Filters: REVIEW

• Brightness and Contrast control

• Histogram thresholding

• Histogram stretching or equalization

• Color corrections

• Inversions

Local FiltersLocal Filters

Blurring

• Sharpening

• Unsharp Masking

• Edge and line detection

• Noise filters

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;

}

}

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

Gaussian Blur

Multiply neighbors by less than middle

Blur Demo

•Photoshop

–Filter->Blur->Blur

–Filter->Blur->Gaussian Blur

Local FiltersLocal Filters

• Blurring SharpeningUnsharp Masking

• Edge and line detection

• Noise filters

• 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

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

Sharpen/Unsharp mask

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

Local FiltersLocal Filters

• Blurring

• Sharpening

• Unsharp MaskingEdge and line detection

• Noise filters

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

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

interest in the image

Edge Detection

• Photoshop– Filter->Stylize->Find Edges

Local FiltersLocal Filters

• Blurring

• Sharpening

• Unsharp Masking

• Edge and line detectionNoise filters

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

(speckles)

Noise Filter

• Photoshop– Filter->Noise->Median Filter

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

ImageImageEditingEditing

Image Editing

Selection Tools

• Painting Tools

• Cut & Paste

• Cloning

• Layers and Blending

Selection Tools

• Lasso Tool- manually draw outline (free hand)

- manually outline (line segments)

- magnetic lasso (semi-automated)

• Magic Wand

DEMOS

ToolBar

Image Editing

• Selection ToolsPainting Tools

• Cut & Paste

• Cloning

• Layers and Blending

Painting Tools

• Airbrush Tool

• Paint Bucket Tool• Paintbrush Tool

• Pencil Tool

DEMOS

Image Editing

• Selection Tools

• Painting ToolsCut & Paste

• Cloning

• Layers and Blending

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

Image Editing

• Selection Tools

• Painting Tools

• Cut & PasteCloning

• Layers and Blending

Cloning• Copy pixels from

one part of an image

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

Image Editing

• Selection Tools

• Painting Tools

• Cut & Paste

• CloningLayers and Blending

Can create arbitrary number of layers for

- animation

- special effects in movies

- morphing

Layers and Blending

Layer 1

Layer 2

Layer n

• The idea: Blended image

= .3 x + .7 x

is a weighted combination (sum) of

two or more other images.

Blending

Example Blend

.3 x +.7 x

= Bearastronaut

• The idea: Create another image

where the value of pixels is the

weighting term for a blend operation:

Masking

Image Editing

• Selection Tools

• Painting Tools

• Cut & Paste

• Cloning

• Layers and Blending

Review• Local Filters

- Blurring- Sharpening- Edge Detection- Noise removal

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

top related