0% found this document useful (0 votes)
6 views20 pages

DMPT 2025 Lecture12 ENG ContextOperations

The document discusses various digital image processing techniques, focusing on context operations, linear and nonlinear filters, and their applications. Key methods such as mean smoothing, median filtering, Gaussian blur, and conservative smoothing are explained, along with their effects on image quality. Additionally, it covers the convolution process, kernel usage, and handling pixels outside image boundaries.

Uploaded by

Meow Meow
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views20 pages

DMPT 2025 Lecture12 ENG ContextOperations

The document discusses various digital image processing techniques, focusing on context operations, linear and nonlinear filters, and their applications. Key methods such as mean smoothing, median filtering, Gaussian blur, and conservative smoothing are explained, along with their effects on image quality. Additionally, it covers the convolution process, kernel usage, and handling pixels outside image boundaries.

Uploaded by

Meow Meow
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

DIGITAL MEDIA

PROCESSING TECHNIQUES
– Lecture 12
12.1 Context operations in digital image processing
– Linear and nonlinear filters
12.2 Applications of image filters

KCH – DMPT Lecture12 2025 1/20


Context operations

Context operations – operations taking into account neighboring


pixels values.
• Filter design • Wiener filter
• Laplace transform • Gabor filter
• Green's function • Leapfrog filter
• Prototype filter • mean smoothing
• Z-transform • median filtering
• System theory • Gaussian blur
• LTI system theory
• conservative smoothing
• Nonlinear filter

KCH – DMPT Lecture12 2025 2/20


Mean smoothing

Mean smoothing / mean filtering – reducing the amount of intensity


variation between adjacent pixels. It is mainly used to reduce noise
in images.
Mean filtering – replacement of each pixel value in an image with
the mean value – average value of its neighbors, including itself,
usually 3×3 or 5x5 square blocks. This has the effect of eliminating
pixel values which are unrepresentative of their surroundings.

KCH – DMPT Lecture12 2025 3/20


Median filtering

The median filter considers each pixel in the image whether or not it
is representative of its surroundings. Instead of using mean value
of neighboring pixels, the median filter uses the median of those
values.
To find median value the values of the surrounding neighborhood
pixels should be first sorted into numerical order and then the
middle pixel value is chosen. If the neighborhood set of pixels
contains an even number of pixels, the average of the two middle
pixel values is the median value.
Examples of finding the median in sets of data with an odd and
even number of values.
1,1,1,6,7,8,9 – median = 6; 4,4,4,6,7,8 – median = 5

KCH – DMPT Lecture12 2025 4/20


Gaussian blur

Gaussian blur – smoothing an image.


The degree of smoothing is determined by the standard deviation of
the Gaussian. The Gaussian outputs a weighted average of each
pixel's neighborhood, with the average weighted more towards the
value of the central pixels. In consequence a Gaussian filter
provides soft smoothing and preserves edges better than a
similarly sized mean or median filters.
The new value of each pixel is a weighted average of its
neighborhoods. The original pixel receives the highest weight
(having the highest Gaussian value) and neighboring pixels receive
lower weights as their distance to the original pixel increases. Such
a process preserves boundaries and edges better than other filters.

KCH – DMPT Lecture12 2025 5/20


Gaussian function

The Gaussian blur uses a Gaussian function (normal distribution in


statistics) for calculating the transformation of each pixel in the
image. The formula of a Gaussian function in one dimension is as
follows:

KCH – DMPT Lecture12 2025 6/20


Gaussian function

In two dimensions, it is the product of two such Gaussian functions,


one in each dimension:

where x is the distance from the origin in the horizontal axis, y is the
distance from the origin in the vertical axis, and σ is the standard
deviation of the Gaussian distribution.
After applying the two dimension Gaussian function the contours
are becoming concentric circles with a Gaussian distribution from
the center point.
The Gaussian smoothing operator is a kind of 2-D convolution
operators.
KCH – DMPT Lecture12 2025 7/20
Context operations

Laplacian filters – derivative filters used to find areas of rapid


changes in images and therefore often used for edge detection.

Two-step process of Laplacian of Gaussian (LoG) operation:


– Gaussian smoothing using Gaussian filter
(to reduce its sensitivity to noise),
– Laplacian filter.

KCH – DMPT Lecture12 2025 8/20


Conservative smoothing

Conservative smoothing – a noise reduction technique using to


remove noise spikes, i.e. isolated pixels of exceptionally low or high
pixel intensity. They are called „salt and pepper noise”.
Such an effect is caused for example by errors in the data
transmission. The corrupted pixels are either set to the maximum
value. The value 1 results in white pixels like snow in the image.
Sometimes single pixels are set to zero – black pixels.
These two kinds of pixels are giving the image a „salt and pepper”
like appearance.

KCH – DMPT Lecture12 2025 9/20


Digital filters

Digital filters – used to blur and sharpen digital images.

Filtering can be performed by:


– convolution with specifically designed kernels (filter array) in the
spatial domain,
– masking specific frequency regions in the frequency (Fourier)
domain.
A kernel, convolution matrix, or mask – a small matrix
It is used for blurring, sharpening, embossing, edge detection, and
more.
This is accomplished by doing a convolution between a kernel and
an image.

KCH – DMPT Lecture12 2025 10/20


Linear and nonlinear filters

Linear filters
– output is a linear combination of their input.

Nonlinear filters
The general idea in non-linear image filtering is that instead of using
the spatial mask in a convolution process, the mask is used to
obtain the neighboring pixel values, and then ordering mechanisms
produce the output pixel.
A median filter is a nonlinear filter – each output sample is
computed as the median value of the input samples.

KCH – DMPT Lecture12 2025 11/20


High-pass and low-pass filters

High-pass and low-pass filters – used in digital image processing to


perform image modifications, enhancements, noise reduction, etc.
High-boost filter – a generalization of high-pass filter – unsharp
masking or sharpening
Unsharp masking – an image sharpening technique using a blurred
(usually Gaussian blur), or "unsharp", negative image to create a
mask of the original image.
The unsharp mask – combined (compared) with the original positive
image, creating an image that is less blurry than the original.
If the difference is greater than a certain threshold, the images are
subtracted. The threshold control constrains sharpening to image
elements that differ from each other above a certain size threshold,
so that sharpening of small image details can be suppressed.

KCH – DMPT Lecture12 2025 12/20


Kernel

Kernel:
f’(x,y) = ω f(x,y)
f – original image,
f’ – filtered (transformed) image,
ω – filter kernel

KCH – DMPT Lecture12 2025 13/20


Examples of filter kernels

Identity:

Edge detection:

Sharpen:

KCH – DMPT Lecture12 2025 14/20


Examples of filter kernels

Box blur:

Gaussian blur 3 × 3:

Gaussian blur 5 × 5:

KCH – DMPT Lecture12 2025 15/20


Examples of filter kernels

Unsharp masking 5 × 5
based on Gaussian blur
with amount as 1 and threshold as 0

KCH – DMPT Lecture12 2025 16/20


High-pass and low-pass filters

Convolution – a process of adding each element of the image to its


local neighbors, weighted by the kernel.

General formula for matrix convolution


(convolution is not the traditional matrix multiplication):

KCH – DMPT Lecture12 2025 17/20


Convolution (continued)

Example in the case of two matrices 3 x 3 (a kernel and an image)

Convolution – process of flipping both the rows and columns of the


kernel and multiplying locally similar entries and summing.
The central element at coordinates [2, 2] of the resulting image would
be a weighted combination of all the entries of the image matrix, with
weights given by the kernel.
The values of a given pixel in the output image are calculated by
multiplying each kernel value by the corresponding input image pixel
values.
KCH – DMPT Lecture12 2025 18/20
Pixels outside of the image boundaries

Kernel convolution – what to do if the kernel requires values from


pixels outside of the image boundaries?
Extend – the nearest border pixels are conceptually extended as
far as necessary to provide values for the convolution. Corner pixels
are extended in 90° wedges. Other edge pixels are extended in lines.
Wrap – the image is conceptually wrapped (or tiled) and values are
taken from the opposite edge or corner.
Mirror – the image is conceptually mirrored at the edges; instead
of attempting to read a pixel outside an edge a pixel inside the edge
is read.

KCH – DMPT Lecture12 2025 19/20


Pixels outside of the image boundaries

Kernel convolution – what to do if the kernel requires values from


pixels outside of the image boundaries?
Crop – any pixel in the output image which would require values
from beyond the edge is skipped; this method can result in the
output image being slightly smaller, with the edges having been
cropped.
Kernel Crop – any pixel in the kernel that extends past the input
image isn't used and the normalizing is adjusted to compensate.

KCH – DMPT Lecture12 2025 20/20

You might also like