Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
39 views

Computer Assisted Image Analysis Lecture 2 - Point Processing

This document provides an overview of point processing techniques in image analysis. It discusses how point processing operates on individual pixels rather than neighborhoods. Specific point processing techniques covered include gray level transformations like brightness and contrast adjustments, log transforms, and histogram equalization. Histogram equalization aims to create an image with an evenly distributed histogram for enhanced contrast by transforming pixels based on the cumulative distribution function. The document also briefly discusses arithmetic and logical operations that can combine pixel values from multiple images.

Uploaded by

Some User
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views

Computer Assisted Image Analysis Lecture 2 - Point Processing

This document provides an overview of point processing techniques in image analysis. It discusses how point processing operates on individual pixels rather than neighborhoods. Specific point processing techniques covered include gray level transformations like brightness and contrast adjustments, log transforms, and histogram equalization. Histogram equalization aims to create an image with an evenly distributed histogram for enhanced contrast by transforming pixels based on the cumulative distribution function. The document also briefly discusses arithmetic and logical operations that can combine pixel values from multiple images.

Uploaded by

Some User
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 41

1/41

Computer Assisted Image Analysis


Lecture 2 – Point Processing

Anders Brun (anders@cb.uu.se)


Centre for Image Analysis
Swedish University of Agricultural Sciences
Uppsala University
Reading Instructions 2/41
Chapters for this lecture

• Chapter 2.6 2.6.4 and 3.1 3.3 in


Gonzales-Woods.
Previous Lecture 3/41
Digitization

Digital images
• Images denoted by functions, e.g. f (x, y) or g(x, y)
• Sampling in space, e.g. (x, y) 2 I and ||I|| = N , where I is a
discrete set of pixel positions.
• Quantization in amplitude (intensity),
f (x, y) 2 {0, 1, . . . (L 1)}
Image Processing 4/41
In image processing, the operator T transforms the input image
into an output image, g(x, y) = T (f (x, y)).

Typical examples of image processing


• Image restoration: reduce noise and imaging artefacts
• Image enhancement: enhance edges, lines and subtle features
for easier visual inspection
• Feature extraction, as input to subsequent image analysis

Image processing does NOT increase image information!


Image Processing 5/41

• Spatial domain (lectures 2, and 3)


• Brightness transforms, works per pixel ! point processing,
• Spatial filters, local transforms, works on small neighborhoods,
• Geometric transforms, interpolation,
• Frequency domain (lecture 4 and 5).
• The Fast Fourier Transform (FFT)
• Lowpass-, bandpass- and highpass filters,
• The Wiener filter
Image Processing 6/41
In spatial domain processing, the operator T is applied to each
position (x, y) in the input image f , defined over some
neighborhood of (x, y), yielding a value s = g(x, y) as output.

g(x, y) = T [f (x, y)]

In point processing, the operator neighborhood is the pixel itself.

s = T (r), where r = f (x, y), s = g(x, y).

In spatial filtering, larger neighborhoods are used. They are


referred to as masks, filters, kernel windows or templates.

Point processing Spatial filters


Gray Level Transform 7/41

Pixel-wise transform
• Change the gray level for each individual pixel.
• Compare to television: Brightness and contrast
• brightness: addition
• contrast: multiplication

> 45 ! increased contrast


< 45 ! decreased contrast
up ! increased brightness
down ! decreased brightness
Image Histograms 8/41
A gray level histogram shows how many pixels there are at each
intensity level. The bars either sum up to the total number of
pixels, or to 1 (normalized) in a histogram.
Image Processing 9/41
Brightness

Subtract. Add.
Image Processing 10/41
Contrast

Multiply
Gray Level Transformations 11/41
Some basic gray level transformation functions used for image
enhancement.
Gray Level Transformations 12/41
Gray Level Transformations 13/41
Negative or positive

• Original digital mammogram (left).


• Image negative to enhance white or gray details embedded in
dark regions (right).
Gray Level Transformations 14/41
Log transformations

Visualize patterns in the dark region of an image


• Fourier spectrum (left).
• Result of applying the log transform (right).
Histogram Equalization 15/41

Idea: Create an image with evenly distributed gray levels, for


visual contrast enhancement
• The normalized gray level histogram gives the probability for a
pixel to have a certain gray level, pk = nk /N
• Transform the image using the cumulative density function,
Pk R k
cdf(k) = i=0 pi (or = i=0 p(i)di in the continuous case)
Histogram Equalization 16/41

• Continuous formula, where p(i) is the probability measure of


the i grayvalue in the image if s, r 2 [0, L]
Rr
s = T (r) = L i=0 p(i) = L cdf(r)

• Discrete formula, where ni is the number of pixels with


intensity i and N is the total number of pixels and sk and
rk 2 {0, 1, . . . , (L 1)} :
Pk
j=0 nj
sk = T (rk ) = (L 1) N

• Both formulas try to stretch rmin to 0 and rmax to either L


or (L 1) (But do they succeed?)
• The histogram for the output image is uniform (theoretically
in the continuous case), why not in our digital images?
Histogram Equalization 17/41
Why does this work?
• Let pr be the normalized histogram (probability function) for
the input image f (x, y)
Rr
• Transform f (x, y) using s = T (r) = L 0 pr (w)dw
⇥R r ⇤
ds
• Leibniz´s Rule dr = dTdr(r) = L dr
d
0 pr (w)dw = Lpr (r).
• Then from probability theory we have a formula for the
probability density function (histogram) of the transformed
variable (image), ps

dr
ps = pr (r)| |
ds
1
= pr (r)
Lpr (r)
= 1/L
Histogram Equalization 18/41

Original image.

Result of histogram equalization.


Histogram Equalization Example 19/41

Intensity 0 1 2 3 4 5 6 7
Number of pixels 10 20 12 8 0 0 0 0

p(0) = 10/50 = 0.2


p(1) = 20/50 = 0.4
p(2) = 12/50 = 0.24
p(3) = 8/50 = 0.16
p(r) = 0/50 = 0, r = 4, 5, 6, 7
Histogram Equalization Example (cont.) 20/41
Pk
j=0 nj
Pk
sk = T (rk ) = (L 1) N = (L 1) j=0 p(j)

T (0) = 7 ⇤ (p(0)) ⇡ 1
T (1) = 7 ⇤ (p(0) + p(1)) ⇡ 4
T (2) = 7 ⇤ (p(0) + p(1) + p(2)) ⇡ 6
T (3) = 7 ⇤ (p(0) + p(1) + p(2) + p(3)) = 7
T (r) = 7, r = 4, 5, 6, 7
Intensity 0 1 2 3 4 5 6 7
Number of pixels 0 10 0 0 20 0 12 8
Histogram Equalization 21/41
Example: Original image f (x, y)
Histogram Equalization 22/41
Example: Histogram
Histogram Equalization 23/41
Example: Normalized histogram
Histogram Equalization 24/41
Example: Cumulative histogram
Histogram Equalization 25/41
Example: Normalized cumulative histogram
Histogram Equalization 26/41
Example: Histogram equalization transform
Histogram Equalization 27/41
Example: Histogram equalization
Histogram Equalization 28/41
Example: Equalized histograms
Histogram Equalization 29/41

Transformations for image 1 4.


Note that the transform for figure
4 (dashed line) is close to the
neutral transform (dotted line).
Histogram Equalization 30/41
Not always “optimal” for visual quality

Original. Equalized. Manual choice.


Histogram Equalization 31/41

Transformations for image 1 4.


Note that the transform for figure
4 (dashed line) is close to the
neutral transform (dotted line).
Histogram Matching 32/41

Transform image f (x, y) to match the histogram of image g(x, y)


• If s = T (r) maps f (x, y) to a uniform histogram
• and u = G(t) maps g(x, y) to a uniform histogram
• Then s = G 1 (T (r)) maps f (x, y) to have a histogram
similar to g(x, y)
Arithmetic/Logical Operations 33/41

• Information from two di↵erent images with the same size can
be combined by adding, subtracting, multiplying or comparing
the pixel values, pixel by pixel. Rounding to fit [0, L 1].
• For enhancement, segmentation, change detection.
Arithmetic/Logical Operations 34/41

Image 1. Image 2.
Arithmetic/Logical Operations 35/41
Enhancement by image subtraction

(a) Mask image.


(b) Image (after injection of dye into the bloodstream) with mask
subtracted out.
Arithmetic/Logical Operations 36/41
Images as Vectors

• We may regard images as vectors, i.e. a ordered set of scalars


• All pointwise arithmetic works for both images and vectors
• In fact, sometimes even the geometrical interpretation of
vectors is natural for images, e.g. orthogonality
• However, by subtracting two images we may end up with
negative pixel values. What is that?! Negative coefficients are
natural for vectors, but not for e.g. light intensities or
densities.
• Solution: Let´s not care too much about that ... Deal with
negative, very large and floating-point values by rounding to
the closest integer in [0, L 1] before saving the resulting
image.
Arithmetic/Logical Operations 37/41
Reduction of noise by averaging

Noise can be reduced by


observing the same scene
over a long period of time,
and averaging the images.
Top: original and a noisy
image. Then noisy images
averaged 8, 16, 64 and
128 times.
Arithmetic/Logical Operations 38/41
Reduction of noise by averaging

• Averaging yields a normally distributed resulting image


(Central Limit Theorem)
• Averaging approaches the expected value of the noisy images
(Law of large numbers)
• The standard deviation, after averaging M noisy uncorrelated
images with standard deviation , is p1 .
M
• (However, this only works for noise or image artefacts with
expectation value zero, i.e. it is fine for Gaussian distributed
noise but not for Poisson distributed noise.)
Linear vs Non-Linear Operations 39/41

• An operator H is linear if
• H[ai f i(x, y) + aj fj (x, y)] = ai H[fi (x, y)] + aj H[fj (x, y)]]
• Linear operators have properties that make them useful in
image analysis, in particular for image filtering
• The class of non-linear operators is huge
• Example: sin is non-linear (“The Freshman´s dream”)
• sin(fi (x, y)) + sin(fj (x, y)) 6= sin(fi (x, y) + fj (x, y))
Review Questions 40/41

• Problems 2.22, 2.18, 2.9, 3.1, 3.5 and 3.6 in


Gonzales-Woods.
• Download answers from
http://www.imageprocessingplace.com.
Until Next Lecture 41/41

• Read, read, read


• Experiment in Matlab
• Do the review questions

You might also like