Histogram Basics
Normalized histogram ( )
: the number of pixels in the image of
size M N with intensity
k
k
k
k
n
pr
MN
n
r
=
´
Histogram ( )
is the intensity value
is the number of pixels in the image with intensity
kk
th
k
kk
hr n
rk
nr
=
Histogram Equalization
•A popular technique for improving the appearance of a poor image
•Goal: The histogram of the resultant image is as flat as possible
•The histogram equalization process for digital images consists of four
steps:
•1. Find the running sum of the histogram values
•2. Normalize the values from step1 by dividing by total number of pixels.
•3. Multiply the values from step2 by the maximum gray level value and round.
•4. Map the gray-level values to the results from step 3, using a one-to-one
correspondence.
Histogram Equalization
•Example:
•We have an image with 3 bit /pixel, so the possible range of values is
0 to 7. We have an image with the following histogram:
Histogram Equalization
Histogram Equalization
•Suppose that a 3-bit image (L=8) of size 64 × 64 pixels (MN = 4096) has the intensity distribution shown in following table.
•Get the histogram equalization transformation function and give the ps(sk) for each sk.
Histogram Equalization
Correlation vs Convolution
•Both are used to extract information from images
•Both have two key features: they are Time/Shift-invariant, and linear
•Time/Shift-invariant means that we perform the same operation at
every point in the image.
•Linear means that this operation is linear, that is, we replace every pixel
with a linear combination of its neighbors.
Cross-Correlation Vs Convolution
•Correlation is the process of moving a filter mask often referred to as
kernel over the image and computing the sum of products at each
location.
•Correlation is the function of displacement of the filter.
•This is also known as aslidingdot productorsliding inner-product
•In other words, the first value of the correlation corresponds to zero
displacement of the filter, the second value corresponds to one unit
of displacement, and so on.
Cross-Correlation Vs Convolution
•Correlation is the process of moving the template or subimage w
around the image area and computing the value C in that area.
•This involves multiplying each pixel in the template by the image
pixel that it overlaps and then summing the results over all the
pixels of the template.
•The maximum value of C indicates the position where w best
matches f.
2D Correlation
•Given a square filter, we can compute the results of correlation by
aligning the center of the filter with a pixel. Then we multiply all
overlapping values together, and add up the result. We can write this
as:
Applying linear filter: Cross-Correlation
Cross-Correlation Vs Convolution
Cross-Correlation Vs Convolution
Cross-Correlation Vs Convolution
Cross-Correlation Vs Convolution
2D Convolution
•Convolution is just like correlation, except that we flip over the filter
before correlating.
•In the case of 2D convolution we flip the filter both horizontally and
vertically.
Cross-Correlation Vs Convolution
•In Convolution operation, the kernel is first flipped by an angle of 180
degrees and is then applied to the image.
•The fundamental property of convolution is that convolving a kernel
with a discrete unit impulse yields a copy of the kernel at the location
of the impulse.
Cross-Correlation Vs Convolution
Cross-Correlation Vs Convolution
Enhancement Techniques
Image Denosing: Mean filters
Image Denosing: Mean filters
Image Denosing: Harmonic & Contra-Harmonic
Image Denosing: Harmonic & Contra-Harmonic
Cross-Correlation Vs Convolution
•Correlation is the process of moving a filter mask often referred to as
kernel over the image and computing the sum of products at each
location.
•Correlation is the function of displacement of the filter.
•This is also known as aslidingdot productorsliding inner-product
•In other words, the first value of the correlation corresponds to zero
displacement of the filter, the second value corresponds to one unit
of displacement, and so on.
Cross-Correlation Vs Convolution
•Correlation is the process of moving the template or subimage w
around the image area and computing the value C in that area.
•This involves multiplying each pixel in the template by the image
pixel that it overlaps and then summing the results over all the
pixels of the template.
•The maximum value of C indicates the position where w best
matches f.
Cross-Correlation Vs Convolution
Cross-Correlation Vs Convolution
Cross-Correlation Vs Convolution
Cross-Correlation Vs Convolution
•In Convolution operation, the kernel is first flipped by an angle of 180
degrees and is then applied to the image.
•The fundamental property of convolution is that convolving a kernel
with a discrete unit impulse yields a copy of the kernel at the location
of the impulse.
Cross-Correlation Vs Convolution
Cross-Correlation Vs Convolution
Enhancement Techniques
What is a Filter?
What Point operation Can’t Do!
Spatial Filter
Example: Mean of 3x3
Kernel operation
Kernel operation: Smoothing
Kernel operation: Smoothing
Kernel operation: Smoothing
Filter Matrix
Example
What this filter do?
Example 2
Mean Filter
Effect of filter size
Applying linear filter: Cross-Correlation
Computing Filter Operation
Filtering and boundary pixels
•There are a few approaches to dealing with missing edge pixels: –
•Omit missing pixels
•Only works with some filters
•Can add extra code and slow down processing
•Pad the image
• Typically with either all white or all black pixels
•Replicate border pixels
•Truncate the image
•Allow pixels wrap around the image
• Can cause some strange image artefacts
Filtering and boundary pixels
Filtering and boundary pixels
Filtering and boundary pixels
Filtering and boundary pixels
Image Filtering
•Filtering operation:
•Linear : a convolution operation between f(x,y) and a window
function w(x,y).
•A filtering method is linear when the output is a weighted sum
of the input pixels.
•Non-Linear: response is based on ordering (ranking) the pixels
Linear Filters
Gaussian Filter
Difference filter
Convolution: properties
Convolution: Properties
Linear Image Filtering
- Varying the weights m(i,j), results in
different type of linear neighborhood
operations (filtering).
Linear Image Filtering
•Example: Smoothing filter:
•average all of the pixels in a neighbourhood around a central value