33
1 Digital Image Fundamentals Chapter Two Instructor: Hossein Pourghassem 2 Human Visual Perception

Digital Image Fundamentals - IAUNresearch.iaun.ac.ir/pd/pourghassem/pdfs/UploadFile_6873.pdf · Digital Image Fundamentals ... Sampling & Quantization Usually, in DIP these quantities

Embed Size (px)

Citation preview

Page 1: Digital Image Fundamentals - IAUNresearch.iaun.ac.ir/pd/pourghassem/pdfs/UploadFile_6873.pdf · Digital Image Fundamentals ... Sampling & Quantization Usually, in DIP these quantities

1

Digital Image Fundamentals

Chapter TwoInstructor: Hossein Pourghassem

2

Human Visual Perception

Page 2: Digital Image Fundamentals - IAUNresearch.iaun.ac.ir/pd/pourghassem/pdfs/UploadFile_6873.pdf · Digital Image Fundamentals ... Sampling & Quantization Usually, in DIP these quantities

2

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 3

Human Visual Perception

requires some knowledge of how we see

colors

requires some knowledge of how we see

colors

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 4

Eye’s Light Sensors

#(blue) << #(red) < #(green)

cone density near fovea

Page 3: Digital Image Fundamentals - IAUNresearch.iaun.ac.ir/pd/pourghassem/pdfs/UploadFile_6873.pdf · Digital Image Fundamentals ... Sampling & Quantization Usually, in DIP these quantities

3

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 5

The Human Eye

Diameter: 20 mm

3 membranes enclose the eyeCornea (قرينه) & sclera (صلبيه).Choroid .(استري)Retina (شبكيه) .

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 6

The ChoroidThe choroid contains blood vessels for eye nutrition and is heavily pigmented to reduce extraneous light entrance and backscatter.

It is divided into the ciliary body and the iris diaphragm, which controls the amount of light that enters the pupil (2 mm ~ 8 mm).

Page 4: Digital Image Fundamentals - IAUNresearch.iaun.ac.ir/pd/pourghassem/pdfs/UploadFile_6873.pdf · Digital Image Fundamentals ... Sampling & Quantization Usually, in DIP these quantities

4

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 7

The LensThe lens is made up of fibrous cells and is suspended by fibers that attach it to the ciliary body.

It is slightly yellow and absorbs approx. 8% of the visible light spectrum.

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 8

The RetinaThe retina lines the entire posterior portion.

Discrete light receptors are distributed over the surface of the retina:

cones (6-7 million per eye) and rods (75-150 million per eye)

Page 5: Digital Image Fundamentals - IAUNresearch.iaun.ac.ir/pd/pourghassem/pdfs/UploadFile_6873.pdf · Digital Image Fundamentals ... Sampling & Quantization Usually, in DIP these quantities

5

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 9

ConesCones are located in the fovea and are sensitive to color.

Each one is connected to its own nerve end.

Cone vision is called photopic (or bright-light vision).

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 10

RodsRods are giving a general, overall picture of the field of view and are not involved in color vision.

Several rods are connected to a single nerve and are sensitive to low levels of illumination (scotopic or dim-light vision).

Page 6: Digital Image Fundamentals - IAUNresearch.iaun.ac.ir/pd/pourghassem/pdfs/UploadFile_6873.pdf · Digital Image Fundamentals ... Sampling & Quantization Usually, in DIP these quantities

6

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 11

Receptor DistributionThe distribution of receptors is radially symmetric about the fovea.

Cones are most dense in the center of the fovea while rods increase in density from the center out to approximately 20% off axis and then decrease.

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 12

Cones and Rods Distribution

Page 7: Digital Image Fundamentals - IAUNresearch.iaun.ac.ir/pd/pourghassem/pdfs/UploadFile_6873.pdf · Digital Image Fundamentals ... Sampling & Quantization Usually, in DIP these quantities

7

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 13

The FoveaThe fovea is circular (1.5 mm in diameter) but can be assumed to be a square sensor array (1.5 mm x 1.5 mm).

The density of cones: 150,000 elements/mm2 ~ 337,000 for the fovea.

A CCD imaging chip of medium resolution needs 5 mm x 5 mm for this number of elements

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 14

Image Formation in the EyeThe eye lens (if compared to an optical lens) is flexible.

It gets controlled by the fibers of the ciliary body and to focus on distant objects it gets flatter (and vice versa).Distance between the center of the lens and the retina (focal length):

varies from 17 mm to 14 mm (refractive power of lens goes from minimum to maximum).

Objects farther than 3 m use minimum refractive lens powers (and vice versa).

Page 8: Digital Image Fundamentals - IAUNresearch.iaun.ac.ir/pd/pourghassem/pdfs/UploadFile_6873.pdf · Digital Image Fundamentals ... Sampling & Quantization Usually, in DIP these quantities

8

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 15

Image Formation in the EyeExample:

Calculation of retinal image of an object

1710015 x

=

mmx 55.2=

Perception takes place by the relative excitation of light receptors.

These receptors transform radiant energy into electrical impulses that are ultimately decoded by the brain.

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 16

Brightness Adaptation & Discrimination

Range of light intensity levels to which HVS (human visual system) can adapt: on the order of 1010.

Subjective brightness (i.e. intensity as perceived by the HVS) is a logarithmic function of the light intensity incident on the eye.

Page 9: Digital Image Fundamentals - IAUNresearch.iaun.ac.ir/pd/pourghassem/pdfs/UploadFile_6873.pdf · Digital Image Fundamentals ... Sampling & Quantization Usually, in DIP these quantities

9

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 17

Brightness Adaptation & Discrimination

The HVS cannot operate over such a range simultaneously.

For any given set of conditions, the current sensitivity level of HVS is called the brightness adaptation level.

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 18

Brightness Adaptation & Discrimination

Page 10: Digital Image Fundamentals - IAUNresearch.iaun.ac.ir/pd/pourghassem/pdfs/UploadFile_6873.pdf · Digital Image Fundamentals ... Sampling & Quantization Usually, in DIP these quantities

10

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 19

Brightness Adaptation & Discrimination

The eye also discriminates between changes in brightness at any specific adaptation level.

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 20

Brightness Adaptation & Discrimination

Page 11: Digital Image Fundamentals - IAUNresearch.iaun.ac.ir/pd/pourghassem/pdfs/UploadFile_6873.pdf · Digital Image Fundamentals ... Sampling & Quantization Usually, in DIP these quantities

11

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 21

Brightness Adaptation & Discrimination

Small values of Weber ratio mean good brightness discrimination, and brightness discrimination is poor (the Weberratio is large) at low levels of illumination.

At low levels of illumination brightness discrimination is poor (rods) and it improves significantly as background illumination increases (cones).

The two branches in the curve reflect the fact that at low levels of illumination vision is carried out by activity of the rods, whereas at high levels (showing better discrimination) vision is the function of cones.

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 22

Brightness Adaptation & Discrimination

Perceived brightness is not a simple function of intensity, for example:

Scalloped effect (Mach band pattern), the visual system tends toundershoot or overshoot around the boundary of regions of different intensities.Simultaneous contrast (A region ‘s perceived brightness does not depend simply on its intensity).

Page 12: Digital Image Fundamentals - IAUNresearch.iaun.ac.ir/pd/pourghassem/pdfs/UploadFile_6873.pdf · Digital Image Fundamentals ... Sampling & Quantization Usually, in DIP these quantities

12

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 23

Perceived Brightness

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 24

Simultaneous Contrast

All the inner squares have the same intensity, but they appear progressively darker as the background becomes lighter.

Page 13: Digital Image Fundamentals - IAUNresearch.iaun.ac.ir/pd/pourghassem/pdfs/UploadFile_6873.pdf · Digital Image Fundamentals ... Sampling & Quantization Usually, in DIP these quantities

13

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 25

Optical Illusions

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 26

Electromagnetic SpectrumhfE

fc

==λ

Page 14: Digital Image Fundamentals - IAUNresearch.iaun.ac.ir/pd/pourghassem/pdfs/UploadFile_6873.pdf · Digital Image Fundamentals ... Sampling & Quantization Usually, in DIP these quantities

14

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 27

Image Sensor

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 28

Image Sensor (Single Sensor)

Page 15: Digital Image Fundamentals - IAUNresearch.iaun.ac.ir/pd/pourghassem/pdfs/UploadFile_6873.pdf · Digital Image Fundamentals ... Sampling & Quantization Usually, in DIP these quantities

15

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 29

Image Sensor (Sensor Strips)

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 30

Digital Image Acquisition

Page 16: Digital Image Fundamentals - IAUNresearch.iaun.ac.ir/pd/pourghassem/pdfs/UploadFile_6873.pdf · Digital Image Fundamentals ... Sampling & Quantization Usually, in DIP these quantities

16

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 31

A Simple Image ModelImage: a 2-D light-intensity function f(x,y)

The value of f at (x,y) the intensity (brightness) of the image at that point:

0 < f(x,y) < ∞

Nature of f(x,y):The amount of source light incident on the scene being viewed.The amount of light reflected by the objects in the scene.

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 32

A Simple Image Model

Illumination & reflectance components:

Illumination: i(x,y)Reflectance: r(x,y)

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

0 < i(x,y) < ∞ and 0 < r(x,y) < 1(from total absorption to total reflectance)

Page 17: Digital Image Fundamentals - IAUNresearch.iaun.ac.ir/pd/pourghassem/pdfs/UploadFile_6873.pdf · Digital Image Fundamentals ... Sampling & Quantization Usually, in DIP these quantities

17

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 33

A Simple Image Model

Sample values of r(x,y):0.01: black velvet0.93: snow

Intensity of a monochrome image f at (xo,yo): gray level (l) of the image at that point,l=f(xo, yo)Lmin ≤ l ≤ Lmax

Where Lmin: positiveLmax: finite

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 34

A Simple Image Model

In practice:Lmin = imin rmin and Lmax = imax rmax

E.g. for indoor image processing:Lmin ≈ 10 Lmax ≈ 1000

[Lmin, Lmax] : gray scaleOften shifted to [0,L-1] l=0: black

l=L-1: white

Page 18: Digital Image Fundamentals - IAUNresearch.iaun.ac.ir/pd/pourghassem/pdfs/UploadFile_6873.pdf · Digital Image Fundamentals ... Sampling & Quantization Usually, in DIP these quantities

18

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 35

Sampling & Quantization

The spatial and amplitude digitization of f(x,y) is called:

Image sampling when it refers to spatial coordinates (x,y) and

Gray-level quantization when it refers to the amplitude.

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 36

Digital Image

Page 19: Digital Image Fundamentals - IAUNresearch.iaun.ac.ir/pd/pourghassem/pdfs/UploadFile_6873.pdf · Digital Image Fundamentals ... Sampling & Quantization Usually, in DIP these quantities

19

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 37

Sampling and Quantization

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 38

A Digital Image

Page 20: Digital Image Fundamentals - IAUNresearch.iaun.ac.ir/pd/pourghassem/pdfs/UploadFile_6873.pdf · Digital Image Fundamentals ... Sampling & Quantization Usually, in DIP these quantities

20

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 39

Sampling & Quantization

⎥⎥⎥⎥

⎢⎢⎢⎢

−−−−

−−

=

)1,1(...)1,1()0,1(............

)1,1(......)0,1()1,0(...)1,0()0,0(

),(

MNfNfNf

MffMfff

yxf

Digital Image Image Elements(Pixels)

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 40

Sampling & Quantization

Sampling: partitioning xy plane into a grid

the coordinate of the center of each grid is a pair of elements from the Cartesian product Z x Z (Z2)

Z2 is the set of all ordered pairs of elements (a,b) with a and b being integers from Z.

Z: set of real integers.

R: set of real numbers.

Page 21: Digital Image Fundamentals - IAUNresearch.iaun.ac.ir/pd/pourghassem/pdfs/UploadFile_6873.pdf · Digital Image Fundamentals ... Sampling & Quantization Usually, in DIP these quantities

21

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 41

Sampling & Quantizationf(x,y) is a digital image if:

(x,y) are integers from Z2 andf is a function that assigns a gray-level value (from Z) to each distinct pair of coordinates (x,y) [quantization]

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 42

Sampling & Quantization

The digitization process requires decisions about:

values for N,M (where N x M: the image array) and

the number of discrete gray levels allowed for each pixel (G).

Page 22: Digital Image Fundamentals - IAUNresearch.iaun.ac.ir/pd/pourghassem/pdfs/UploadFile_6873.pdf · Digital Image Fundamentals ... Sampling & Quantization Usually, in DIP these quantities

22

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 43

Sampling & Quantization

Usually, in DIP these quantities are integer powers of two:N=2n M=2m and G=2k

number of gray levels

Another assumption is that the discrete levels are equally spaced between 0 and L-1 in the gray scale.

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 44

Sampling & Quantization

If b is the number of bits required to store a digitized image then:

b = N x M x k (if M=N, then b=N2k)

Page 23: Digital Image Fundamentals - IAUNresearch.iaun.ac.ir/pd/pourghassem/pdfs/UploadFile_6873.pdf · Digital Image Fundamentals ... Sampling & Quantization Usually, in DIP these quantities

23

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 45

Storage

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 46

Sampling & Quantization

How many samples and gray levels are required for a good approximation?

Spatial resolution (the degree of distinguishable detail) of an image depends on the number of sample and gray level resolution depends on the number of gray level.i.e. the more these parameters are increased, the closer the digitized array approximates the original image.

Page 24: Digital Image Fundamentals - IAUNresearch.iaun.ac.ir/pd/pourghassem/pdfs/UploadFile_6873.pdf · Digital Image Fundamentals ... Sampling & Quantization Usually, in DIP these quantities

24

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 47

Sampling & QuantizationHow many samples and gray levels are required for a good approximation? (cont.)

But: storage & processing requirements increase rapidly as a function of N, M, and k

Different versions (images) of the same object can be generated through:

Varying N, M numbersVarying k (number of bits)Varying both

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 48

Examples

Page 25: Digital Image Fundamentals - IAUNresearch.iaun.ac.ir/pd/pourghassem/pdfs/UploadFile_6873.pdf · Digital Image Fundamentals ... Sampling & Quantization Usually, in DIP these quantities

25

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 49

Examples

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 50

Examples

Page 26: Digital Image Fundamentals - IAUNresearch.iaun.ac.ir/pd/pourghassem/pdfs/UploadFile_6873.pdf · Digital Image Fundamentals ... Sampling & Quantization Usually, in DIP these quantities

26

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 51

Examples

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 52

Sampling & Quantization

Isopreference curves (in the N-k plane)

Each point: image having values of N and k equal to the coordinates of this point.

Points lying on an isopreference curve correspond to images of equal subjective quality.

Page 27: Digital Image Fundamentals - IAUNresearch.iaun.ac.ir/pd/pourghassem/pdfs/UploadFile_6873.pdf · Digital Image Fundamentals ... Sampling & Quantization Usually, in DIP these quantities

27

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 53

Examples

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 54

Isopreference Curves

Page 28: Digital Image Fundamentals - IAUNresearch.iaun.ac.ir/pd/pourghassem/pdfs/UploadFile_6873.pdf · Digital Image Fundamentals ... Sampling & Quantization Usually, in DIP these quantities

28

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 55

Sampling & Quantization

Conclusions:Quality of images increases as N & k increase.

Sometimes, for fixed N, the quality improved by decreasing k (increased contrast).

For images with a large amount of detail only a few gray levels may be needed. (isopreference curves tend to become more vertical as the detail in the image increases).

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 56

Aliasing and Moiré Patterns

Page 29: Digital Image Fundamentals - IAUNresearch.iaun.ac.ir/pd/pourghassem/pdfs/UploadFile_6873.pdf · Digital Image Fundamentals ... Sampling & Quantization Usually, in DIP these quantities

29

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 57

Zooming and Shrinking Digital Images

Zooming may be viewed as over-sampling, while shrinking may be viewed as under-sampling. Zooming requires two steps: the creation of new pixel locations, and the assignment of gray levels to those new locations.

Nearest neighbor interpolationBilinear interpolation.Cubic interpolation.

Image shrinking is done in a similar manner as described for zooming.

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 58

Example

Page 30: Digital Image Fundamentals - IAUNresearch.iaun.ac.ir/pd/pourghassem/pdfs/UploadFile_6873.pdf · Digital Image Fundamentals ... Sampling & Quantization Usually, in DIP these quantities

30

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 59

Some Basic Relationships Between Pixels

Definitions:

f(x,y): digital imagePixels: q, pSubset of pixels of f(x,y): S

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 60

Neighbors of a PixelA pixel p at (x,y) has 2 horizontal and 2 vertical neighbors:

(x+1,y), (x-1,y), (x,y+1), (x,y-1)This set of pixels is called the 4-neighbors of p: N4(p)

The 4 diagonal neighbors of p are: (ND(p))

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

N4(p) + ND(p) N8(p): the 8-neighbors of p.

Page 31: Digital Image Fundamentals - IAUNresearch.iaun.ac.ir/pd/pourghassem/pdfs/UploadFile_6873.pdf · Digital Image Fundamentals ... Sampling & Quantization Usually, in DIP these quantities

31

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 61

Region and BoundaryRegion: R a subset of pixels is a region if R is a connected set.

Its boundary (border, contour) is the set of pixels in R that have at least one neighbor not in R

Edge can be the region boundary (in binary images)

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 62

Distance MeasuresFor pixels p,q,z with coordinates (x,y), (s,t), (u,v), D is a distance function or metric if:

D(p,q) ≥ 0 (D(p,q)=0 iff p=q)D(p,q) = D(q,p) andD(p,z) ≤ D(p,q) + D(q,z)

Page 32: Digital Image Fundamentals - IAUNresearch.iaun.ac.ir/pd/pourghassem/pdfs/UploadFile_6873.pdf · Digital Image Fundamentals ... Sampling & Quantization Usually, in DIP these quantities

32

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 63

Distance Measures

Euclidean distance:

De(p,q) = [(x-s)2 + (y-t)2]1/2

Points (pixels) having a distance less than or equal to r from (x,y) are contained in a disk of radius r centered at (x,y).

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 64

Distance Measures

D4 distance (city-block distance):

D4(p,q) = |x-s| + |y-t|forms a diamond centered at (x,y)e.g. pixels with D4≤2 from p

2212

21012212

2

D4 = 1 are the 4-neighbors of p

Page 33: Digital Image Fundamentals - IAUNresearch.iaun.ac.ir/pd/pourghassem/pdfs/UploadFile_6873.pdf · Digital Image Fundamentals ... Sampling & Quantization Usually, in DIP these quantities

33

Islamic Azad University of Najafabad, Department of Electrical Engineering, Dr. H. Pourghassem, 65

Distance Measures

D8 distance (chessboard distance):

D8(p,q) = max(|x-s|,|y-t|)Forms a square centered at pe.g. pixels with D8≤2 from p

2222221112210122111222222

D8 = 1 are the 8-neighbors of p