You are on page 1of 31

Electrical/Computer Engineering Design Project Fall 2002 Lecture 3 Computer Vision

Electrical Engineering Design Project - Fall 2002

Topics
Computer vision system Image enhancement Image analysis Pattern Classification

Electrical Engineering Design Project - Fall 2002

Image Processing System


receiver

camera operators terminal

robot

Dual purpose: 1.Provide feedback for operator 2. Recognize victims (must be automated)

Electrical Engineering Design Project - Fall 2002

Image Processing System


Camera Receiver

Image

Digitizer

Image Processor

Digital Computer

Storage Device

Display

Electrical Engineering Design Project - Fall 2002

Image representation
Images are usually represented by a 2-D intensity function f(x,y) where
x and y represent spatial coordinates The value of f is proportional to the brightness (gray level) of the image.

A digital image u(m,n) is represented by a matrix whose rows and columns identify a point in an image and matrix element value identifies the gray level at that point. Each point is referred to as a picture element or pixel

Electrical Engineering Design Project - Fall 2002

Image representation
For computer storage, an array with the number of gray levels being a power of 2 is selected. A typical gray level image contains 256 shades of gray (8 bit) Values are stored between 0 - 255

Columns(16) Rows(16)

u(m,n) = value

Electrical Engineering Design Project - Fall 2002

Objective of Computer Vision


The field of computer vision can be divided into two areas
Image enhancement Image analysis

Electrical Engineering Design Project - Fall 2002

Image enhancement
Refers to the accentuation or sharpening of image features such as edges, boundaries, or contrast to make an image more useful for display and analysis.
Image Enhancement

Point Operations Contrast stretching Noise clipping Window Slicing Histogram modeling

Spatial Operations Noise smoothing Median Filtering Unsharp masking Low-pass, bandpass, high-pass filtering

Transform Operations Linear filtering Root filtering Homomorphic filtering

Electrical Engineering Design Project - Fall 2002

Point Operations
Mapping a given gray level u [0, L] into a gray
level v [0, L] according to v = f(u) Contrast Stretching For low-contrast images that occur because of: Poor or non-uniform lighting Non-linearity or small dynamic range of sensors. u 0ua (u a) a u b (u - b) b u L

v=

a Electrical Engineering Design Project - Fall 2002

Contrast Stretching

Electrical Engineering Design Project - Fall 2002

Thresholding
Output is a binary image.

Example:
u(m,n) =

1(255)

0(0) 120

u
v(m,n) =

threshold
Electrical Engineering Design Project - Fall 2002

Histogram Equalization
The effect of performing histogram equalization on an image is to produce a uniform distribution of gray levels in an image. The equalization process spreads out the peaks in an image and while compressing the range of intensities in regions of the histogram that have relatively few pixels. The histogram represents the relative frequency of occurrence of the various gray levels in an image. Equalization provides a way to enhance minor intensity variations in an apparently uniform image - method to emphasize dim features.

Electrical Engineering Design Project - Fall 2002

Histogram Equalization Examples

Electrical Engineering Design Project - Fall 2002

Image Math
Image math operations (addition, subtraction, multiplication and division) use two images to create a third image using pixel by pixel application of the mathematical operator.

Electrical Engineering Design Project - Fall 2002

Boolean Operations
Image A Image B A OR B

A AND B

A XOR B

NOT A

Electrical Engineering Design Project - Fall 2002

Spatial Operations
Spatial filtering involves passing a weighted mask, or kernel, over the noisy image and replacing the original image pixel value corresponding to the centre of the kernel with the sum of the original pixel values in the region corresponding to the kernel multiplied by the kernel weights.

Electrical Engineering Design Project - Fall 2002

Spatial Operations
Performed on local neighborhoods of input pixels. Image is convolved with a finite response filter called a spatial mask (window). Spatial average - each pixel is replaced by a weighted average of its neighborhood pixels. - average filter- used for noise smoothing, low-pass filtering

1/9 1/9 1/9

1/9 1/9 1/9

1/9 1/9 1/9

3 x 3 window

Has a blurring effect.

Electrical Engineering Design Project - Fall 2002

Masks edge detection


-1
Prewitt

0 0 0

1 1 1

1 0 -1

1 0 -1

1 0 -1

-1 -1

-1
Sobel

0 0 0

1 2 1

1 0 -1

2 0 -2

1 0 -1

-2 -1

Electrical Engineering Design Project - Fall 2002

Transformations
Images can be transformed using techniques similar to those in systems and signals. f(t) h(t) g(t)

Except now the signal is represented in 2-D space instead of 1-D time. Examples of transformations include: - Fourier transforms - Cosine transforms - Walsh transform
Electrical Engineering Design Project - Fall 2002

Image Analysis
Goal is to extract important features from image data, from which a description, interpretation, or understanding of the scene can be provided.
Image Analysis

Feature Extraction Spatial features Transform features Edges and boundaries Shape features Moments Texture

Segmentation Template matching Thresholding Boundary detection Clustering Quad-trees Texture matching

Classification Clustering Statistical Decision trees Similarity Measures Min. spanning tree

Electrical Engineering Design Project - Fall 2002

Segmentation
Includes: 1. 2. Thresholding Edge detection

Thresholding - separate different portions of the image based on the gray level values.

Electrical Engineering Design Project - Fall 2002

Blob Labeling
Each blob is labeled with a unique value. Scan image until a on pixel is encountered. Label every pixel connected to the pixel with the same label value

Label this pixel and every connected pixel with a 1

4-connected

8-connected

2
Usually use 8-connected.

1 3

Electrical Engineering Design Project - Fall 2002

Edge Detection
Edge detection segment the image by finding sharp edges. Can be performed using a spatial mask

Electrical Engineering Design Project - Fall 2002

Feature extraction
Feature extraction involves finding features of the segmented image. Usually performed on a binary image produced from a thresholding operation.

Common features include:


1. 2. 3. 4. Area. Perimeter. Center of mass. Compactness.

Electrical Engineering Design Project - Fall 2002

Feature extraction - area


Count the number of pixels in each labeled blob.
2 1 3
Simple algorithm scan images and count the number of pixels labeled with a 2

for(i=0;i<width;i++){ for(j=0;jheight;j++){ if(image[i][j]==2 area[2] += 1; } }

Electrical Engineering Design Project - Fall 2002

Feature extraction - perimeter


The number of pixels in a blob that border a 0
2 1 3

Perimeter pixels

Electrical Engineering Design Project - Fall 2002

Feature extraction - compactness


Other features can be obtained from simple measurements. Compactness = permiter2/4area For a perfect circle
Compactness = (2r)2/4 (r2)
= 42r2 / 42r2 = 1

Long skinny blobs will have a high value for compactness.

Electrical Engineering Design Project - Fall 2002

Other Features
Formfactor A B C D 0.257 0.256 0.459 0.457 Aspect Ratio 1.339 2.005 1.294 2.017

Roundness A B C D 0.587 0.584 0.447 0.589

Convexity 0.351 0.483 0.349 0.497

Solidity 0.731 0.782 0.592 0.714

Compactness 0.766 0.764 0.668 0.768

Electrical Engineering Design Project - Fall 2002

Pattern Classification

Electrical Engineering Design Project - Fall 2002

Simple Pattern Classification


Nearest neighbor N nearest neighbors

sample

Electrical Engineering Design Project - Fall 2002

Next Day - Robotics

Electrical Engineering Design Project - Fall 2002

You might also like