Digital imaging and image processing Review Final Exam Monday - - PowerPoint PPT Presentation

digital imaging and image processing review
SMART_READER_LITE
LIVE PREVIEW

Digital imaging and image processing Review Final Exam Monday - - PowerPoint PPT Presentation

Digital imaging and image processing Review Final Exam Monday June 11th at 8am Digital Data Pixels Digital Sensors (a) Single sensing element. (b) Line sensor. (c) Array sensor. Digital Image Grayscale image Bit depth


slide-1
SLIDE 1

Digital imaging 


and 


image processing Review

Final Exam Monday June 11th at 8am

slide-2
SLIDE 2

Digital Data

slide-3
SLIDE 3

Pixels

slide-4
SLIDE 4

Digital Sensors

(a) Single sensing element. 
 (b) Line sensor. 
 (c) Array sensor.

slide-5
SLIDE 5

Digital Image

slide-6
SLIDE 6

Grayscale image

slide-7
SLIDE 7

Bit depth

  • Binary: 0 and 1
  • 8 bit: 0 up to (2^8 =) 256
  • 16 bit: 0 up to (16^2 =) 65,536
  • 32 bit: 0 up to (32^2 =) 4,294,967,296
  • Color: RGB contains a red, green and blue

matrix of the bit depth specified

slide-8
SLIDE 8

Image displayed in 32, 16, 8, 4, and 2 intensity levels.

slide-9
SLIDE 9

Saturation

slide-10
SLIDE 10

Forming a vector

slide-11
SLIDE 11

Color Images

blue green red

slide-12
SLIDE 12

Color sensor: Bayer pattern

slide-13
SLIDE 13

We lose light

slide-14
SLIDE 14

Dichroic Mirrors,
 Multiple Cameras

  • N
slide-15
SLIDE 15

Image Display

Simplest contrast adjustment: 
 Set Min, Max of display

slide-16
SLIDE 16

More powerful methods to improve contrast

Retinex—Examples—X-rays

slide-17
SLIDE 17

In image space

  • Make image “better” for a specific application

– The idea of “better” is somewhat subjective

Pixel 4-Neighbors 8-Neighbors

  • Make image “better” for a specific application

– The idea of “better” is somewhat subjective

  • We distinguish two domains:

– Spatial or Pixel domain: – Frequency Domain:

) , (

  • r

) , ( n m f y x f ) , (

  • r

) , ( v u F w w F

y x

slide-18
SLIDE 18

Operations

  • Element-wise (pixel by pixel) vs. Matrix operations
  • Single-pixel vs neighborhood:
  • Single-pixel: grab e.g. the value of the one

nearest pixel)

  • Neighborhood (calculate and use e.g. the

average / max / median / min or other calculated value of the nearest neighbors)

slide-19
SLIDE 19

Simplest form of processing: Point Processing

) , ( n m f r

Pixel T

) (r T s

255 r S=T(r) 255 Image “negative”: s=L-1-r No change Thresholding Black

  • Narrow range of “dark” gets

mapped to broad range of “gray”

slide-20
SLIDE 20

Inverse lookup table

(a) 8-bit image. (b) Intensity transformation function used to obtain the digital equivalent of a “photographic” negative of an 8-bit image. The arrows show transformation of an arbitrary input
 intensity value z into its corresponding output value s0. (c) Negative of (a) obtained using (b)

slide-21
SLIDE 21

Better visibility 
 for display / diagnosis

slide-22
SLIDE 22

Binary

  • Small storage
  • Easier to apply 


some operations

slide-23
SLIDE 23
  • Image “negative”: s=L

Simplest form of processing: Point Processing

) , ( n m f r

Pixel T

) (r T s

255 r s 255 Common Examples:

  • Dynamic Range Compression
  • Gamma Correction

) 1 log( ) ( r c r T

  • cr

r T

  • )

( 10

  • 1

.

  • Narrow range of “dark” gets

mapped to broad range of “gray” Black

slide-24
SLIDE 24

Gamma Correction

Luminance Applied/Measured Voltage (U)

  • Nonlinear response of CRT’s and imagers
  • commands to the CRT are “predistorted”

5 . 2 8 . 1

  • U

L

slide-25
SLIDE 25
  • Nonlinear response of CRT’s and imagers
  • commands to the CRT are “predistorted”
slide-26
SLIDE 26

Scaling

slide-27
SLIDE 27

Log scale display

slide-28
SLIDE 28

Synthetic lookup tables

“Red Hot” in FIJI Chasing the right one can make it easier to see stuff — and to get published… Inverse

slide-29
SLIDE 29

Histogram Processing:

Graylevel 9 15 7 5 Histogram:

  • Distribution of gray-levels can be judged

by measuring a Histogram

slide-30
SLIDE 30

Histograms

slide-31
SLIDE 31

Histogram manipulation

Illustration of the mean and standard deviation as functions of image contrast. (a)-(c) Images with low, medium, and high contrast, respectively. (Original image courtesy of the National Cancer Institute.)

slide-32
SLIDE 32

Example:

slide-33
SLIDE 33

Histogram Equalization

  • Make it flat and spread it out
  • This is a nonlinear operation
slide-34
SLIDE 34
slide-35
SLIDE 35

– –

  • Histogram Equalization: Cont.’d
slide-36
SLIDE 36
slide-37
SLIDE 37

Color Histogram

slide-38
SLIDE 38

Spatial filtering

  • In image space
  • In frequency space
slide-39
SLIDE 39

Image size / Sampling

slide-40
SLIDE 40

Aliasing

slide-41
SLIDE 41

Nyquist sampling 
 = twice the frequency

slide-42
SLIDE 42

Aliasing

  • (Image downsized around four times)
slide-43
SLIDE 43

Re-sampling: Change size by interpolation

(a) Image reduced to 72 dpi and zoomed back to its original 930 dpi using 
 nearest neighbor interpolation. (b) Image reduced to 72 dpi and zoomed using bilinear interpolation. 
 (c) Same as (b) but using bicubic interpolation.

slide-44
SLIDE 44

Average when downsizing?

  • Edges lose contrast if you average but result is smoother
slide-45
SLIDE 45

Convolution

Defining convolution

  • l

k

l k g l n k m f n m g f

,

] , [ ] , [ ] , )[ (

f

  • Let f be the image and g be the kernel. The
  • utput of convolving f with g is denoted f * g.

Source: F. Durand

  • Convention: kernel is “flipped”
  • MATLAB: conv2 vs. filter2 (also imfilter)
slide-46
SLIDE 46

Convolution

  • Convention: kernel is “flipped”
  • Key properties
  • Linearity: filter(f1 + f2 ) = filter(f1) + filter(f2)
  • Shift invariance: same behavior

regardless of pixel location: filter(shift(f)) = shift(filter(f))

  • Theoretical result: any linear shift-invariant
  • perator can be represented as a

convolution

slide-47
SLIDE 47

Convolve 
 “Drag-and-Stamp”

= ‘full’: output size is sum of sizes of f and g – = ‘same’: output size is same as f – = ‘valid’: output size is difference of sizes of f

  • – To compute all pixel values in the output image, we need to fill in a “border”

Mask dimension = 2M+1 Border dimension = M

slide-48
SLIDE 48

Spatial Filtering: Blurring

  • Example

1 1 1 1 1 1 1 1 1 1/9

Averaging Mask:

slide-49
SLIDE 49

Image Enhancement:Spatial Filtering Operation

  • Idea: Use a “mask” to alter pixel values

according to local operation

  • Aim: (De)-Emphasize some spatial frequencies

in the image.

slide-50
SLIDE 50

Image Enhancement:Spatial Filtering Operation

  • An important point: Edge Effects (Ex.: 5x5 Mask)

– How to fill in a “border”

  • Zeros (Ringing)
  • Replication (Better)
  • Reflection (“Best”)

a b c d a b a b c d a a c c b b d d

  • Procedure:

– Replicate row-wise – Replicate column-wise – Apply filtering – Remove borders

– –

  • imfilter(f, g, ‘circular’)
  • imfilter(f, g, ‘replicate’)
  • imfilter(f, g, ‘symmetric’)
slide-51
SLIDE 51

– –

  • Image Enhancement:Spatial Filtering Operation

5x5 Blurring with 0-padding 5x5 Blurring with reflected padding

slide-52
SLIDE 52

Gaussian Kernel

  • Constant factor at front makes volume sum to 1 (can be

ignored, as we should re-normalize weights to sum to 1 in any case)

0.003 0.013 0.022 0.013 0.003 0.013 0.059 0.097 0.059 0.013 0.022 0.097 0.159 0.097 0.022 0.013 0.059 0.097 0.059 0.013 0.003 0.013 0.022 0.013 0.003

5 x 5, = 1 fspecial(‘gauss’,5,1)

slide-53
SLIDE 53
  • fspecial(‘gauss’,5,1)

Choosing kernel width

  • Gaussian filters have infinite support, but

discrete filters use finite kernels

slide-54
SLIDE 54
  • σ

Example: Smoothing with a Gaussian

slide-55
SLIDE 55

Mean vs. Gaussian filtering

  • Remove “high frequency” components

– σ σ√2

slide-56
SLIDE 56

Gaussian filters

  • Remove “high-frequency” components

from the image (low-pass filter)

  • Convolution with self is another Gaussian

– So can smooth with small-width kernel, repeat, and get same result as larger-width kernel would have – Convolving two times with Gaussian kernel of width σ is same as convolving once with kernel of width σ√2

  • Separable kernel

– Factors into product of two 1D Gaussians

slide-57
SLIDE 57

Use this to sharpen!

  • What does blurring take away?
  • riginal

smoothed (5x5)

detail

=

sharpened

=

Let’s add it back:

  • riginal

detail

+ α

slide-58
SLIDE 58

More on Linear Operations: Sharpening Filters

  • Sharpening filters use masks that typically have

+ and – numbers in them.

  • They are useful for highlighting or enhancing

details and high-frequency information (e.g. edges)

  • They can (and often are) based on derivative-

type operations in the image (whereas smoothing operations were based on “integral” type operations)

slide-59
SLIDE 59

Derivatives

  • smoothing operations were based on “integral”

Differentiation and convolution

  • Recall, for 2D function,

f(x,y):

  • This is linear and shift

invariant, so must be the result of a convolution.

  • We could approximate

this as

  • which is obviously a

convolution with kernel

฀ f x lim f x , y

  • f x,y

f x f xn1,y

  • f xn, y
  • x
  • 1 1
slide-60
SLIDE 60

Derivative-type Filters

) 1 , ( ) , ( 2 ) 1 , ( y ) , 1 ( ) , ( 2 ) , 1 ( x ) , ( ) 1 , ( y ) , ( ) , 1 ( x

2 2 2 2

  • y

x f y x f y x f f y x f y x f y x f f y x f y x f f y x f y x f f

  • 1

1

  • 1

1

  • 1

2 1

  • 1

2 1

Laplacian:

  • 2

2 2 2 2

y x f f f

  • 1

2 1

  • 1

1 4 1 1 1 2 1

  • “Isotropic” filter
slide-61
SLIDE 61
slide-62
SLIDE 62

Sharpening Using the Laplacian Filter

) , ( ) , ( ) , (

2

y x f y x f A y x g

  • 1

1 1 1 8 1 1 1 1 A

Boosting High Frequencies

slide-63
SLIDE 63

Laplacian of Gaussian

Gaussian Unsharp Mask Filter

Gaussian unit impulse Laplacian of Gaussian

) ) 1 (( ) 1 ( ) ( g e f g f f g f f f

  • image

blurred image unit impulse (identity)

  • artist’s line drawing
slide-64
SLIDE 64

Edge detection

LoG-filtered Original

slide-65
SLIDE 65

Blob detection

Blob Detection

slide-66
SLIDE 66

Sampling in time SPEED

slide-67
SLIDE 67

Rolling Shutter/Global Shutter
 and Artifacts

slide-68
SLIDE 68

Flash Strobe

slide-69
SLIDE 69

Average multiple images

(a) Noisy image of the Sombrero Galaxy. (b)-(f) Result of averaging 10, 50, 100, 500, and 1,000 noisy images, respectively. All images are size 1548x2238 pixels and all scaled so intensities span the full 
 [0, 255] intensity scale.

slide-70
SLIDE 70

Computational Denoising

Denoised using ROF denoise in FIJI

slide-71
SLIDE 71

Digital Subtraction Angiography

Digital subtraction angiography. 
 (a) Mask image. (b) A live image. 
 (c) Difference between (a) and (b). 
 (d) Enhanced difference image. 
 Image courtesy of the Image Sciences Institute, University 
 Medical Center, Netherlands
 (from our textbook: Digital Image Processing in Matlab)

slide-72
SLIDE 72

Filtering in Frequency (Fourier) Space

slide-73
SLIDE 73

Time and space

Pressure Time Amplitude Frequency t f = 1/ t

We can Fourier Transform back and forth

slide-74
SLIDE 74

Fourier series

Amplitude vs Frequency Pressure vs Time Amplitude Frequency

slide-75
SLIDE 75

Short-time Fourier spectrogram

time frequency

slide-76
SLIDE 76

1D spatial frequency

slide-77
SLIDE 77

2D spatial frequency

slide-78
SLIDE 78

High and low-pass

slide-79
SLIDE 79

Filtering out a single 
 spatial frequency