lec10-midterm-review · Midterm Review Image Processing CSE 166 Lecture 10 Image acquisition...

21
10/26/2016 1 Midterm Review Image Processing CSE 166 Lecture 10 Image acquisition CSE 166, Fall 2016 2 Digitization, line of image CSE 166, Fall 2016 3 Digitization, whole image CSE 166, Fall 2016 4 Geometric transformations CSE 166, Fall 2016 CSE 166 Transpose these matrices 5 Interpolation CSE 166, Fall 2016 6

Transcript of lec10-midterm-review · Midterm Review Image Processing CSE 166 Lecture 10 Image acquisition...

  • 10/26/2016

    1

    Midterm Review

    Image ProcessingCSE 166

    Lecture 10

    Image acquisition

    CSE 166, Fall 2016 2

    Digitization, line of image

    CSE 166, Fall 2016 3

    Digitization, whole image

    CSE 166, Fall 2016 4

    Geometric transformations

    CSE 166, Fall 2016

    CSE 166Transpose these matrices

    5

    Interpolation

    CSE 166, Fall 2016 6

  • 10/26/2016

    2

    Intensity transformations

    CSE 166, Fall 2016 7

    Intensity transformations

    CSE 166, Fall 2016 8

    Negative transformation

    CSE 166, Fall 2016 9

    Gamma transformation

    CSE 166, Fall 2016 10

    Gamma transformation

    CSE 166, Fall 2016

    γ  1

    Lightimage

    12

  • 10/26/2016

    3

    Piecewise‐linear transformations

    • Contrast stretching• Intensity‐level slicing• Bit‐plan slicing

    CSE 166, Fall 2016 13

    Contrast stretching

    CSE 166, Fall 2016 14

    Intensity‐level slicing

    CSE 166, Fall 2016 15

    Bit‐plane slicing

    CSE 166, Fall 2016 16

    Bit‐plane slicing

    CSE 166, Fall 2016 17

    Histogram

    CSE 166, Fall 2016

    Similar to probability density function (pdf)

    18

  • 10/26/2016

    4

    Histogram equalization

    CSE 166, Fall 2016 19

    Histogram equalization

    CSE 166, Fall 2016 20

    Histogram equalization

    CSE 166, Fall 2016 21

    Histogram matching

    CSE 166, Fall 2016 22

    Local histogram equalization

    CSE 166, Fall 2016 23

    Spatial filtering

    CSE 166, Fall 2016 24

  • 10/26/2016

    5

    Correlation and convolution (1D)

    CSE 166, Fall 2016 25

    Correlation and convolution (2D)

    CSE 166, Fall 2016 27

    Correlation and convolution (2D)

    CSE 166, Fall 2016 29

    Smoothing filters

    CSE 166, Fall 2016 30

  • 10/26/2016

    6

    Smoothing filters

    CSE 166, Fall 2016 31

    Derivatives

    CSE 166, Fall 2016 32

    Sharpening filtersLaplacian (using second derivatives)

    CSE 166, Fall 2016 33

    Sharpening filters

    CSE 166, Fall 2016 34

    Gradient (first derivatives)

    CSE 166, Fall 2016 35

    Magnitude of gradient vector

    CSE 166, Fall 2016 36

  • 10/26/2016

    7

    Combining spatial filtering and intensity transformations

    CSE 166, Fall 2016

    Laplacian

    Sobel

    Smooth

    SharpenedMagnitudeof gradient

    Smoothedmagnitudeof gradient

    Noisereduced sharpened

    “Sharpened”

    Gamma37

    Jean‐Baptiste Joseph Fourier1768‐1830

    CSE 166, Fall 2016 38

    Periodic functions can be represented as weighted sum of sines and cosines

    CSE 166, Fall 2016

    Fourier series

    39

    1D continuous Fourier transform

    CSE 166, Fall 2016 40

    Unit discrete impulse

    CSE 166, Fall 2016 41

    Impulse train

    CSE 166, Fall 2016 42

  • 10/26/2016

    8

    Sampling

    CSE 166, Fall 2016 43

    Sampling

    CSE 166, Fall 2016

    Over‐sampled

    Critically‐sampled

    Under‐sampled

    1/ΔT

    Fourier transform of function

    Fourier transforms of sampled function

    44

    The sampling theorem

    CSE 166, Fall 2016

    Critically‐sampled

    Fourier transform of function

    Fourier transform of sampled function

    45

    Recovering F(μ) from F(μ)

    CSE 166, Fall 2016

    ~

    Over‐sampled

    Recovered

    46

    Aliasing

    CSE 166, Fall 2016

    Under‐sampled

    Will result in aliasing

    47

    Aliasing

    CSE 166, Fall 2016 48

  • 10/26/2016

    9

    Continuous Fourier transform

    CSE 166, Fall 2016

    1D

    2D

    49

    Unit discrete impulse

    CSE 166, Fall 2016

    1D

    2D

    50

    Impulse train

    CSE 166, Fall 2016

    1D

    2D

    51 CSE 166, Fall 2016

    1D

    2D

    Over‐sampled

    Under‐sampled

    Fourier transform of sampled functionand extracting one period

    52

    Aliasing

    CSE 166, Fall 2016

    1D

    2D

    Aliasing

    Original

    53

    Aliasing in real images

    CSE 166, Fall 2016

    AliasingOriginal No aliasing

    54

  • 10/26/2016

    10

    Centering the DFT

    CSE 166, Fall 2016

    1D

    2D

    In MATLAB, use fftshift and ifftshift

    55

    Centering the DFT

    CSE 166, Fall 2016

    OriginalDFT(look at corners)

    Shifted DFTLog of shifted DFT

    56

    DFT of geometrically transformed images

    CSE 166, Fall 2016

    Translated

    Rotatedabout center

    Same as DFT of original

    57

    Rectangle phase images

    CSE 166, Fall 2016

    Translated Rotated about centerOriginal

    58

    Inverse DFT

    CSE 166, Fall 2016

    Phase

    IDFT: Phase only 

    (zero magnitude)

    IDFT: Magnitude 

    only (zero phase)

    IDFT: Woman 

    magnitude and rectangle phase

    IDFT: Rectangle 

    magnitude and woman phase59

    Filtering using convolution theorem

    CSE 166, Fall 2016

    Filtering in spatial domain using 

    convolution

    expectedresult

    Filtering in frequencydomain using productwithout

    zero‐padding

    wraparounderror

    60

  • 10/26/2016

    11

    Filtering using convolution theorem

    CSE 166, Fall 2016

    Filtering in frequencydomain using productwith

    zero‐padding

    no wraparounderror

    Gaussian lowpass filter in frequency domain

    61

    Filtering using convolution theorem

    CSE 166, Fall 2016

    Filtering in spatialdomain using

    convolution

    Filtering in frequencydomain using

    product

    Identical results

    DFT

    62

    Filtering in the frequency domain

    • Ideal lowpass filter (LPF)– Frequency domain

    CSE 166, Fall 2016 63

    Filtering in the frequency domain

    • Ideal lowpass filter (LPF)– Spatial domain

    CSE 166, Fall 2016 64

    Filtering in the frequency domain

    • Butterworth lowpass filter (LPF)

    CSE 166, Fall 2016 65

    Filtering in the frequency domain

    • Gaussian lowpass filter (LPF)

    CSE 166, Fall 2016 66

  • 10/26/2016

    12

    Filtering in the frequency domain

    CSE 166, Fall 2016Ideal LPF Butterworth LPF Gaussian LPF

    67

    Example: character recognition

    CSE 166, Fall 2016 68

    Highpass filter (HPF)Frequency domain

    CSE 166, Fall 2016

    Ideal HPF

    Gaussian HPF

    Butterworth HPF

    69

    Highpass filter (HPF)Spatial domain

    CSE 166, Fall 2016

    Ideal HPF Butterworth HPF Gaussian HPF

    70

    Filtering in the frequency domain

    CSE 166, Fall 2016

    Ideal HPF

    Gaussian HPF

    Butterworth HPF

    71

    Filtering in the frequency domain

    CSE 166, Fall 2016

    1D

    Lowpass filter Sharpening filter72

  • 10/26/2016

    13

    Filtering in the frequency domain

    CSE 166, Fall 2016

    2D

    73

    Filtering in the frequency domain

    • Sharpening filter

    CSE 166, Fall 2016 74

    Bandreject and bandpass filters

    CSE 166, Fall 2016 75

    Jean‐Baptiste Joseph Fourier1768‐1830

    CSE 166, Fall 2016 76

    Model of image degradation, then restoration

    CSE 166, Fall 2016 77

    Noise modeled as different probability density functions

    CSE 166, Fall 2016 78

  • 10/26/2016

    14

    Input image (free of noise)

    CSE 166, Fall 2016 79

    Adding noise from different models

    CSE 166, Fall 2016 80

    Adding noise from different models

    CSE 166, Fall 2016 81

    Histograms of sample patches

    CSE 166, Fall 2016

    Sample “flat” patches from images with noise

    Identify closest probability density function (pdf) match82

    Mean filters

    CSE 166, Fall 2016

    Additive Gaussian noise

    Geometric mean filtered

    Arithmetic mean filtered

    83

    Mean filters

    CSE 166, Fall 2016

    Additivesaltnoise

    Additivepeppernoise

    Contraharmonicmean filtered

    Contraharmonicmean filtered

    84

  • 10/26/2016

    15

    Order‐statistic filters

    CSE 166, Fall 2016

    Additivesalt and peppernoise

    1x median filtered

    3x median filtered

    2x median filtered

    85

    Order‐statistic filters

    CSE 166, Fall 2016

    Min filtered

    Max filtered

    86

    Comparing filters

    CSE 166, Fall 2016

    Additiveuniformnoise

    Alpha‐trimmed mean filtered

    Median filtered

    Additiveuniform + salt and pepper

    noise

    Arithmetricmean filtered

    Geometric mean filtered

    87

    Adaptive filters

    CSE 166, Fall 2016

    AdditiveGaussiannoise

    Arithmetricmean filtered

    Geometric mean filtered

    Adaptive noise reduction filtered

    88

    Adaptive filters

    CSE 166, Fall 2016

    Additivesalt and pepper

    noiseMedian filtered

    Adaptive median filtered

    89

    Periodic noise

    CSE 166, Fall 2016

    Example pair of conjugate impulses due to corruption 

    by (spatial) sinusoidal noise

    90

  • 10/26/2016

    16

    Bandreject filter

    CSE 166, Fall 2016 91

    Bandreject filters

    CSE 166, Fall 2016 92

    Notch pass filter

    CSE 166, Fall 2016

    Degraded image

    Estimate of original image

    DFT magnitude

    Product of DFT magnitude and notch pass filter

    Noise(result of notch reject filter)

    93

    Notch reject filters

    CSE 166, Fall 2016 94

    Estimation of degradation function by experimentation

    CSE 166, Fall 2016 95

    Estimation of degradation function by mathematical modeling

    CSE 166, Fall 2016

    Atmospheric turbulence model

    96

  • 10/26/2016

    17

    Estimation of degradation function by mathematical modeling

    CSE 166, Fall 2016

    Motion blur model

    97

    Image restoration

    CSE 166, Fall 2016

    Inverse filtering

    98

    Image restoration

    CSE 166, Fall 2016

    Inverse filtering Wiener filtering

    99

    Image restoration

    CSE 166, Fall 2016

    Inversefiltering

    Wienerfiltering

    Degraded image

    100

    Image restoration

    CSE 166, Fall 2016

    Constrained least squares filtering

    101

    Electromagnetic spectrum

    CSE 166, Fall 2016 102

  • 10/26/2016

    18

    Separating light

    CSE 166, Fall 2016 103

    Human eye cones

    CSE 166, Fall 2016 104

    Mixing light

    CSE 166, Fall 2016

    Light

    Pigment

    Primary and secondary colors are swapped

    Note that blue and cyan are not 

    accurate colors on this slide or in the book

    105

    RGB color model

    CSE 166, Fall 2016

    RGB coordinates

    106

    XYZ color model andchromaticity coordinates

    CSE 166, Fall 2016

    Not actual colors 

    locations; just gives an idea

    107

    Color gamuts

    CSE 166, Fall 2016

    Averageperson

    Computermonitor

    Printer

    108

  • 10/26/2016

    19

    HSI color model:Relationship to RGB color model

    CSE 166, Fall 2016

    All colors with cyan 

    hueRGB color cube rotated such that 

    line joining black and white (intensity axis) is vertical

    109

    HSI color model

    CSE 166, Fall 2016

    RGB color cube rotated such that line joining black and white 

    (intensity axis) is vertical

    Viewed from the top down

    Shape does not matter

    110

    HSI color model

    CSE 166, Fall 2016

    HS plane is orthogonal to intensity axis

    111

    Color models

    CSE 166, Fall 2016

    HSI

    RGB

    CMYK

    112

    Intensity slicing

    CSE 166, Fall 2016

    Grayscale to 2 colors

    113

    Intensity slicing

    CSE 166, Fall 2016

    Grayscale to 2 colors

    114

  • 10/26/2016

    20

    Intensity slicing

    CSE 166, Fall 2016

    Grayscale to 8 colors115

    Intensity slicing

    CSE 166, Fall 2016

    Grayscale to 256 colors

    Colorbar

    116

    Intensity to color transformations

    CSE 166, Fall 2016

    Grayscale input image

    RGBoutput image

    117

    Intensity to color transformations

    CSE 166, Fall 2016

    Grayscale input image

    “See through” explosive

    RGB output image

    Without explosive

    With explosive

    118

    Intensity to color transformations

    CSE 166, Fall 2016

    Multiple grayscale 

    input images

    SingleRGB

    output image

    119

    Intensity to color transformations

    CSE 166, Fall 2016

    Multiple grayscale 

    input images

    SingleRGB

    output image

    Near infrared

    R G

    B NIR

    RGB NIRGB image 120

  • 10/26/2016

    21

    Intensity to color transformations

    CSE 166, Fall 2016

    SingleRGB

    output image

    Multiple grayscale input images, 

    some outside of visible spectrum

    Close upPhysical and chemical 

    processes likely to affect sensor response

    121

    Full‐color image processing

    CSE 166, Fall 2016

    Spatial filtering: process each channel independently

    122

    Full‐color image processing

    CSE 166, Fall 2016

    All RGB channels

    HSI intensity channel only

    Spatial filtering: image smoothing

    123

    Full‐color image processing

    CSE 166, Fall 2016

    All RGB channels

    HSI intensity channel only

    Spatial filtering: image sharpening

    124

    Full‐color image processing

    CSE 166, Fall 2016

    Histogram equalization: do not process each channel independently

    1. RGB to HSI2. Histogram equalize intensity3. HSI to RGB

    125