Convolutionniuhiu Siusd
Convolutionniuhiu Siusd
Image
• Digital Images are electronic snapshots
taken of a scene or scanned from
documents, such as photographs,
manuscripts, printed texts, and artwork.
• The digital image is sampled and mapped
as a grid of dots or picture elements
(pixels).
• Each pixel is assigned a tonal value
(black, white, shades of gray or color),
which is represented in binary code.
Image formation
The concept of pixel
• Pixel is the smallest element of an image. Each pixel
correspond to any one value.
• In an 8-bit gray scale image, the value of the pixel
between 0 and 255.
• The value of a pixel at any point correspond to the
intensity of the light photons striking at that point. Each
pixel store a value proportional to the light intensity at
that particular location.
Image convolution filtering
• Image filtering, in the context of computer vision, refers to a
process of modifying or enhancing an image by applying a
specific algorithm or a set of mathematical operations to its
pixels.
• In basic terms, a convolution is a mathematical operation on two
functions that produce a third function.
• The goal of image filtering is to manipulate the image in such a
way that certain features become more prominent , making it
easier to extract relevant information or to improve the image’s
overall quality.
• Grayscale images have 1 channel that goes from a scale from
0 to 255 where 0 is black and 255 is white. Colored images
typically have 3 channels and stored as 3 bytes: red, green,
blue (RGB) values each ranging from 0 to 255 depending on
intensity. Therefore, a picture can be represented as a matrix of
values.
• Image filters are typically represented by a small matrix or
kernel, which is slide over the entire image.
• At each position, the kernel is multiplied with the pixel values
within its neighborhood, and the resulting values are combined
to form a new value for the central pixel.
• The size and values of the kernel determine the nature of the
filtering operation.
The process of convolution
• In image convolution, involves a kernel, or matrix that is applied
over the input image’s pixels to generate an output image.
• The kernel size and values determine the effect the kernel has
on the image. The dimensions of the kernel should be smaller
or equal to that of the input image’s.
• The kernel typically is square shaped and has an odd kernel
size out of convenience.
• How is the kernel applied in a convolution? The first step is that
the kernel is flipped both horizontally and vertically.
• This is done by definition of a convolution. Using a non-flipped
kernel would be doing a cross-correlation rather than a
convolution. In the case of a symmetric kernel, the
cross-correlation is equivalent to its convolution.
• The animation below visually demonstrates how a 3x3 kernel is
applied over a 5x5 input image generating a 3x3 output image.
Note that the kernel slides along the input image.
• The output image pixels are calculated by performing an
element by element multiplication with the kernel and the
covered section of the input image and then summing them up.
• Given an example kernel and input image, an example of the
calculation is shown below with the first pixel.
Mathematically, convolution in 2 dimensions is defined as
follows: