Targil 2 Image enhancement and edge detection For

  • Slides: 19
Download presentation
Targil 2 Image enhancement and edge detection. For both we will use image derivatives.

Targil 2 Image enhancement and edge detection. For both we will use image derivatives.

Image enhancement • Histogram enhancement (histogram equalization…) • Reducing noise (smoothing, median) • Sharpening

Image enhancement • Histogram enhancement (histogram equalization…) • Reducing noise (smoothing, median) • Sharpening • Emphasize the details • Make the edges stronger • Problem: we magnify the noise

Sharpening: Subtracting The Laplacian F(x) F’’(x) F(x)-F’’(x)

Sharpening: Subtracting The Laplacian F(x) F’’(x) F(x)-F’’(x)

Reminder : Convolution image Kernel, Convolver For example: means that

Reminder : Convolution image Kernel, Convolver For example: means that

Image derivatives (Convolve with [1 -1]) (Convolve with [1 -1]T) A better kernel: (Convolve

Image derivatives (Convolve with [1 -1]) (Convolve with [1 -1]T) A better kernel: (Convolve with ½*[1 0 -1])

Image derivatives (cont’) Problem: the image is not continuous. A better approximation: • Locally

Image derivatives (cont’) Problem: the image is not continuous. A better approximation: • Locally approximate the image with a smooth surface. • Compute the derivatives of this surface. Popular kernels:

The second derivative Check that:

The second derivative Check that:

The Laplacian Equation: The matrix: Subtracting the Laplacian:

The Laplacian Equation: The matrix: Subtracting the Laplacian:

Sharpening Example

Sharpening Example

Edge Detection Why do we need it ? • A compact representation of the

Edge Detection Why do we need it ? • A compact representation of the image • More robust to light changes. • Easier to follow (tracking and computations of camera motion) • Segmentation: usually, edges are located at transitions between objects • Used for texture analysis

Edge Detection Wide edge Noise • What are “edges” ? Texture • How to

Edge Detection Wide edge Noise • What are “edges” ? Texture • How to find the edges ? T-junction Transition between objects • How to compute the exact location of an edge ?

The gradient The vector of derivatives Edge Size Edge Direction Derivative in Direction

The gradient The vector of derivatives Edge Size Edge Direction Derivative in Direction

The gradient Original Gradient

The gradient Original Gradient

Example: Derivatives Ix = Iy = * -1 0 1 =

Example: Derivatives Ix = Iy = * -1 0 1 =

Gradient Ix 2 + Iy 2 =

Gradient Ix 2 + Iy 2 =

Edge Localization-Zero Crossing Where exactly is the edge ? f Zero crossing of f’’

Edge Localization-Zero Crossing Where exactly is the edge ? f Zero crossing of f’’ ’’f Problem: f’’ is very noisy Smooth first !

A smoothing with a 2 D Gaussian (We usually use the binomial coefficients instead.

A smoothing with a 2 D Gaussian (We usually use the binomial coefficients instead. ) 11 12 1 1 3 3 1 1 4 6 4 1

Canny Edge Detection • Computing the image derivatives Gx, Gy – Smoothing with a

Canny Edge Detection • Computing the image derivatives Gx, Gy – Smoothing with a Gaussian. – Using simple derivative kernels. • Compute the edge direction: • Take only the local maxima in that direction (to get an edge with width 1) • Hysteresis: Edge linking with two thresholds • Q. : What will be the width of the Gaussian?

Original Example Canny

Original Example Canny