Digital Image Processing Lecture 2 Tariq Mahmood Khan.

47
Digital Image Processing Lecture 2 Tariq Mahmood Khan

Transcript of Digital Image Processing Lecture 2 Tariq Mahmood Khan.

Page 1: Digital Image Processing Lecture 2 Tariq Mahmood Khan.

Digital Image ProcessingLecture 2

Tariq Mahmood Khan

Page 2: Digital Image Processing Lecture 2 Tariq Mahmood Khan.

Image Processing (Computer Vision) - Recap

“Inverse Photography”

Page 3: Digital Image Processing Lecture 2 Tariq Mahmood Khan.

Stages in Computer Vision

• Physics: Image Formation (Light, Reflectance)

• Physics: Cameras: Optics (Lens), Sensors (CCD, CMOS)

• Image Processing: Coding (Transmission, Compression)

• Image Processing: Enhancement (Noise Cleaning, Colors)

• IP-CV: Feature Detection (Objects, Actions, Motion)

• Computer Vision: Scene recovery (3D, Reflectance)

• Computer Vision: Object Recognition

• Human and Machine Vision: Visual Perception

• Robotics: Control Action (autonomous driving)

Page 4: Digital Image Processing Lecture 2 Tariq Mahmood Khan.

DIP Systems

All digital image processing systems consist of some means to

(1) digitise / acquire the images,

(2) process the images (computing capability),

(3) save the images

(4) produce human readable hardcopy, and

(5) communicate the images to other systems.

Page 5: Digital Image Processing Lecture 2 Tariq Mahmood Khan.

Image Acquisition

• Light is emitted by light source

• Light is reflected from objects

• Reflected light is sensed (captured) by eye or by camera

In general, any sensor which can produce spatially-distributed

intensity values of electromagnetic radiation is suited to

image capturing.

Page 6: Digital Image Processing Lecture 2 Tariq Mahmood Khan.

Types of Image capturing system

• In everyday life a number of image capturing systems

are used, depending on the application field. They

differ in the

– acquisition principle

– acquisition speed

– spatial resolution

– sensor system

Page 7: Digital Image Processing Lecture 2 Tariq Mahmood Khan.

Classification of Sensors

Sensors can be categorized into the following classes according to their sensitivity ranges:

• Electromagnetic sensors - sensitive to a certain range of electromagnetic radiation

– gamma radiation

– X-ray radiation

– the visual spectrum

– the infrared spectrum

– the radio wave range

• Non- Electromagnetic sensors

– ultrasonic sensors

Page 8: Digital Image Processing Lecture 2 Tariq Mahmood Khan.

04/19/23 8

Image Acquisition

Page 9: Digital Image Processing Lecture 2 Tariq Mahmood Khan.

04/19/23 9

Image description

f (x,y): intensity/brightness of the image at spatial coordinates (x,y)

0< f (x,y)<∞ and determined by 2 factors:

Illumination component i(x,y): amount of source light incident

Reflectance component r(x,y): amount of light reflected by objects

f (x,y) = i(x,y) r(x,y)

where

0< i(x,y)<∞: determined by the light source

0< r(x,y)<1: determined by the characteristics of objects

In case of X-rays, we would deal with a transmissivity instead of a

reflectivity

Page 10: Digital Image Processing Lecture 2 Tariq Mahmood Khan.

The Digital Image Formation

The digital image is a numerical computer

representation of the physical image. The physical

image is divided into small regions called picture

elements, or pixels. The number stored in each pixel

represents the brightness of the scene in the designated

region.

Page 11: Digital Image Processing Lecture 2 Tariq Mahmood Khan.

The Digital Image

The conversion process from physical to digital image is

called digitisation. At each pixel location, the

brightness of the physical image is quantized and

converted into an integer number, called the grey level.

Page 12: Digital Image Processing Lecture 2 Tariq Mahmood Khan.

04/19/23 12

Sampling and Quantization

Sampling and quantization

Digital line scan

quantization

Page 13: Digital Image Processing Lecture 2 Tariq Mahmood Khan.

The Digital Image

The image displayed is stored as an array of numbers in the computer memory.

Colour images are sampled 3 times, giving 3 digital images, 1 each for a primary colour variable (RGB, CMY or HSI).

Page 14: Digital Image Processing Lecture 2 Tariq Mahmood Khan.

Digital Image

Each pixel has an

address in the digital

image, i.e. row or line

number and column or

sample number.

Typically, the origin

(x,y)=(0,0) is at the top-left

corner of the image. A

digital image of 640

horizontal pixels and 400

vertical pixels will have

address values of x=0-639

and y=0-399.

Page 15: Digital Image Processing Lecture 2 Tariq Mahmood Khan.

The Digital Image

The digital image should

adequately resolve all spatial

and intensity details of the

original continuous tone

image. The Nyquist

(sampling) theorem

requires that the pixel size

should less than half the size

of the finest detail in the

original image. Likewise, the

gray level brightness

increments should be less

than half the smallest tonal

variation in the original

image.

Page 16: Digital Image Processing Lecture 2 Tariq Mahmood Khan.

The Digital Image

Undersampling

occurs when the

number of pixels in

a digital image is

too low to accurately

represent the fine

details present in the

original image.

Page 17: Digital Image Processing Lecture 2 Tariq Mahmood Khan.

The Digital Image

Undersampling results in

spatial aliasing. The example

shows this effect as Moire

patterns.

Page 18: Digital Image Processing Lecture 2 Tariq Mahmood Khan.

Digital Image: Spatial and Intensity Resolution•Spatial resolution refers to the number of pixels in the digital image. Typically, 256x256 is the minimum acceptable spatial resolution.

•Intensity resolution refers to the number of grey levels available in the digital image.

Page 19: Digital Image Processing Lecture 2 Tariq Mahmood Khan.

Spatial Resolution

Page 20: Digital Image Processing Lecture 2 Tariq Mahmood Khan.

Spatial Resolution

Page 21: Digital Image Processing Lecture 2 Tariq Mahmood Khan.

The Digital Image - Zooming

Although a digital image may appear smooth to the human eye, when zoomed up enough the individual pixels always become visible.

Page 22: Digital Image Processing Lecture 2 Tariq Mahmood Khan.

Intensity Resolution / Grey level Resolution

Intensity resolution refers to the number of grey levels available in the digital image.

(a) 256 grey levels

(b) 128 grey levels

(c) 64 grey levels

(d) 32 grey levels

Page 23: Digital Image Processing Lecture 2 Tariq Mahmood Khan.

Intensity Resolution / Grey level Resolution

For convenient computer storage, the number of grey levels is almost always 2N, N = number of bits.

(e) 16 grey levels

(f) 8 grey levels

(g) 4 grey levels

(h) 2 grey levels

Image (h) is a binary image.

Page 24: Digital Image Processing Lecture 2 Tariq Mahmood Khan.

Intensity Resolution / Grey level Resolution

Typically, the minimum

number of acceptable

grey levels is 16.

Note the introduction of

false contouring when

the brightness

resolution is too low.

Page 25: Digital Image Processing Lecture 2 Tariq Mahmood Khan.

The Digital Image

N : N2 = number of pixels, square digital image.

k: 2k = number of grey levels.

The memory requirements to store digital images is large. One typical high-resolution image requires 1 Megabyte of memory. Colour images require 3X the memory of monochrome images.

Page 26: Digital Image Processing Lecture 2 Tariq Mahmood Khan.

Image Interpolation

• It is a basic tool used extensively in tasks such as zooming,

shrinking, rotating, and geometric corrections.

• Fundamentally, Interpolation is a process of using known

data to estimate values at unknown locations.

Original resampling shrinking zooming

Page 27: Digital Image Processing Lecture 2 Tariq Mahmood Khan.

Image Interpolation

Page 28: Digital Image Processing Lecture 2 Tariq Mahmood Khan.

Image Interpolation

Many methods exist in literature for interpolation such as:

• Pixel Replication / Nearest Neighbor

• Bilinear Interpolation

• Bicubic Interpolation

Page 29: Digital Image Processing Lecture 2 Tariq Mahmood Khan.

Image Interpolation: Nearest Neighbor

• Unknown pixel is assigned a value of its nearest neighbor

Page 30: Digital Image Processing Lecture 2 Tariq Mahmood Khan.

Image Interpolation: Nearest Neighbor

• Unknown pixel is assigned a value of its nearest neighbor

Page 31: Digital Image Processing Lecture 2 Tariq Mahmood Khan.

Image Interpolation: Bilinear Interpolation

f(x, y) = ax + by + cxy + d

coefficients that need to be estimated

• Unknown pixel is estimated using values of four neighbors.

Known pixels

Unknown pixels

Page 32: Digital Image Processing Lecture 2 Tariq Mahmood Khan.

Image Interpolation: Bilinear Interpolation

f(x, y) = ax + by + cxy + d

coefficients that need to be estimated

• Unknown pixel is estimated using values of four neighbors.

? Known pixels

Unknown pixels

Page 33: Digital Image Processing Lecture 2 Tariq Mahmood Khan.

Image Interpolation: Bilinear Interpolation

f(x, y) = ax + by + cxy + d

coefficients that need to be estimated

• Unknown pixel is estimated using values of four neighbors.

? Known pixels

Unknown pixels

Nearest Neighbor pixels

Page 34: Digital Image Processing Lecture 2 Tariq Mahmood Khan.

Image Interpolation: Bilinear Interpolation

f(x, y) = ax + by + cxy + d

coefficients that need to be estimated

• Unknown pixel is estimated using values of four neighbors.

?

ax1 + by1 + cx1y1 + d = f(x1, y1)ax2 + by2 + cx2y2 + d = f(x2, y2)ax3 + by3 + cx3y3 + d = f(x3, y3)ax4 + by4 + cx4y4 + d = f(x4, y4)

1 2

43

a, b, c, d

Page 35: Digital Image Processing Lecture 2 Tariq Mahmood Khan.

Image Interpolation: Bilinear Interpolation

• Unknown pixel is estimated using values of sixteen

neighbors.

Page 36: Digital Image Processing Lecture 2 Tariq Mahmood Khan.

Image Interpolation

Page 37: Digital Image Processing Lecture 2 Tariq Mahmood Khan.

Basic relationships between pixels

Neighbours of a pixel – 4-neighbors

A pixel p at coordinates (x, y) has four horizontal and vertical neighbors whose coordinates are given by

(x+1,y), (x-1,y), (x,y+1), (x,y-1)

This set of pixels, called the 4-neighbors of p, is denoted by N4(p).

Each pixel is a unit distance from (x, y), and some of the neighbors of p lie outside the digital image if (x, y) is on the border of the image.

Page 38: Digital Image Processing Lecture 2 Tariq Mahmood Khan.

Neighbours of a pixel – 8-neighbors

The four diagonal neighbors of p have coordinates(x+1,y+1),(x+1,y-1),(x-1,y+1),(x-1,y-1)

and are denoted by ND(p).

These points, together with the 4-neighbors, are called the 8-neighbors of p, denoted by N8(p).

As before, some of the points in ND(p) and N8(p) fall outside the image if (x, y) is on the border of the image.

Page 39: Digital Image Processing Lecture 2 Tariq Mahmood Khan.

Some Definitions

• Two pixels are said to connected if they are neighbors and if

their gray levels satisfy a specified criterion of similarity (say, if

their gray levels are equal)

• 4-adjacency. Two pixels p and q with values from V are 4-

adjacent if q is in the set N4(p).

• 8-adjacency. Two pixels p and q with values from V are 8-

adjacent if q is in the set N8(p).

• m-adjacency (mixed adjacency). Two pixels p and q with values

from V are m-adjacent if

– q is in N4(p), or

– q is in ND(p) and the set N4(p) N4(q) has no pixels whose

values are from V.

Page 40: Digital Image Processing Lecture 2 Tariq Mahmood Khan.

Basic relationships between pixels

Arrangement of pixels: 0 1 10 1 00 0 1

4 neighbors N4(p): 1 0 1 0 0

Diagonal neighbors ND(p): 0 1 1 0 1

8 neighbors N8 (p) = ND(p) U N4(p) : 0 1 1 0 1 0 0 0 1

Page 41: Digital Image Processing Lecture 2 Tariq Mahmood Khan.

Basic relationships between pixels

Mixed Connectivity:

Note: Mixed connectivity can eliminate the multiple path connections that often occurs in 8-connectivity

Pixel arrangement

8-adjacent to the center pixel

m-adjacency

Page 42: Digital Image Processing Lecture 2 Tariq Mahmood Khan.

Basic relationships between pixels

Path

Let coordinates of pixel p: (x, y), and of pixel q: (s, t)

A path from p to q is a sequence of distinct pixels with

coordinates: (x0, y0), (x1, y1), ......, (xn, yn) where

(x0, y0) = (x, y) & (xn, yn) = (s, t),

and (xi, yi) is adjacent to (xi-1, yi-1) 1 i n

Regions

A set of pixels in an image where all component pixels are

connected

Boundary of a region

A set of pixels of a region R that have one of more

neighbors that are not in R

Page 43: Digital Image Processing Lecture 2 Tariq Mahmood Khan.

Distance Measures

Given coordinates of pixels p, q, and z: (x,y), (s,t), and (u,v)

Euclidean distance between p and q:

• City-block distance between p and q:

• Chessboard distance between p and q:

22 )()(),( tysxqpDe

tysxqpD ),(4

|)||,max(|),(8 tysxqpD

Page 44: Digital Image Processing Lecture 2 Tariq Mahmood Khan.

Image Operation on a Pixel Basis

• when we refer to an operation like “dividing one image by

another,” we mean specifically that the division is carried

out between corresponding pixels in the two images

• Other arithmetic and logic operations are similarly defined

between corresponding pixels in the images involved.

Page 45: Digital Image Processing Lecture 2 Tariq Mahmood Khan.

Liner and Nonlinear Operations

• Let H be an operator whose input and output are images. H

is said to be a linear operator if, for any two images f and g

and any two scalars a and b,

H(af + bg) = aH(f) + bH(g).

• An operator that fails the test of above equation by

definition is nonlinear.

Page 46: Digital Image Processing Lecture 2 Tariq Mahmood Khan.

Reading Assignment

• Chapter 2 (2.3-2.6) of “Digital Image Processing” by

Gonzalez.

Page 47: Digital Image Processing Lecture 2 Tariq Mahmood Khan.

Assignment

1. Interpolate the following image of size 4x4 to size 8x8 by using:

Nearest Neighbor Interpolation

Bilinear Interpolation

3 1 2 1

2 2 0 2

1 2 1 1

1 0 1 2

2. Prob # 2.11 and 2.15 of textbook

Due Date 17/09/2012