digital image processing eee415 lecture 3 image enhancement in spatial domain pixel operations and...
TRANSCRIPT
Digital Image ProcessingEEE415
Lecture 3
Image Enhancement in Spatial Domain
Pixel Operations and Histogram
Processing
Image Enhancement
• Process an image to make the result more suitable than the
original image for a specific application
– Image enhancement is subjective (problem/application
oriented)
• Image enhancement methods
• Spatial domain: Direct manipulation of pixel in an image (on
the image plane)
• Frequency domain: Processing the image based on modifying
the Fourier transform of an image
Some techniques are based on various combinations of methods
from these two categories
Image Enhancement
• No general theory
• Viewer is ultimate judge
• Highly subjective process
• Easier in machine perception
Types of image enhancement operations - Pixel point processing
Pixel point processing is a form of image enhancement
based only on the intensity of single pixels. No consideration
what-so-ever is taken of neighbouring pixels, or the spatial
arrangement of groups of pixels, or of the position of the pixel
within the digital image.
Pixel point processing is a simple but important type of image
enhancement technique. All pixels are processed individually.
Pixel Point Processing
The general equation for a point process is given by:
g(x,y) = M[f(x,y)]
Where g(x,y) is the output digital image, f(x,y) is the input
digital image, and M is the mapping function.
M maps or converts input pixel brightness to an output pixel
brightness.
The mapping function can be non-linear.
Types of image enhancement operations: Block processing
Local operations The output value at (x,y) is dependent on the
input values in the neighborhood of (x,y)
Global operations The output value at (x,y) is dependent on all
the values in the input image
04/20/23 7
Basic concepts
Spatial domain enhancement methods can be generalized as
g(x,y)=T[f(x,y)]
f(x,y) : input image
g(x,y): processed (output) image
T[*] : an operator on f (or a set of input images),
defined over neighborhood of (x,y)
Neighborhood about (x,y): a square or rectangular sub-
image area centered at (x,y)
04/20/23 8
Basic Concepts
3x3 neighborhood about (x,y)
04/20/23 9
Basic concepts
g(x,y) = T [f(x,y)]Pixel/point operation:
Neighborhood of size 1x1: g depends only on f at (x,y)
T: a gray-level/intensity transformation/mapping function
Let r = f(x,y) s = g(x,y)r and s represent gray levels of f and g at (x,y)Then s = T(r)
Local operations: g depends on the predefined number of neighbors of f
at (x,y)Implemented by using mask processing or filteringMasks (filters, windows, kernels, templates) :a small (e.g. 3×3) 2-D array, in which the values of
the coefficients determine the nature of the process
04/20/23 10
Common pixel operations
• Image negatives
• Log
transformations
• Power-law
transformations
04/20/23 11
Pixel Operations: Image negatives
• Reverses the gray level order
• For L gray levels the transformation function is
s =T(r) = (L-1)-r
Input image (X-ray image) Output image (negative)
Application: To enhance the visibility for images with more dark portion
04/20/23 12
Pixel Operations: Contrast Scaling
s =T(r) = a.r (a is a constant)
04/20/23 13
Pixel Operations: Log transformations
Function of s = c Log(1+r)
04/20/23 14
Pixel Operations: Log transformations
Properties of log transformations
– For lower amplitudes of input image the range of gray levels
is expanded
– For higher amplitudes of input image the range of gray
levels is compressed
Application:
– This transformation is suitable for the case when the
dynamic range of a processed image far exceeds the
capability of the display device (e.g. display of the Fourier
spectrum of an image)
– Also called “dynamic-range compression / expansion”
04/20/23 15
Pixel Operations: Log transformations
Fourier spectrum with values of range 0 to 1.5 x 106 scaled linearly
The result applying log transformation, c = 1
04/20/23 16
Pixel Operations: Power-law Transformation
Basic form:
s = cr , where c &
are positive
Plots of equation s = crFor various values of c
04/20/23 17
Pixel Operations: Power-law Transformation
For γ < 1: Expands values of dark pixels, compress values of
brighter pixels
For γ > 1: Compresses values of dark pixels, expand values
of brighter pixels
If γ=1 & c=1: Identity transformation (s = r)
A variety of devices (image capture, printing, display) respond
according to a power law and need to be corrected;
Gamma (γ) correction
The process used to correct the power-law response phenomena
04/20/23 18
Pixel Operations: Power-law Transformation
• Example of gamma correction
• To linearize the CRT response a pre-distortion circuit is
needed s = cr1/
04/20/23 19
Pixel Operations: Gamma correction
Linear wedge gray scale image
Response of CRT to Linear wedge
Gamma corrected wedge
Output of monitor
04/20/23 20
Pixel Operations: Power-law Transformation
MRI image of fractured
human spine
Result of applying
power-law transformatio
n
c = 1,
Result of applying
power-law transformatio
n
c = 1,
Result of applying
power-law transformatio
n
c = 1,
04/20/23 21
Pixel Operations: Power-law Transformation
Original satellite image
Result of applying
power-law transformatio
n
c = 1,
Result of applying
power-law transformatio
n
c = 1,
Result of applying
power-law transformat
ion
c = 1,
04/20/23 22
Pixel Operations: Piecewise-linear transformation
Contrast stretching
Goal:
Increase the dynamic range of the gray levels for low contrast
images
Low-contrast images can result from
– poor illumination
– lack of dynamic range in the imaging sensor
– wrong setting of a lens aperture during image acquisition
04/20/23 23
Pixel Operations: Piecewise-linear transformation
Contrast stretching:
Method
where a1, a2, and a3 control the result of contrast stretching
if a1 = a2 = a3 = 1 no change in gray levels
if a1 = a3 = 0 and r1 = r2, T(*) is a thresholding function,
the result is a binary image
04/20/23 24
Pixel Operations: Piecewise-linear transformation
Form of Transformatio
n function
Result of contrast
stretching
Original low-contrast image
Result of thresholding
Pixel Operations: Non-linear contrast
stretching Non-linear contrast stretching is implemented using look-up tables, not formulas.
Pixel Operations: Bit-plane Slicing
1 Bit : max value = 1 = 21 – 1
1 Byte = 8 bits : max value = 255 = 28 – 1
1 Word = 2 bytes = 16 bits : max value = 65535 = 216 - 1
27 = 128 26 = 64
25 = 32
24 = 16
23 = 8 22 = 4 21 = 2 20 = 1
Bit 7 (MSB) Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 (LSB)
A bit-plane is the binary image associated with a selected bit’s contribution to overall pixel brightness. Most of the image structure is conveyed in the higher order bit planes.
Pixel Operations: Bit-plane Slicing
Pixel Operations: Bit-plane Slicing
The lower order bit
planes carry the
important but more
subtle shading and
detail of the digital
image.
Pixel Operations: Bit-plane Slicing
Pixel Operations: Bit-plane Slicing
Quiz-211/10/2010
1. Apply contrast stretching to following 2-bit image f(x,y) according to the transformation given in equation:
g(x,y)=T{f(x,y)}=a*f(x,y)
Where g(x,y) is out image and ‘a=2’ is scaling factor. Then change the dynamic range of output image to 0-3.
3 1 2 1
2 2 0 2
1 2 1 1
1 0 1 2