Ch03-Enhancement 3 Merged
Ch03-Enhancement 3 Merged
Introduction
What is an image?
An image may be defined as a two-dimensional function, f (x, y), where x and y are spatial (plane)
coordinates, and the amplitude of f at any pair of coordinates (x, y) is called the intensity or gray level of
the image at that point.
a digital image is composed of a finite number of elements, each of which has a particular location and
value.
What is an image?
- Image data structure is 2D array of pixel values.
- Pixel values are gray levels in range 0‐255 or RGB colors
- Array values can be any data type (bit, byte, int, float,double, etc.)
Examples of Digital Images
a) Natural landscape
c) Poster graphic
d) Computer screenshot
f) Barcode
g) Fingerprint
h) X‐ray
i) Microscope slide
j) Satellite Image
k) Radar image
l) Astronomical object
Relationship with other Fields
emulate human vision,
including learning and being
able to make inferences and
take actions based on visual
inputs. (AI)
f(x,y) = i(x,y)r(x,y)
We assume that the discrete levels are equally spaced and that they are integers in the range [ 0, L-1]
The more intensity levels used, the finer the level of detail discernable in an image.
Intensity level resolution usually given in terms of number of bits used to store each intensity level.
Intensity resolution
Using an insufficient number of intensity levels(less than 16 intensity levels) in smooth areas of a digital image causes false contouring
Relationships between pixels
Relationships between pixels
Relationships between pixels
(a) An arrangement of pixels. (b) Pixels that are 8-adjacent (c) m-adjacency.
0 0 0 1 3
Logic operations
● AND : p AND q (p•q)
● OR : p OR q (p+q)
● COMPLEMENT : NOT q , q’
● logic operations apply only to binary images.
● arithmetic operations apply to multivalued pixels.
● logic operations used for tasks such as masking, feature detection, and
shape analysis.
● logic operations perform pixel by pixel.
Mask operations
Besides pixel-by-pixel processing on entire images, arithmetic and Logical
operations are used in neighborhood oriented operations.
Let the value assigned to a pixel be a function of its gray level and the gray level of
its neighbors.
Mask operations
replace the gray value of pixel Z5 with the average gray values of it’s
neighborhood within a 3x3 mask
x =
Digital Image Processing
Image enhancement
Principle Objective of Enhancement
● Process an image so that the result will be more suitable than the original image for a specific
application.
● A method which is quite useful for enhancing an image may not necessarily be the best
approach for enhancing another images
● Frequency Domain :
Techniques are based on modifying the Fourier transform of an image.
Spatial Domain
where
- f(x,y)f(x,y) is the input image
- g(x,y)g(x,y) is the processed
image
- T is an operator on f defined over
some neighborhood of (x,y)(x,y)
Spatial Domain
● Neighborhood of a point (x,y) can be defined by
using a square/rectangular (common used) or
circular subimage area centered at (x,y)
● The center of the sub-image is moved from
pixel to pixel starting at the top of the corner
Point Processing
● Neighborhood = 1x1 pixel
● g depends on only the value of f at (x,y)
● T = gray level (or intensity or mapping) transformation function
○ s = T(r)
● Where
○ r = gray level of f(x,y)
○ s = gray level of g(x,y)
Contrast Stretching
● Produce higher contrast than the
original by:
background
Another Examplr
Piecewise-Linear Transformation Functions
● Advantage:
○ Allow more control on the complexity of T(r).
● Disadvantage:
○ Their specification requires considerably more user input
● Contrast stretching.
● Gray-level slicing.
● Bit-plane slicing.
Contrast Stretching
Gray-level slicing
Gray-level slicing
Bit-plane slicing
❏ Highlighting the contribution
made to total image
appearance by specific bits
❏ Suppose each pixel is
represented by 8 bits
❏ Higher-order bits contain
the majority of the visually
significant data
❏ Useful for analyzing the
relative importance played
by each bit of the image
Bit-plane slicing
● The (binary) image for bit-plane 7 can be
obtained by processing the input image with
a thresholding gray-level transformation.
segmentation
3. For each gray level k, scale the sum by (max gray level)/(number of pixels).
5. Replace each gray level k in the input image by the corresponding level
obtained in 4.
Histogram Equalization Implementation
Histogram Equalization Implementation
Color Image Histograms
Two types:
1. Intensity histogram:
● histograms (R,G,B)
Enhancement using Arithmetic/Logic Operations
● Arithmetic/Logic operations are performed on pixel by pixel basis between two
or more images
● except NOT operation which perform only on a single image
● Logic operation is performed on gray level images, the pixel values are
processed as binary numbers
● NOT operation = negative transformation
Example of AND Operation
Example of OR Operation
Image Subtraction
A A
g(x,y) = f(x,y) – h(x,y)
● enhancement of the differences between
images
● Image similarity
● We may have to adjust the grayscale of the
subtracted image to be [0, 255] (if 8-bit is used)
● Subtraction is also used in segmentation of
moving pictures to track the changes.
● after subtract the sequenced images, what is left
should be the moving elements in the image,
plus noise
●
Histogram
A-B Equalization of A-B
Image Averaging
Consider a noisy image modeled as:
g(x,y) = f(x,y) + η(x,y)
Where f(x,y) is the original image, and η(x,y) is a noise process
Objective: to reduce the noise content by averaging a set of noisy images
Define an image formed by averaging K different noisy images:
● sharp transitions
○ random noise in the image
○ edges of objects in the image
● thus, smoothing can reduce noises (desirable) and blur edges (may be
undesirable)
Smoothing Spatial Filters
Smoothing Spatial Filters: Example
Order-Statistics Filters (Nonlinear Filters)
❏ Nonlinear spatial filters whose response is based on ordering (ranking) the pixels
contained in the filter mask and then replacing the value of the center pixel with the
result of the ranking operation
example
Nonlinear filters
Linear filters
Order-Statistics Filters (Nonlinear Filters)
Sharpening Spatial Filters
❏ to highlight fine detail in an image
❏ or to enhance detail that has been blurred - either in error or as an effect of a method of
image acquisition.
❏ the sharpening must be accomplished by spatial spatial differentiation.
❏ In contrast to averaging which is similar to integration
Sharpening Spatial Filters
❏ First-order derivative (1D)
❏ a basic definition of the first-order derivative of a one-dimensional function f(x) is
the difference
❏ easily by adding the original and Laplacian image. be careful with the Laplacian filter
used
Example
a). image of the North pole of the moon
if we use Laplacian filter to create sharpen image fs(x,y) with addition of original image
High-boost Masks
A≥1
commonly approx:
Gradient Mask
❏ Sobel operators, 3x3
❏ An approximation using absolute values
❏ the weight value 2 is to achieve smoothing by giving more important to the center point
the summation of coefficients in all masks equals 0, indicating that they would give a
response of 0 in an area of constant gray level.
Example
Example of Combining Spatial Enhancement Methods
❏ want to sharpen the original
image and bring out more
skeletal detail.