18cse390t U1 s7 Slo1 Content
18cse390t U1 s7 Slo1 Content
Computer Vision
U1 - S7 - SLO1 - Linear Filtering
Linear Filtering
• Locally adaptive histogram equalization is an example of a
neighborhood operator or local operator, which uses a collection of
pixel values in the vicinity of a given pixel to determine its final output
value
Neighborhood filtering (convolution): The image on the left is convolved with the filter in the middle to
yield the image on the right. The light blue pixels indicate the source neighborhood for the light green
destination pixel
Linear Filtering
• In addition to performing local tone adjustment, neighborhood
operators can be used to filter images to
• add soft blur,
• sharpen details,
• accentuate edges, or
• remove noise
• We will discuss linear filtering operators, which involve fixed weighted
combinations of pixels in small neighborhoods
Linear Filtering
• The entries in the weight kernel or mask h(k, l) are often called the
filter coefficients.
• The above correlation operator can be more compactly notated as
g = fh
Linear Filtering
• A common variant on this formula is
• where the sign of the offsets in f has been reversed, This is called the
convolution operator, g = f*h
• h is then called the impulse response function
Linear Filtering
• Padding (border effects)
• The correlation produces a result that is smaller than the original
image, which may not be desirable in many applications.
• This is because the neighborhoods of typical correlation and
convolution operations extend beyond the image boundaries near the
edges, and so the filtered images suffer from boundary effects
• To deal with this, a number of different padding or extension modes
have been developed for neighborhood operations
Linear Filtering
• Padding (border effects)
• zero: set all pixels outside the source image to 0 (a good choice for alpha-
matted cutout images)
• constant (border color): set all pixels outside the source image to a
specified border value
• clamp (replicate or clamp to edge): repeat edge pixels indefinitely
• (cyclic) wrap (repeat or tile): loop “around” the image in a “toroidal”
configuration
• mirror: reflect pixels across the image edge
• extend: extend the signal by subtracting the mirrored version of the signal
from the edge pixel value
Separable filtering
• The process of performing a convolution requires K2 (multiply-add)
operations per pixel, where K is the size (width or height) of the
convolution kernel
Separable filtering
• It is easy to show that the two-dimensional kernel K corresponding to
successive convolution with a horizontal kernel h and a vertical kernel
v is the outer product of the two kernels,