Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing...

111
Image Image Analysis Analysis • Manipulate an image to extract information to help solve a problem. – Preprocessing - get rid of unnecessary information – Data reduction - transform the image to a useable form – Feature analysis - make inferences about the image.
  • date post

    19-Dec-2015
  • Category

    Documents

  • view

    217
  • download

    0

Transcript of Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing...

Page 1: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Image AnalysisImage Analysis• Manipulate an image to extract information

to help solve a problem.– Preprocessing - get rid of unnecessary

information– Data reduction - transform the image to a

useable form– Feature analysis - make inferences about the

image.

Page 2: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Image AnalysisImage Analysis

• Preprocessing– Noise reduction– Gray level quantization – Spatial quantization– Finding regions of interest–

Reducing the number of bits

Page 3: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

• Data reduction process, in which the image(s) are transformed into a more convenient form.– RGB HSL– Image subtraction– Histogram– Feature extraction

Image AnalysisImage Analysis

Page 4: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

• Feature analysis - Specific results– Blood cell counting– Tumor size and location– 3D model–

Image AnalysisImage Analysis

Page 5: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

• Geometric– Resizing– Rotating

• Noise Reduction– Image Smoothing– Median Filtering

• Edge Detection– Searching for discontinuities

• Histogram slicing• Blob detection

Image AnalysisImage Analysis

Page 6: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Geometric TransformationGeometric Transformation

Page 7: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

InterpolationInterpolation

• Interpolation to determine image values at integer pixel locations of transformed image. – Numerous interpolation schemes exist

• 2 simple methods are

– Nearest neighbor: assign value of nearest known point

– Bilinear interpolation: example on next slide

Interpolation used to simplify data for further processing

Page 8: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Nearest Neighbor InterpolationNearest Neighbor Interpolation

Interpolate this point To

this value

Page 9: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Linear InterpolationLinear Interpolation

Page 10: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Bi-linear InterpolationBi-linear Interpolation

I(x+1,y)

I(x+1,y+1)

I(x,y+1)

I(x,y)

0 (a,b) 1

I(x’,y) = (1-a)I(x,y) + (a)I(x+1,y)

I(x’,y’) = (1-b)I(x’,y) + (b)I(x’,y+1)

I(x’,y+1) = (1-a)I(x,y+1) + (a)I(x+1,y+1)

I(x’,y’) = (1-b)(1-a)I(x,y) + (1-b)(a)I(x+1,y) + (b)(1-a)I(x,y+1) + (a)(b)I(x,y)

I(x’,y’)

Page 11: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

I(x’,y’)

Bi-linear InterpolationBi-linear Interpolation

Page 12: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Neighborhood Neighborhood OperationsOperations

Page 13: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

ObjectivesObjectives• Why are neighborhoods important?• What is linear convolution?

– discrete– templates, masks or filters– algorithm mechanics– graphical interpretation

• Describe non-linear operators– maximum– minimum– median

• What is tiling?

Page 14: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Why are neighbourhoods important?Why are neighbourhoods important?

pixel

Page 15: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Because…Because…

• Provide context for individual pixels.

• Relationships between neighbors determine image features.

• Neighborhood operations:– noise reduction– edge enhancement– zooming

Page 16: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Noise reduction Edge Enhancement

Zooming

Page 17: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Neighbourhood OperationsNeighbourhood Operations

• Linear convolution (*)– A*B*C*D = B*C*D*A = ….

• Non-linear operators– median, max, min, ...

Page 18: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Convolution versus Spectral• We learnt two methods of processing images:

– Convolution– Spectral

• We analyzed and demonstrated how to build a processor (systolic, pipelined, parallel, cellular automaton) for 1D convolution.– 1D convolution is used in speech processing and in polynomial

multiplication.

• We will use visualized animations now to show in more detail how 2D convolution works for images.

• This should convince you how important it is to do convolution quickly in modern Spectral Architectures, especially for 3D etc.

Page 19: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

2D Convolution2D Convolution

• Consists of filtering an image A using a filter (mask, template) B.

• Mask is a small image whose pixel values are called weights.

• Weights modify relationships between pixels.

We will show more examples of convolution now, especially for 2D data

Page 20: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

A1,1 A1,2 A1,3 A1,4

A2,1 A2,2 A2,3 A2,4

A3,1 A3,2 A3,3 A3,4

A4,1 A4,2 A4,3 A4,4

B1,1 B1,2

B2,1 B2,2

BA C

C1,1 C1,2 C1,3

C3,1

C2,1 C2,2 C2,3

C3,2 C3,3

=

Filter,mask or template

Input image

ConvolvedImage

2 2

4 43 3

Page 21: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

A1,1 A1,2

A2,1 A2,2

A1,3 A1,4

A2,3 A2,4

A3,1 A3,2 A3,3 A3,4

A4,1 A4,2 A4,3 A4,4

B1,1 B1,2

B2,1 B2,2 A1,1B1,1

A2,1B2,1

A1,2B1,

2

A2,2B2,

2

A1,1B1,1C1,1= A1,2B1,

2

A2,1B2,1 A2,2B2,

2

Page 22: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

A1,1 A1,2

A2,1 A2,2

A1,3 A1,4

A2,3 A2,4

A3,1 A3,2 A3,3 A3,4

A4,1 A4,2 A4,3 A4,4

B1,1 B1,2

B2,1 B2,2A1,2B1,

1

A2,2B2,1

A1,3B1,

2

A2,3B2,

2

A1,2B1,1C1,2= A1,3B1,

2

A2,2B2,1 A2,3B2,

2

Page 23: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

A1,1 A1,2

A2,1 A2,2

A1,3 A1,4

A2,3 A2,4

A3,1 A3,2 A3,3 A3,4

A4,1 A4,2 A4,3 A4,4

B1,1 B1,2

B2,1 B2,2A1,3B1,

1

A2,3B2,1

A1,4B1,

2

A2,4B2,

2

A1,3B1,1C1,3= A1,4B1,

2

A2,3B2,1 A2,4B2,

2

Page 24: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

A1,1 A1,2

A2,1 A2,2

A1,3 A1,4

A2,3 A2,4

A3,1 A3,2 A3,3 A3,4

A4,1 A4,2 A4,3 A4,4

B1,1 B1,2

B2,1 B2,2

A2,1B1,

1

A3,1B2,1

A2,2B1,

2

A3,2B2,

2

A2,1B1,1C2,1= A2,2B1,

2

A3,1B2,1 A3,2B2,

2

Page 25: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

A1,1 A1,2

A2,1 A2,2

A1,3 A1,4

A2,3 A2,4

A3,1 A3,2 A3,3 A3,4

A4,1 A4,2 A4,3 A4,4

B1,1 B1,2

B2,1 B2,2B1,1 B1,2

B2,1 B2,2B1,1 B1,2

B2,1 B2,2

Page 26: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Mathematical NotationMathematical Notation

1 1

1,1,,

Mk

ki

Nl

ljljkijilk BAC

NMB

A1,1B1,1C1,1= A1,2B1,

2

A2,1B2,1 A2,2B2,

2

Page 27: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

ConvolutionConvolution

4 4 7 9

4 3 8 9

3 5 9 9

3 6 10 9

-1 2

-1 2

BA C

=

Filter,mask or template

Input image

ConvolvedImage

2 2

4 43 3

6

9

16

23

26

27

21

19

17

Page 28: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Convolution sizeConvolution sizeImage size = M1 N1

Mask size = M2 N2

Convolution size = M1- M2 +1 N1-N2+1

N1

N2

N1-N2+1

Typical Mask sizes= 33, 5 5, 77,9 9, 1111

What is the convolved image size for a 128 128 image and 7 7 mask?

Page 29: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

*1 1 11 1 1 1 1 1

1 1 11 1 1 1 1 1

1 1 11 1 1 1 1 1

1 1 11 1 1 1 1 1

1 1 11 1 1 1 1 1

1 1 11 1 1 1 1 1

1 1 11 1 1 1 1 1

1 1 11 1 1 1 1 1

1 1 11 1 1 1 1 1

=

We convolve with 9*9 averaging filter

Page 30: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Nonlinear Neighbourhood Nonlinear Neighbourhood OperationsOperations

• Maximum

• Minimum

• Median

1,1,

1:,1:,

1,1,1:,1:

,

1,1,1:,1:

,

median

min

max

ljkijiNlljMkki

lk

ljkijiNlljMkki

lk

ljkijiNlljMkki

lk

BAC

BAC

BAC

We discussed already sorter architecture (three variants – pipelined, butterfly combinational and sequential controller). It can be used for all these operations, and also for other non-linear operators

Page 31: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

61 62

57 60

59 65

63 56

59 55 58 57

49 53 55 45

1 1

1 1C1,2=

62

60

59

636359

Max and Min OperationsMax and Min Operations

63=max, 59=min

Page 32: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

61 62

57 60

59 65

63 56

59 55 58 57

49 53 55 45

C1,2=

Median OperationMedian Operation

1 1

1 1

1

1

1 1 1

62

60

59

63

65

56

55 58 57

62

59

65

60

63

56

57

58

55

987654321

59

rank

Page 33: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

9x9 Median

Page 34: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Edge Detection

• What do we mean by edge detection?

• What is an edge?

Page 35: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

What is Edge Detection?What is Edge Detection?

• Detects large intensity transitions between pixels

• Redraws the image with only the edges showing

0 0 0 33

0 0 45 78

0 45 23 33

0 0 42 76

0 0 0 38

Page 36: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

What is an Edge?

Edge easy to findEdge easy to find

Page 37: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

What is an Edge?

Where is edge? Single pixel wide or multiple pixels?Where is edge? Single pixel wide or multiple pixels?

Page 38: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

What is an Edge?

Noise: have to distinguish noise from actual edgeNoise: have to distinguish noise from actual edge

Noise Noise is hereis here

Page 39: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

What is an Edge?

Is this one edge or two?Is this one edge or two?

Page 40: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

What is an Edge?

Texture discontinuityTexture discontinuity

Page 41: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Edge Detection – so what is an Edge Detection – so what is an edge to be detected?edge to be detected?

• What is an edge– A large change in image brightness of a short

spatial distance – Edge strength = (I(x,y)-I(x+dx,y))/dx

But this general definition still allows for many theories, software implementation and hardware architectures.

Page 42: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Now we will Now we will discuss and discuss and illustrate various illustrate various kinds of filter kinds of filter operatorsoperators

Page 43: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Edge Detection FiltersEdge Detection Filters

•High - Pass Filtering Eliminates Uniform Regions (Low Frequencies)

•edge “detection” or “enhancement”

Page 44: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Edge Detection FiltersEdge Detection Filters

Page 45: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Edge Detection ContinuedEdge Detection Continued

•Sum of Kernel Coefficients = 0

•differences in signs emphasize differences in pixel values

•reduces average image intensity

•Negative pixel values in output?

Edge Detection FiltersEdge Detection Filters

Page 46: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

vertical

horizontal diagonal

Edge DirectionEdge Direction

Page 47: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Directional High Directional High Pass FiltersPass Filters

Page 48: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Convolution Edge Convolution Edge Detection using Detection using

Sobel and similar Sobel and similar operatorsoperators

Page 49: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Example of Sobel Operator

Sobel OperatorSobel Operator

Page 50: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Sobel Edge DetectionSobel Edge Detection

Page 51: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Convolution Application ExamplesConvolution Application Examples

--Edge DetectionWe apply Sobel Operator

-1 -2 -10 0 01 2 1

-1 0 1

-2 0 2

-1 0 1

Column Mask

Row Mask

as mask to a sub-field of a picture

-1 2 -1

0 0 0

1 2 1

p0, p1, p2

p3, p4, p5

p6, p7, p8 = (p6-p0)+2(p7-p1)+(p8-p2)

We can learn from the result obviously •The result of the above calculation for column mask is horizontal difference•With Row Mask we will get vertical difference

*

The final step of the convolution equation, dividing by the weight , must be ignored

Page 52: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

--Edge Detection with Sobel Operator

The weight of a mask determines the grey level of the image after convolution.

Like the weight of Sobel Mask WW= (-1) + (-2) + (-1) + 0 + 0 + 0 +1 + 2 +1= 0

The resulting image lost its “lightness” to be dark.dark.

Convolution Application ExamplesConvolution Application Examples

Page 53: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Sobel OperatorSobel Operator

Page 54: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Sobel OperatorSobel Operator

-1 -2 -1 0 0 0 1 2 1

-1 0 1-2 0 2 -1 0 1

S1= S2 =

Edge Magnitude =

Edge Direction =

22

21 SS

2

11tanS

S

Page 55: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

SobelPrewitt

Ticbetts

Canny

Comparison of Edge Detection Comparison of Edge Detection AlgorithmsAlgorithms

Page 56: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Edge DirectionEdge DirectionAssymetric kernels detect edges from Assymetric kernels detect edges from specific directionsspecific directions

EastEast

1 1 -1

1 -2 -1

1 1 -1

NorthEaNorthEastst

1 -1 -1

1 -2 -1

1 1 -1

NorthNorth

-1 -1 -1

1 -2 1

1 1 1

Page 57: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Robinson Robinson OperatorOperator

Page 58: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Robinson Compass MasksRobinson Compass Masks

-1 0 1-2 0 2 -1 0 1

0 1 2-1 0 1 -2 -1 0

1 2 1 0 0 0 -1 -2 -1

2 1 0 1 0 -1 0 -1 -2

1 0 -1 2 0 -2 1 1 -1

0 -1 -2-1 0 -1 2 1 0

-1 -2 -1 0 0 0 1 2 1

-2 -1 0-1 0 1 0 1 2

Arrows show edge directions

Page 59: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Roberts Roberts OperatorOperator

Page 60: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Roberts OperatorRoberts Operator

• Does not return any information about the orientation of the edge

22 ),1()1,()1,1(),( yxIyxIyxIyxI

),1()1,()1,1(),( yxIyxIyxIyxI

or

1 00 -1

0 1-1 0+

Page 61: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Prewitt OperatorPrewitt Operator-1 -1 -1 0 0 0 1 1 1

-1 0 1-1 0 1 -1 0 1

P1= P2 =

Edge Magnitude =

Edge Direction =

22

21 PP

2

11tanP

P

Page 62: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Prewitt Row

Edge Detection FiltersEdge Detection Filters

Page 63: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

0 1 2-1 0 1 -2 -1 0

1 2 1 0 0 0 -1 -2 -1Original

and filtered cow

Page 64: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Edge Detection Edge Detection (continued)(continued)

• First Order (Gradient) Kernels

• Prewitt RowPrewitt Row

1 0 -11 0 -1

1 0 -11 0 -1

1 0 -11 0 -1

• Sobel RowSobel Row

1 0 -11 0 -1

2 0 -22 0 -2

1 0 -11 0 -1

• Combine Row and Column Operators

Edge Detection Filters: compare Edge Detection Filters: compare Prewitt Prewitt and Sobeland Sobel

Page 65: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

1D Laplacian Operator

)(xf

x

xf

)(

2

22 )(

x

xfxf

first derivative

second derivative

Page 66: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

2D Laplacian Operator2D Laplacian Operator

2

2

2

22 ,,

),(y

yxf

x

yxfyxf

0 -1 0-1 4 -1 0 -1 0

1 -2 1-2 4 -2 1 -2 1

-1 -1 -1-1 8 -1-1 -1 -1

Convolution masks approximating a Laplacian

This is just one example of Laplacian, we can use much larger window

Page 67: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

0 -1 0-1 4 -1 0 -1 0

Input Mask Output

Page 68: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Image Processing Operations for Early Vision:

Edge Edge DetectionDetection

Page 69: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Reminder: Effect of FiltersReminder: Effect of Filters

low

high

Page 70: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

EdgesEdges… are the important part of images

intensity

color

edges

textures

contours

condensation...

simplest, least robust

most difficult, most robust There are many letters B occluded

by black shape here. How to find them?

Page 71: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Edge Detection

• Edges are curves in the image plane across which there is a “significant” change in image brightness.

• The goal of edge detection is the construction of an idealized line drawing

Image Processing OperationsImage Processing Operations

Page 72: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Pixels on edgesPixels on edges

Page 73: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Edges foundEdges found

Page 74: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Edge effects: rarely ideal edgesEdge effects: rarely ideal edges

Not all information is created equal...

Page 75: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Causes of edgesCauses of edges

• Depth discontinuity– One surface occludes another

• Surface orientation discontinuity– the edge of a block

• reflectance discontinuity– texture or color changes

• illumination discontinuity– shadows

Page 76: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Edges: causesEdges: causesWhat are they? Why?

four physical events that cause image edges...

Page 77: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

What are they? Why?

discontinuities in

• surface color/intensity• surface normal• depth• lighting (specularities)

four physical events that cause image edges...

Edges: causesEdges: causes

Page 78: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Edges are image locations with a local maximum in image gradient in the direction of that gradient

(steepness)

Edges: causesEdges: causes

Page 79: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Edge DetectionEdge Detection

• Finding simple descriptions of objects in complex images– find edges

– interrelate edges

Page 80: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Examples of edgesExamples of edges

Page 81: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

•One idea to detect edges is to differentiate the image and look for places where the brightness undergoes a sharp change•Consider a 1-D example. Below is an intensity profile for a 1-D image.

Edges are not ideal... Edges are not ideal...

Page 82: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

•Below we have the derivative of the previous graph.

•Here we have a peak at x=18, x=50 and x=75.•These errors are due to the presence of noise in the image.

Edge DetectionEdge Detection

Page 83: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Finding EdgesFinding EdgesImage Intensity along a line

First derivative of intensity

Smoothed via convolving with gaussian

Page 84: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

• This problem is countered by convolving a smoothing function along with the differentiation operation.

• The mathematical concept of convolution allows us to perform many useful image-processing operations.

Edge DetectionEdge Detection

Page 85: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

• One standard form of smoothing is to use a Gaussian function.

• Now using the idea of convolving with the Gaussian functionwe can revisit the 1-D example.

Image Processing OperationsImage Processing Operations

Page 86: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

• With the convolving applied we can more easily see the edge at x=50.

Using convolving we are able to discover where edges are located and this allows us to make an accurate line drawing.

Convolving to find edgesConvolving to find edges

Page 87: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

•Here is an example of using convolving in an 2-D picture of Mona Lisa

Edge Detection by ConvolutionEdge Detection by Convolution

Page 88: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

edge

Second derivative

derivative

Zero CrossingZero Crossing

Page 89: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

EdgeEdge

Page 90: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Edge ParametersEdge Parameters

Page 91: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Remainder: How the Point Remainder: How the Point Detection Mask operates on one Detection Mask operates on one

color imagecolor image

Page 92: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Goal: to find regions of an image with locally maximal gradient magnitude.(1) Smooth the image to reduce the effects of noise

Replace each pixel by a weighted sum of its neighbors.

I(x,y) = wij I(x+i,y+j) i,j = -1

1

old Imageweight “mask” new

Image

oldnewweights

4 22

2 11

2 11

x =

(scaled)

34 37 137 148

29 46 141 140

34 130 149 131

41 142 152 144

35 210 210 210

43 210 210 210

60 210 210 210

72 210 210 210

Edge Detection uses ConvolutionEdge Detection uses Convolution

Page 93: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Goal: to find regions of an image with locally maximal gradient magnitude.(1) Smooth the image to reduce the effects of noise

It’s possible to do this one dimension at a time...

Replace each pixel by a weighted sum of its neighbors.

I(x,y) = wij I(x+i,y+j) i,j = -1

1

old Imageweight “mask” new

Image

oldnewweights

4 22

2 11

2 11

x =

(scaled)

34 37 137 148

29 46 141 140

34 130 149 131

41 142 152 144

35 62 116 143

43 76 122 141

60 102 136 140

72 112 145 143

smoothed vertically

smoothed horizontally

original image

Edge Detection uses ConvolutionEdge Detection uses Convolution

Page 94: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Goal: to find regions of an image with locally maximal gradient magnitude.(1) Smooth the image to reduce the effects of noise

(2) Estimate the gradient at each pixel

I(x,y) = wij I(x+i,y+j) i,j = -1

1

oldnewweights

Replace each pixel by a weighted sum of its neighbors.

Use another mask of weights -- this time to approximate taking derivatives.

In the x direction

In the y direction

-1 1

-1

1

with new weights

same procedure

(convolution)

= Iy= Ixddx

I ddy

I

Edge Detection uses ConvolutionEdge Detection uses Convolution

Page 95: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Goal: to find regions of an image with locally maximal gradient magnitude.(1) Smooth the image to reduce the effects of noise

(2) Estimate the gradient at each pixel

(3) Find the gradient magnitude and thin the resulting lines.

I(x,y) = wij I(x+i,y+j) i,j = -1

1

oldnewweights

Replace each pixel by a weighted sum of its neighbors.

Use another mask of weights -- this time to approximate taking derivatives.

-1 1-1

1

same procedure with new weights (convolution)

x

y

I(x,y) = sqrt(Ix + Iy ) 22

Seek out maxima in the gradient direction .

= atan2(Ix, Iy)

Edge Detection uses ConvolutionEdge Detection uses Convolution

Page 96: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Goal: to find regions of an image with locally maximal gradient magnitude.(1) Smooth the image to reduce the effects of noise

(2) Estimate the gradient at each pixel

(3) Find the gradient magnitude and thin the resulting information.

(4) Choose a threshold -- any gradients above it classify as edges.

I(x,y) = wij I(x+i,y+j) i,j = -1

1

oldnewweights

Replace each pixel by a weighted sum of its neighbors.

Use another mask of weights -- this time to approximate taking derivatives.

I(x,y) = sqrt(Ix + Iy ) 22

-1 1-1

1

same procedure with new weights (convolution)

x

y

In the gradient direction, look for local maxima: = atan2(Ix, Iy)

Edge Detection uses ConvolutionEdge Detection uses Convolution

Page 97: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Theory of Theory of Gradient Gradient

Based Edge Based Edge DetectionDetection

Page 98: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Formal Model of Edge Formal Model of Edge

Page 99: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Formal Model of Edge Formal Model of Edge

Page 100: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Formal Model of Edge (cont)

Formal Model of Edge Formal Model of Edge

Page 101: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Formal Model of Edge (cont) Formal Model of Edge Formal Model of Edge

Page 102: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Formal Model of Edge (cont) Formal Model of Edge Formal Model of Edge

Page 103: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Formal Model of Edge (cont) Formal Model of Edge: Roberts Formal Model of Edge: Roberts

Page 104: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Formal Model of Edge (cont) Formal Model of Edge: Laplacian and Marr-Formal Model of Edge: Laplacian and Marr-Hildreth Hildreth

Page 105: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Formal Model of Edge (cont) Formal Model of Edge Formal Model of Edge

Page 106: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Formal Model of Edge (cont) Formal Model of Edge Formal Model of Edge

Page 107: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

ThresholdsThresholds

very high thresholdoriginal image

Thresholds are important, done before or during edge detection.

Page 108: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

Thresholds

very high thresholdoriginal image

ThresholdsThresholds

Page 109: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

very high thresholdoriginal image

ThresholdsThresholds

Page 110: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

very high threshold

reasonable

original image

ThresholdsThresholds

Page 111: Image Analysis Manipulate an image to extract information to help solve a problem. –Preprocessing - get rid of unnecessary information –Data reduction.

very high threshold

too low !reasonablethis all takes time...

original image

ThresholdsThresholds