Loading...

PPT – Point Operations and The Histogram PowerPoint presentation | free to view - id: 1897e9-ZDc1Z

The Adobe Flash plugin is needed to view this content

Point Operations and The Histogram

Image Processing - Lesson 3

Image Operations

- Pixel Operations
- Operation depends on Pixel's value.
- Context free.
- Operation can be performed on the Histogram.
- Example
- Geometric Operations
- Operation depend on Pixel's coordinates.
- Context free.
- Independent of pixels value.
- Example
- Spatial Operations
- Operation depends on Pixel's value and

coordinates. - Context dependent.
- Binary v.s. Gray-Scale images.
- Spatial v.s. Frequency domain.
- Example

The Image Histogram

- Point operations depend on pixels value and can

be performed on image histogram. - Image Histogram
- Normalized Histogram
- where N is the total number of pixels in the

image I. - PI(k) defines the probability to get the value k

in the image I. - Accumulated Histogram
- A(k) is the prob. that a pixel has a value less

or equal to k - Note that A(k)-A(k-1)P(k)

HI(k) pixels with gray-level k

PI(k)H(k)/N

Histogram

15000

10000

5000

0

1

2

3

4

5

6

7

8

9

10

gray level

Normalized Histogram

0.25

0.2

0.15

0.1

0.05

0

1

2

3

4

5

6

7

8

9

10

gray level

Accumulated Histogram

1

0.8

0.6

0.4

0.2

0

1

2

3

4

5

6

7

8

9

10

gray level

The Image Histogram (Cont.)

PI(k)

1

k

PI(k)

1

0.5

k

PI(k)

0.1

k

- Decreasing the image contrast
- Increasing the new image average

PI(k)

0.1

k

0.5

PI(k)

0.1

k

PI(k)

0.1

k

Histogram properties

- The image mean
- The image s.t.d.

mean

std

Uses of the Histogram

- Digitizing parameters
- Auto focus
- Enhancement
- Histogram equalization
- Histogram stretching
- Threshold selection
- Histogram matching

Auto-Focus

- In some optical equipment (e.g. slide projectors)

inappropriate lens position creates a blurred

(out-of-focus) image. - We would like to automatically adjust the lens.

Demo

- Blurred image can be detected by its histogram
- Image mean is not affected by blurring.
- Image s.t.d. is decreased by blurring.
- Algorithm Adjust lens according the changes in

the histogram s.t.d.

Thresholding

knew

F(k)

255

kold

255

Threshold value

Thresholding Value

Original Image

Binary Image

Threshold too high

Threshold too low

Segmentation using Thresholding

Original

Histogram

50

75

Threshold 75

Threshold 50

Original

Histogram

21

Threshold 21

Point Operations

- A point operation can be defined as a function
- knewF(kold)
- F(k) takes any value kold in the source image

into knew in the destination image. - Example knewF(kold)kold10
- increasing brightness
- knewF(kold)round(kold0.8)
- decreasing contrastbrightness

Point Operations

- Simplest case - Linear Mapping

knew

F(k)

q

p

kold

p

q

- If it is required to map the full gray-level

range (256 values) to its full range - A

piecewise linear mapping is required

knew

F(k)

255

stretching

kold

255

contraction

Clipping Function

- If most of the gray-levels in the image are in

u1 u2, the following mapping increases the

image contrast. - What is F(k)?

knew

F(k)

255

kold

u1

u2

255

knew

255

F(k)

kold

255

?

Applying Point Operations on an image

- Given a point operation
- kbF(ka)
- F(ka) takes any value ka in image A into kb in

image B.

kb

F(k)

ka

Image Statistics (Histograms)

Ia

Ha

Aa

F(k)

Ib

Ab

Hb

Histogram of Ia differs from that of Ib.

Is it possible to obtain Hb directly from Ha and

F(k)?

k

kb

F(k)

ka

Hb

Ha

k

Is it possible to obtain Ab directly from Aa and

F(k)?

- Requirement F is an increasing function
- (F-1 exists).
- Since F(k) is monotonic, the area under Ha

between 0 and ka is equal to the area under Hb

between 0 and kb

k

kb

F(k)

ka

Hb

Ha

k

The histogram of image B can be calculated

Ia

Ha

Aa

F(k)

Ib

Ab

Hb

If F(k) is not increasing?

- Requirement F is a non-decreasing function

(F-1 may/may not exists).

k

kb

F(k)

ka

Hb

Ha

k

- Is it possible to obtain F(k) directly from Ha

and Hb (Aa and Ab)?

Ia

Ha

Aa

F(k)

Ib

Ab

Hb

Example Finding F(k) for Gray Level Separation

Visual discrimination between objects depends on

the their gray-level separation. Can we improve

discrimination AFTER image has been quantized?

Hard to discriminate

3 4

Doesnt help

23 24

This is better

23

3

??????

3 4

23 24

Histogram Equalization

- For better visual discrimination we would like to

re-assign gray-levels with maximal uniformity. - Define a gray-level transformation
- such that
- The histogram Hb is as flat as possible.
- The order of Gray-levels is maintained.
- The histogram bars are not fragmented.

Hb

Ha

k

k

Histogram Equalization

Ha

Hb

k

k

Aa

Ab

k

k

Define

Histogram Equalization 2 Pointer Algorithm

Method Aa -gt Ab

Original

Goal

Aa

Ab

k

k

j Pnew

Histogram Equalization 2 Pointer Algorithm

Method Ha -gt Hb

Original

Goal

Pnew

old

0 1 2 3 4 5 6 7 8 9 10 11 0 0 0 1 1 1 3 5 8 9 9

11

new

30

25

20

15

10

5

0

0

1

2

3

4

5

6

7

8

9

10

11

old

0 1 2 3 4 5 6 7 8 9 10 11 0 0 0 1 1 1 3 5 8 9 9

11

new

(No Transcript)

Histogram Equalization - Example

Original

Equalized

Demo

2 Pointer Algorithm

2-pointer Histogram Equalization Algorithm

Pold 0 Pnew 0 E_levelsum(Hist)/K

BucketE_level while (Pold ? k) if

Hist(Pold) lt Bucket Bucket

Bucket - Hist(Pold) New_Gray(Pold) Pnew

Pold else Hist(Pold)

Hist(Pold)-Bucket Bucket E_level Pnew

end end

K number of gray-level values. Hist A vector

with the original histogram. New_gray A vector

with the gray-level transformation.

Histogram Matching

- Transforms an image A so that its histogram

matches that of another image B. - Could be used before comparing two images of the

same scene acquired under different lighting

condition.

Aa

Ab

D

D

Application Texture Synthesis (Heeger Bergen

1995)