Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences...

130
Final Review Image Processing CSE 166 Lecture 18

Transcript of Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences...

Page 1: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Final Review

Image Processing

CSE 166

Lecture 18

Page 2: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Topics covered

• Basis vectors• Matrix-based transforms• Basis images• Wavelet transform• Image compression• Image watermarking• Morphological image processing• Edge detection• Segmentation

CSE 166, Spring 2020 2

Page 3: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Matrix-based transforms

CSE 166, Spring 2020 3

Forward transform

Inverse transform

where

Page 4: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

General inverse transform using basis vectors

CSE 166, Spring 2020 4

Page 5: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Matrix-based transforms using orthonormal basis vectors

• In vector form

CSE 166, Spring 2020 5

Page 6: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Matrix-based transforms using orthonormal basis vectors

• In matrix form

CSE 166, Spring 2020 6

Page 7: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Matrix-based transforms using biorthonormal basis vectors

• In matrix form

CSE 166, Spring 2020 7

Page 8: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Matrix-based transform

CSE 166, Spring 2020 8

Example: 8-point DFT of f(x) = sin(2πx)

real part + imaginary part

Page 9: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Matrix-based transforms

• Discrete Fourier transform (DFT)• Discrete Hartley transform (DHT)• Discrete cosine transform (DCT)• Discrete sine transform (DST)• Walsh-Hadamard (WHT)• Slant (SLT)• Haar (HAAR)• Daubechies (DB4)• Biorthogonal B-spline (BIOR3.1)

CSE 166, Spring 2020 9

Page 10: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Basis vectors of matrix-based 1D transforms

CSE 166, Spring 2020 10

N = 16

real part

imaginary part

Standard basis(for reference)

Page 11: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Basis vectors of matrix-based 1D transforms

CSE 166, Spring 2020 11

N = 16

basis dual Standard basis(for reference)

Page 12: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Matrix-based transformsin two dimensions

CSE 166, Spring 2020 12

Forward transform

Inverse transform

where

Page 13: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Matrix-based transformsin two dimensions

• If r and s are separable and symmetric, and M = N, then

– For orthonormal basis vectors

– For biorthonormal basis vectors

CSE 166, Spring 2020 13

Page 14: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Matrix-based transforms in two dimensions using basis images

• Inverse transform

CSE 166, Spring 2020 14

where

Each Su,v is a basis image

Page 15: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Basis images of matrix-based 2D transforms

CSE 166, Spring 2020 15

Standard basis images (for reference)

8-by-8 array of8-by-8

basis images

Page 16: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Basis images of matrix-based 2D transforms

CSE 166, Spring 2020 16

Discrete Fourier transform (DFT) basis images

real part imaginary part

Page 17: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Basis images of matrix-based 2D transforms

CSE 166, Spring 2020 17

Discrete Hartley transform (DHT) basis images

Page 18: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Basis images of matrix-based 2D transforms

CSE 166, Spring 2020 18

Discrete cosine transform (DCT) basis images

Page 19: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Basis images of matrix-based 2D transforms

CSE 166, Spring 2020 19

Discrete sine transform (DST) basis images

Page 20: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Basis images of matrix-based 2D transforms

CSE 166, Spring 2020 20

Walsh-Hadamard transform (WHT) basis images

Page 21: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Basis images of matrix-based 2D transforms

CSE 166, Spring 2020 21

Slant transform (SLT) basis images

Page 22: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Basis images of matrix-based 2D transforms

CSE 166, Spring 2020 22

Haar transform (HAAR) basis images

Page 23: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Wavelet transforms

• A scaling function is used to create a series of approximations of a function or image, each differing by a factor of 2 in resolution from its nearest neighboring approximations.

• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations.

• The discrete wavelet transform (DWT) uses those wavelets, together with a single scaling function, to represent a function or image as a linear combination of the wavelets and scaling function.

CSE 166, Spring 2020 23

Page 24: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Scaling functions and set of basis vectors

• Father scaling function

• Set of basis functions

– Integer translation k

– Binary scaling j

• Basis of the function space spanned by

CSE 166, Spring 2020 24

Page 25: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Scaling function, multiresolution analysis

1. The scaling function is orthogonal to its integer translates.

2. The function spaces spanned by the scaling function at low scales are nested within those spanned at higher scales.𝑉−∞⊂⋯⊂ 𝑉−1⊂ 𝑉0⊂ 𝑉1⊂⋯⊂ 𝑉∞

3. The only function representable at every scale (all 𝑉𝑗) is f(x) = 0.

4. All measureable, square-integrable functions can be represented as 𝑗 → ∞

CSE 166, Spring 2020 25

Page 26: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

• Given father scaling function , there exists a mother wavelet function whose integer translations and binary scalings

span the difference between any two adjacent scaling spaces

• The orthogonal compliment of

Wavelet functions

CSE 166, Spring 2020 26

Page 27: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Relationship between scaling and wavelet function spaces

CSE 166, Spring 2020 27

Union

V is basis of the function space spanned by scaling function

Wj is orthogonal complement of Vj in Vj+1

Page 28: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Scaling function coefficients and wavelet function coefficients

• Refinement (or dilation) equation

where are scaling function coefficients

• And

where are wavelet function coefficients

• Relationship

CSE 166, Spring 2020 28

Page 29: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

1D discrete wavelet transform

• Forward

• Inverse

CSE 166, Spring 2020 29

Approximation

Details

for real signals

Page 30: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

2D discrete wavelet transform

• Forward

CSE 166, Spring 2020 30

Approximation

Details

where

Directionalwavelets

for real signals

Page 31: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

2D discrete wavelet transform

• Inverse

CSE 166, Spring 2020 31

for real signals

Page 32: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

2D discrete wavelet transform

CSE 166, Spring 2020 32

Decomposition

Horizontal detailsApproximation

Vertical details

Diagonal details

Page 33: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

2D discrete wavelet transform

CSE 166, Spring 2020 33

3-levelwavelet

decomposition

Page 34: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Wavelets in image processing

1. Wavelet transform

2. Alter transform

3. Inverse wavelet transform

CSE 166, Spring 2020 34

Page 35: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Wavelet-based edge detection

CSE 166, Spring 2020 35

Zero horizontal

details

Zero lowest scale

approximation

Vertical edges

Edges

Page 36: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Wavelet-based noise removal

CSE 166, Spring 2020 36

Noisy imageThreshold

details

Zero highest

resolution details

Zero details for all levels

Page 37: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Data compression

• Data redundancy

where compression ratio

CSE 166, Spring 2020 37

where

Page 38: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Data redundancy in images

CSE 166, Spring 2020 38

Coding redundancy

Spatial redundancy

Irrelevant information

Does not need all 8 bits

Information is unnecessarily

replicated

Information is not useful

Page 39: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Image information

• Entropy

– It is not possible to encode input image with fewer than bits/pixel

CSE 166, Spring 2020 39

where

Page 40: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Fidelity criteria,objective (quantitative)

• Total error

• Root-mean-square error

• Mean-square signal to noise ratio (SNR)

CSE 166, Spring 2020 40

Page 41: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Fidelity criteriasubjective (qualitative)

CSE 166, Spring 2020 41

Page 42: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Approximations

CSE 166, Spring 2020 42

5.17 15.67 14.17

(a) (b) (c)

Objective (quantitative) qualityrms error (in intensity levels)

Subjective (qualitative) quality, relative

Lower is better

(a) is better than (b).

(b) is better than (c)

Page 43: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Compression system

CSE 166, Spring 2020 43

Page 44: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Compression methods

• Huffman coding• Golomb coding• Arithmetic coding• Lempel-Ziv-Welch (LZW) coding• Run-length coding• Symbol-based coding• Bit-plane coding• Block transform coding• Predictive coding• Wavelet coding

CSE 166, Spring 2020 44

Page 45: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Block-transform coding

CSE 166, Spring 2020 45

Encoder

Decoder

Page 46: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Block-transform coding

• Example: discrete cosine transform

• Inverse

CSE 166, Spring 2020 46

where

Page 47: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Block-transform coding

CSE 166, Spring 2020 47

Discrete cosine transformWalsh-Hadamard transform

4x4 subimages (4x4 basis images)

Page 48: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Block-transform coding

CSE 166, Spring 2020 48

Fourier transform

cosine transform

Walsh-Hadamardtransform

2.32 1.78 1.13rms error

Retain 32 largest

coefficients

Error image

8x8 subimages

Lower is better

Page 49: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Block-transform coding

CSE 166, Spring 2020 49

2x2 4x4 8x8

Reconstruction error versus subimage size

DCT subimage size:

Page 50: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

JPEG uses block DCT-based coding

CSE 166, Spring 2020 50

Compression reconstruction

Scaled error image

Zoomed compression

reconstruction

25:1

52:1

Compression ratio

Page 51: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Predictive coding model

CSE 166, Spring 2020 51

Encoder

Decoder

Page 52: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Predictive coding

CSE 166, Spring 2020 52

Input image

Prediction error image

Example: previous pixel coding

Histograms

Page 53: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Wavelet coding

CSE 166, Spring 2020 53

Encoder

Decoder

Page 54: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Wavelet coding

CSE 166, Spring 2020 54

Detail coefficients below 25 are truncated to zero

Page 55: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

JPEG-2000 uses wavelet-based coding

CSE 166, Spring 2020 55

Compression reconstruction

Scaled error image

Zoomed compression

reconstruction

25:1

52:1

Compression ratio

Page 56: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

JPEG-2000 uses wavelet-based coding

CSE 166, Spring 2020 56

Compression reconstruction

Scaled error image

Zoomed compression

reconstruction

75:1

105:1

Compression ratio

Page 57: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Image watermarking

• Visible watermarks

• Invisible watermarks

CSE 166, Spring 2020 57

Page 58: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Visible watermark

CSE 166, Spring 2020 58

Original image minus watermark

Watermarked image

Watermark

Page 59: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Invisible image watermarking system

CSE 166, Spring 2020 59

Encoder

Decoder

Page 60: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Invisible watermark

CSE 166, Spring 2020 60

Two least significant

bits

JPEGcompressed

Fragile invisible

watermark

Originalimage Extracted

watermark

Example: watermarking using two least significant bits

Page 61: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Invisible watermark

CSE 166, Spring 2020 61

Watermarked images

(different watermarks)

Example: DCT-based watermarking

Extracted robust

invisible watermark

Page 62: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Reflection and translation

CSE 166, Spring 2020 62

Translation

Reflection

Page 63: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Sets of pixels: objects and structuring elements (SEs)

CSE 166, Spring 2020 63

Border of background

pixels around objects

Tight border around SE

Page 64: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Reflection about the origin

CSE 166, Spring 2020 64

Origin

Don’t care elements

Page 65: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Erosion

CSE 166, Spring 2020 65

Example: square SE

Complement of A (i.e., set of elements not in A)

Page 66: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Erosion

CSE 166, Spring 2020 66

Example: elongated SE

Page 67: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Erosion

CSE 166, Spring 2020 67

11x11

45x4515x15

Shrinks

Page 68: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Dilation

CSE 166, Spring 2020 68

Square SEExamples

Elongated SE

Page 69: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Dilation

CSE 166, Spring 2020 69

Expands

Page 70: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Opening

CSE 166, Spring 2020 70

Structuring element rolls along inner boundary

Page 71: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Closing

CSE 166, Spring 2020 71

Structuring element rolls along outer boundary

Page 72: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Opening and closing

CSE 166, Spring 2020 72

Opening

Closing

Dilation

Erosion

Page 73: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Morphological image processing

CSE 166, Spring 2020 73

Noisy input

Dilation

Erosion

Opening

Dilation

Erosion

Closing

Page 74: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Boundary extraction

CSE 166, Spring 2020 74

Erosion Set difference

Page 75: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Boundary extraction

CSE 166, Spring 2020 75

Page 76: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Hole filling

CSE 166, Spring 2020 76

Given point in hole

Page 77: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Hole filling

CSE 166, Spring 2020 77

Given points in holes All holes filled

Page 78: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Connected components

CSE 166, Spring 2020 78

Given point in A

Page 79: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Connected components

CSE 166, Spring 2020 79

15 connected

components

X-ray image

Threshold (negative)

Page 80: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Image segmentation

• General approach

1. Spatial filtering

2. Additional processing

3. Thresholding

• Global thresholding (simplest)

CSE 166, Spring 2020 80

where

Page 81: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Image segmentation

CSE 166, Spring 2020 81

Edge-based

Region-based

Input Edges Segmentation

Page 82: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Derivatives in 1D

• Forward difference

• Backward difference

• Central difference

CSE 166, Spring 2020 82

Page 83: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Image derivatives

CSE 166, Spring 2020 83

Page 84: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Detection of isolated points

CSE 166, Spring 2020 84

Laplacian(second derivative)

Input Segmentation

Threshold absolute

value

Page 85: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Line detection

CSE 166, Spring 2020 85

Threshold absolute

value

Threshold value

Laplacian(second

derivative)Input

Double lines

Page 86: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Line detection, specific directions

CSE 166, Spring 2020 86

Spatial filters

Page 87: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Line detection, specific directions

CSE 166, Spring 2020 87

+45°

Negative values set

to zero

Threshold

Page 88: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Edge models

CSE 166, Spring 2020 88

Step Ramp Roof edge

Page 89: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Edge models

CSE 166, Spring 2020 89

Step

RampRoofedge

Page 90: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Ramp edge

CSE 166, Spring 2020 90

First derivative

Second derivative

One point

Two points

Page 91: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Noise and image derivatives

CSE 166, Spring 2020 91

First derivative

Second derivativeInput

Noise

Page 92: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Edge detection

1. Image smoothing for noise reduction

2. Detection of image points (edge point candidates)

3. Edge localization (select from candidates, set of edge points)

CSE 166, Spring 2020 92

Page 93: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Gradient and edge direction

CSE 166, Spring 2020 93

Gradient direction is orthogonal to edge direction

Page 94: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Gradient operators

CSE 166, Spring 2020 94

Forward difference

Page 95: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Gradients

CSE 166, Spring 2020 95

Magnitude of

vertical gradient

Magnitude of

horizontal gradient

Magnitude of

gradient vector

Input

Page 96: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Gradients

CSE 166, Spring 2020 96

Magnitude of

vertical gradient

Magnitude of

horizontal gradient

Magnitude of

gradient vector

Input

Smooth image prior to computing gradients.Results in more selective edges

Page 97: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Edge detection

1. Smooth the input image

2. Compute the gradient magnitude image

3. Apply nonmaximal suppression to the gradient magnitude image

4. Threshold the resulting image

CSE 166, Spring 2020 97

Page 98: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Edge detection

CSE 166, Spring 2020 98

Without smoothing With smoothing

Threshold magnitude of gradient vector

Page 99: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Advanced edge detection

CSE 166, Spring 2020 99

Magnitude of gradient vector

(with smoothing)Input

Marr-Hildreth CannyFigure 10.25 in textbook looks better

Page 100: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Canny edge detector

1. Smooth the input image with a Gaussian filter

2. Compute the gradient magnitude and angle images

3. Apply nonmaximal suppression to the gradient magnitude image

4. Use double thresholding and connectivity analysis to detect and link edges

CSE 166, Spring 2020 100

Page 101: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Double thresholding

• Use a high threshold to start edge curves and a low threshold to continue them– Define two thresholds TH and TL– Starting with output of nonmaximal suppression, find a point q0,

which is a local maximum greater than TH– Start tracking an edge chain at pixel location q0 in one of the two

directions– Stop when gradient magnitude is less than TL

CSE 166, Spring 2020 101

TH

TL

q0

Page 102: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Double thresholding

CSE 166, Spring 2020 102

TH = 15 and TL = 5T = 5T = 15

Single threshold Double threshold

Page 103: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Thresholding

CSE 166, Spring 2020 103

Single threshold Dual thresholds

Histograms

Page 104: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Thresholding

• Single threshold

• Dual thresholds

CSE 166, Spring 2020 104

where

where

Page 105: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Noise and thresholding

CSE 166, Spring 2020 105

Noise

Page 106: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Varying background and thresholding

CSE 166, Spring 2020 106

Intensity ramp Product of input and intensity ramp

Input

Page 107: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Basic global thresholding

CSE 166, Spring 2020 107

Intensity ramp ThresholdInput

Page 108: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Basic global thresholding

CSE 166, Spring 2020 108

Value used to stop iterating

Page 109: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Optimum global thresholding

CSE 166, Spring 2020 109

Histogram

Basic global thresholding

Optimum global

thresholding using Otsu’s

method

Input

Page 110: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Otsu’s method

CSE 166, Spring 2020 110

Page 111: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Image smoothing to improve global thresholding

CSE 166, Spring 2020 111

Without smoothing

With smoothing

Otsu’s method

Page 112: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Image smoothing does not always improve global thresholding

CSE 166, Spring 2020 112

Without smoothing

With smoothing

Otsu’s method

Page 113: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Edges to improve global thresholding

CSE 166, Spring 2020 113

Mask image (thresholded

gradient magnitude)

Input

Masked input

Optimum global

thresholding using Otsu’s

method

Page 114: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Edges to improve global thresholding

CSE 166, Spring 2020 114

Input

Masked input

Optimum global

thresholding using Otsu’s

method

Mask image (thresholded absolute Laplacian)

Page 115: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Variable thresholding

CSE 166, Spring 2020 115

Global thresholding

Local standard

deviations

Local thresholding

using standard

deviations

Input

Page 116: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Variable thresholding

CSE 166, Spring 2020 116

Global thresholding

Local thresholding using moving

averages

Input(spot shading)

Page 117: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Variable thresholding

CSE 166, Spring 2020 117

Global thresholding

Local thresholding using moving

averages

Input(sinusoidal shading)

Page 118: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Segmentation by region growing

CSE 166, Spring 2020 118

Initial seed

image

InputX-ray image

Final seed

image

Output image

Page 119: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Segmentation by region growing

CSE 166, Spring 2020 119

Page 120: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Segmentation by region growing

CSE 166, Spring 2020 120

Difference image thresholded with the smallest of the dual

thresholds

Segmentation by region growing

Difference image thresholded using

dual thresholds

Difference image

Page 121: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Advanced segmentation methods

• k-means clustering

• Superpixels

• Graph cuts

CSE 166, Spring 2020 121

Page 122: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Segmentation using k-means clustering

CSE 166, Spring 2020 122

Input Segmentation using k-means, k = 3

Page 123: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Segmentation using k-means clustering

CSE 166, Spring 2020 123

Page 124: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Superpixels

CSE 166, Spring 2020 124

Image of 4,000 superpixels with

boundaries

Image of 4,000 superpixels

Input image of 480,000 pixels

Page 125: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Superpixels

CSE 166, Spring 2020 125

500 superpixels 250 superpixels1,000 superpixels

Page 126: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Superpixels for image segmentation

CSE 166, Spring 2020 126

Segmentation using k-means, k = 3

Superpixel image (100 superpixels)

Input image of 301,678 pixels

Segmentation using k-means, k = 3

Page 127: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Images as graphs

CSE 166, Spring 2020 127

Simple graph with edges only between

4-connected neighbors

Stronger (greater weight) edges are darker

Page 128: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Graph cuts for image segmentation

CSE 166, Spring 2020 128

Cut the weak edges

Page 129: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

Graph cuts for image segmentation

CSE 166, Spring 2020 129

Smoothed input Graph cut segmentation

Input

Page 130: Introduction and Overview• Wavelet functions (wavelets) are then used to encode the differences between adjacent approximations. • The discrete wavelet transform (DWT) uses those

CSE 166

• Image acquisition

• Geometric transformations and image interpolation

• Intensity transformations

• Spatial filtering

• Fourier transform and filtering in the frequency domain

• Image restoration

• Color image processing

• Basis vectors

• Matrix-based transforms

• Basis images

• Wavelet transform

• Image compression

• Image watermarking

• Morphological image processing

• Edge detection

• Segmentation

CSE 166, Spring 2020 130