Vous êtes sur la page 1sur 14

Histograms

CS 4640: Image Processing Basics

January 19, 2012


Histograms

Definition
A histogram is a function that gives the frequency of
intensities that occur in an image.

So, given an image I : [0, K 1], the histogram


for I is the function

h(i) = card{(u, v)| I(u, v) = i}.


In other words

h(i) = the number of pixels with intensity i


Histograms
How Image Properties Show Up in
Histograms (ImageJ Examples)

I Over or Under Exposure


I Brightness
I Contrast
I Dynamic Range
How Simple Point Operations Affect
Histograms (ImageJ Examples)

I Addition
I Multiplication
I Exp and Log
I Intensity Windowing (Contrast Modification)
Histograms For More Than 8 Bits

Definition
A binned histogram is a function that gives the
frequency of image intensities that fall into small
intervals, or bins.

So, given the image I : [0, K 1], the binned


histogram for I is the function

h(i) = card{(u, v)| ai I(u, v) < ai+1 },

where 0 = a0 < a1 < . . . < aB = K .

Typically, we choose equally spaced bins: ai = iK/B


Images And Probability

Histograms can be interpreted as probabilities.

Question: If I pick a pixel from an image at random,


what is the probability that the pixel has intensity i?
# pixels with value i
Answer: P(I(u, v) = i) = total # pixels

Or, in terms of the histogram h:

P(I(u, v) = i) = h(i)/wh
Sample Space

Definition
A sample space is a pair (S, P), where S is a set of
possible outcomes, and P : S R is a function that
satisfies P(s) 0 for all s S and
X
P(s) = 1.
sS
Sample Space for Images

Given an image I(u, v), we can define the S as the set of


possible outcomes, i.e., possible intensities of a pixel.
So, S = [0, K 1].

The probability function P is defined via the histogram:

P(i) = h(i)/wh
Events

Definition
Let (S, P) be a sample space. An event is a subset
A S. The probability of an event is
X
P(A) = P(a)
aA
Some Possible Events for an Image Pixel
I A = The pixel has value i

P(A) = P(i) = h(i)/wh

I A = The pixel has value < t


t1
X
P(A) = P(a)
a=0

I A = The pixel value is in the interval [70, 93]


93
X
P(A) = P(a)
a=70
Random Variables

Definition
A random variable is a function defined on a probability
space. In other words, if (S, P) is a sample space, then a
random variable is a function X : S V for some set V .

I A random variable is neither random nor a variable!


I We will only be worried about the identity function
X(i) = i.
I I will use the notation I to denote an image, or the
random variable associated with it.
Expectation

Definition
Let X be a real-valued random variable defined on a
sample space (S, P). The expectation, or expected
value, of X is
X
E(X) = X(s) P(s)
sS
Expectation of Pixel Values

Keep in mind: P(i) = h(i)/wh

Mean of an image:

K1
X
= E(I) = i P(i)
i=0

Vous aimerez peut-être aussi