Digital Image Processing
Lecture 5: Image Enhancement-III
Dr. Arfan Jaffar
Histogram Matching
Issues with Histogram specification and matching
No rule for specifying an optimal histogram
Each given enhancement task needs to be analyzed on
a case-by-case basis
Histogram specification is somehow a trial-and-error
process
02/03/23 2
Local Histogram Processing
The histogram processing methods mentioned up to
now are global transformation where:
Function is designed according to the gray-level
distribution over an entire image
Global transformation methods may not be suitable
for enhancing details over small areas
(where number of pixels may have negligible
influence on designing the global transformation
function)
02/03/23 3
Local Histogram Processing
Implementation
Step1:
Define a square or rectangular neighborhood (block),
compute the histogram in the local block by designing the
transformation functions based on the local gray-level
distribution
Step 2:
Utilize the histogram equalization or specification method to
generate the transformation function, perform the gray level
mapping for each pixel in the Block
Step 3:
Move the center of the block to an adjacent pixel location
and repeat the procedure
02/03/23 4
Local Histogram Processing
Optimization:
The local histogram can be updated each time without re-
computing the histogram over all pixels in the new block
(since the block only shifts one pixel each time)
If utilizing non-overlapping region shift, the processed
image usually has an undesirable checkerboard effect
02/03/23 5
Local Histogram Equalization Example
02/03/23 6
Local Histogram Equalization Example
02/03/23 7
Local Enhancement using Statistical Parameters
from Histogram
Local enhancement can be based on statistical
properties of the gray levels in a block instead of
using full histogram
Examples:
Mean: gives the average brightness of the image
Variance: (σ2) and its square root the standard
deviation gives the deviation of intensities on
average from the mean value (average contrast)
02/03/23 8
Local Enhancement using Statistical Parameters
02/03/23 9
Local Enhancement using Statistical Parameters
02/03/23 10
Local Enhancement using Statistical Parameters
02/03/23 11
Local Enhancement using Statistical Parameters
02/03/23 12
Local Enhancement using Statistical Parameters
02/03/23 13
Mathematical/Logical Operations on Images
Addition
–Averaging images for noise removal
Subtraction
–Removal of background from images
–Image enhancement
–Image matching
–Moving/displaced object tracking
Multiplication
–Superimposing of texture on an image
–Convolution and correlation of images
And and or operations
–To remove the unnecessary area of an image through
mask operations
02/03/23 14
Image Averaging for Noise Reduction
02/03/23 15
Image Averaging for Noise Reduction
02/03/23 16
Image Averaging for Noise Reduction
02/03/23 17
Image Subtraction
• Takes two images as input and produces a third
image whose pixel values are those of the first
image minus the corresponding pixel values from
the second image
• Variants
– It is also often possible to just use a single image as
input and subtract a constant value from all the pixels
– Just output the absolute difference between pixel
values, rather than the straightforward signed output.
02/03/23 18
Image Subtraction
• The subtraction of two images is performed in a
single pass
• If the operator computes absolute differences between
the two input images then:
• If it is simply desired to subtract a constant value C
from a single image then:
02/03/23 19
Image Subtraction
• If the operator calculates absolute differences, then it is
impossible for the output pixel values to be outside the
range
• In rest of the two cases the pixel value may become
negative
• This is one good reason for using absolute differences.
• How to solve problem of negative pixels?
02/03/23 20
Image Subtraction
• How to solve problem of negative pixels?
• Let we have an 8 bit Grayscale image (Value Range= 0 t0 255)
• The result of image subtraction may come in the range of -255 to
+255
• One scheme can be to add 255 to every pixel and then divide by
2
• Method is easy and fast
• Limitations
– Truncation errors can cause loss of accuracy
– Full range of display may not be utilized
02/03/23 21
Image Subtraction
• How to solve problem of Negative Pixels?
• Another scheme can be
– Find value of Minimum Difference
– Add this value to all pixels in the Difference Image. This will
make a modified difference image whose minimum value is 0
– All pixel values are then scaled to the interval [0,255] by
multiplying each pixel by the quantity 255/Max where Max is
the maximum value in the modified image.
02/03/23 22
Examples of Image Subtraction
02/03/23 23
Examples of Image Subtraction
02/03/23 24
Example: Background Removal Using Image Subtraction
02/03/23 25
Example: Background Removal Using Image Subtraction
02/03/23 26
Examples of Image Multiplication
02/03/23 27
Example of Logical Operations using Masks
02/03/23 28