Sie sind auf Seite 1von 37

Some Basic Gray Level Transformations

Discussing gray-level transformation functions. The value of pixels, before and after processing are related by an expression of the form
s = T(r)

Where r is values of pixel before process s is values of pixel after process T is a transformation that maps a pixel value r into a pixel value s.

Gray Level Transformations


Image Negatives Log Transformations Exponential Transformations Power-Law Transformations

Image Negatives
The negative of an image with gray L levels is given by the expression
s=L1r

Where r is value of input pixel, and s is value of processed pixel

Log Transformations
The general form of the log transformation shown in
s = c log(1+r) Where c is constant, and it is assumed that r0

C = 1.0

C = 0.8

Exponential Transformations
The general form of the log transformation shown in
s = c exp(r) Where c is constant, and it is assumed that r0

C = 1.0

C = 0.8

Power-Law Transformations
Power-law transformations have the basic form

s cr

Sometime above Equation is written as

Where c and are positive constant.

s c(r )

= 0.5

= 1.0

= 5.0

10

Piecewise-Linear Transformation Functions


Translate Mapping Contrast stretching Gray-level slicing Bit-plane slicing

11

Contrast stretching
One of the simplest piecewise linear functions is a contrast-stretching transformation. The idea behind contrast stretching is to increase the dynamic range of the gray levels in the image being processed.

12

Contrast stretching

13

Gray-level slicing
Highlighting a specific range of gray levels in an image often is desired. There are several ways of doing level slicing, but most of them are variations of two basic themes. One approach is to display a high value for all gray levels in the range of interest and a low value for all other gray levels.
14

Gray-level slicing

255

255
15

Bit-plane slicing
Instead of highlighting gray-level ranges, highlighting the contribution made to total image appearance by specific bits might be desired. Suppose that each pixel in an image is represented b y 8 bits. Imagine that the image is composed of eight 1-bit planes, ranging from bitplane 0, the least significant bit to bit-plane 7, the most significant bit.

16

Piecewise-Linear Transformation Functions Case 3:Bit-plane Slicing

Bit-plane slicing:
It can highlight the contribution made to total image appearance by specific bits. Each pixel in an image represented by 8 bits. Image is composed of eight 1-bit planes, ranging from bit-plane 0 for the least significant bit to bit plane 7 for the most significant bit.

Piecewise-Linear Transformation Functions Bit-plane Slicing: A Fractal Image

Piecewise-Linear Transformation Functions Bit-plane Slicing: A Fractal Image

HISTOGRAM
pixels 130

36

36
22

0 Image 16x14 = 224 pixels

level
20

Role of Histogram Processing


The role of histogram processing in image enhancement example
Dark image Light image Low contrast High contrast

21

Histogram II
An image has low contrast when the complete range of possible values is not used. Inspection of the histogram shows this lack of contrast.

Histogram Processing
Histogram Equalization Histogram Matching(Specification) Local Enhancement

23

Histogram equalization (HE)


transforms the intensity values so that the histogram of the output image approximately matches the flat (uniform) histogram

Histogram equalization III

Histogram equalization IV

Histogram equalization V

cumulative histogram

Enhancement Using Arithmetic/Logic Operations

Two images of the same size can be combined using operations of addition, subtraction, multiplication, division, logical AND, OR, XOR and NOT. Such operations are done on pairs of their corresponding pixels. Often only one of the images is a real picture while the other is a machine generated mask. The mask often is a binary image consisting only of pixel values 0 and 1.

Enhancement Using Arithmetic/Logic Operations

AND

OR

Image Subtraction Example 1

Image Subtraction Example 2

When subtracting two images, negative pixel values can result. So, if you want to display the result it may be necessary to readjust the dynamic range by scaling.

Image Averaging

When taking pictures in reduced lighting (i.e., low illumination), image noise becomes apparent. A noisy image g(x,y) can be defined by

g ( x, y) f ( x, y) ( x, y)
where f (x, y): an original image ( x, y ) : the addition of noise One simple way to reduce this granular noise is to take several identical pictures and average them, thus smoothing out the randomness.

Image Averaging (Gray Scale)


1 image

2 images

5 images

10 images

20 images

33

Image Averaging (Color Image)

(1)

(2)

(3)

Average image

34

Spatial Filtering
Some neighborhood operations work with the values of the image pixels in the neighborhood and the corresponding values of a subimage that has the same dimensions as the neighborhood. The subimage is called a filter, mask, kernel, template, or window. The values in a filter subimage are referred to as coefficients rather than pixels.

Introduction, Cont.
These neighborhood operations consists of:
1. Defining a center point, (x,y) 2. Performing an operation that involves only the pixels in a predefined neighborhood about that center point. 3. Letting the result of that operation be the response of the process at that point. 4. Repeating the process for every point in the image.

Introduction, Cont.
The process of moving the center point creates new neighborhoods, one for each pixel in the input image. The two principal terms used to identify this operation are neighborhood processing or spatial filtering, with the second term being more common. If the computations performed on the pixels of the neighborhoods are linear, the operation is called linear spatial filtering; otherwise it is called nonlinear spatial filtering.