Chapter Two
Chapter Two
An image is denoted by a two dimensional function of the form f{x, y}. The value or amplitude
of f at spatial coordinates {x,y} is a positive scalar quantity whose physical meaning is
determined by the source of the image. When an image is generated by a physical process, its
values are proportional to energy radiated by a physical source. As a consequence, f(x,y) must be
nonzero and finite; that is 0<f(x,y) < ∞.
The amount of the source illumination incident on the scene being viewed.
The amount of the source illumination reflected back by the objects in the scene.
These are called illumination and reflectance components and are denoted by i(x,y) an r (x,y)
respectively.
The functions combine as a product to form f(x,y). We call the intensity of a monochrome image
at any coordinates (x,y) the gray level (l) of the image at that point l= f (x, y).
Lmin ≤ l ≤ Lmax
Common practice is to shift this interval numerically to the interval [0, L-l] where l=0 is
considered black and l= L-1 is considered white on the gray scale. All intermediate values are
shades of gray of gray varying from black to white.
A digital image a[m,n] described in a 2D discrete space is derived from an analog image a(x,y)
in a 2D continuous space through a sampling process that is frequently referred to as digitization.
The 2D continuous image a(x,y) is divided into N rows and M columns. The intersection of a
row and a column is termed a pixel. The value assigned to the integer coordinates [m,n] with
{m=0,1,2,…,M–1} and {n=0,1,2,…,N–1} is a[m,n]. In fact, in most cases a(x,y) which we might
consider to be the physical signal that impinges on the face of a 2D sensor is actually a function
of many variables including depth (z), color (λ), and time (t).
1|Page
Fig. Digitization of a continuous image. The pixel at coordinates [m=10, n=3] has the integer
brightness value 110.
The image shown in the above Figure has been divided into N = 16 rows and M = 16 columns.
The value assigned to every pixel is the average brightness in the pixel rounded to the nearest
integer value. The process of representing the amplitude of the 2D signal at a given coordinate as
an integer value with L different gray levels is usually referred to as amplitude quantization or
simply quantization.
1. Low level process: these involve primitive operations such as image processing to reduce
noise, contrast enhancement and image sharpening. These kinds of processes are
characterized by fact the both inputs and output are images.
2. Mid-level image processing: it involves tasks like segmentation, description of those objects
to reduce them to a form suitable for computer processing, and classification of individual
2|Page
objects. The inputs to the process are generally images but outputs are attributes extracted
from images.
3. High level processing: It involves “making sense” of an ensemble of recognized objects, as
in image analysis, and performing the cognitive functions normally associated with vision.
2.2 Digital image Representation
We can use two principal ways to represent digital images. Assume that an image f(x, y) is
sampled so that the resulting digital image has M rows and N columns. The values of the
coordinates (x, y) now become discrete quantities. For notational clarity and convenience, we
shall use integer values for these discrete coordinates. Thus, the values of the coordinates at the
origin are (x, y) = (0, 0). The next coordinate values along the first row of the image are
represented as (x, y) = (0, 1). It is important to keep in mind that the notation (0, 1) is used to
signify the second sample along the first row. It does not mean that these are the actual values of
physical coordinates when the image was sampled. The following Figure shows the coordinate
convention used.
The notation introduced in the preceding paragraph allows us to write the complete M*N digital
image in the following compact matrix form:
The right side of this equation is by definition a digital image. Each element of this matrix array
is called an image element, picture element, pixel, or pel.
3|Page
Hence f(x,y) is a digital image if gray level (that is, a real number from the set of real number R)
to each distinct pair of coordinates (x,y). This functional assignment is the quantization process.
If the gray levels are also integers, Z replaces R, and the digital image becomes a 2D function
whose coordinates and the amplitude value are integers.
Pixels: Every pixel has # of bits (k) so, the gray intensities (L) that the pixel can hold, is
calculated according to a number of pixels it has (k). Due to processing storage and hardware
consideration, the number of gray levels typically is an integer power of 2.
L=2K
When an image can have 2k gray levels, it is referred to as “k- bit”. An image with 256 possible
gray levels is called an “8- bit image” (256=28)
Example 1:
For an 8-bit image of size 512×512, determine its gray-scale and storage size.
4|Page
Example 2:
Image Sensing and Acquisition: The types of images in which we are interested are generated
by the combination of an “Illumination” source and the reflection or absorption of energy from
that source by the elements of the “scene” being imaged.
In image processing, it is defined as the action of retrieving an image from some source, usually
a hardware-based source for processing. It is the first step in the work flow sequence because,
without an image, no processing is possible. The image that is acquired is completely
unprocessed.
Now the incoming energy is transformed into a voltage by the combination of input electrical
power and sensor material that is responsive to a particular type of energy being detected. The
output voltage waveform is the response of the sensor(s) and a digital quantity is obtained from
each sensor by digitizing its response. Image acquisition sensors are Single sensor, Line sensor
(Sensor strips) and Array sensor.
5|Page
Image Acquisition using a single sensor:
6|Page
Image Acquisition using an array sensor:
In this, individual sensors are arranged in the form of a 2-D array. This type of arrangement is
found in digital cameras. E.g. CCD array
In this, the response of each sensor is proportional to the integral of the light energy projected
onto the surface of the sensor. Noise reduction is achieved by letting the sensor integrate the
input light signal over minutes or ever hours.
Advantage: Since sensor array is 2D, a complete image can be obtained by focusing the energy
pattern onto the surface of the array.
7|Page
The sensor array is coincident with the focal plane; it produces an output proportional to the
integral of light received at each sensor.
Digital and analog circuitry sweep these outputs and convert them to a video signal which is then
digitized by another section of the imaging system. The output is a digital image.
To create a digital image, we need to convert the continuous sensed data into digital from. This
involves two processes: sampling and quantization. An image may be continuous with respect
to the x and y coordinates and also in amplitude. To convert it into digital form we have to
sample the function in both coordinates and in amplitudes.
Digitalizing the coordinate values is called sampling. Digitalizing the amplitude values is called
quantization. There is a continuous image along the line segment AB. To simple this function,
we take equally spaced samples along line AB. The location of each samples is given by a
vertical tick back (mark) in the bottom part. The samples are shown as block squares
superimposed on function the set of these discrete locations gives the sampled function.
In order to form a digital, the gray level values must also be converted (quantized) into discrete
quantities. So we divide the gray level scale into eight discrete levels ranging from eight level
values. The continuous gray levels are quantized simply by assigning one of the eight discrete
gray levels to each sample. The assignment it made depending on the vertical proximity of a
simple to a vertical tick mark.
8|Page
2.5 Representation of different image type’s
The images types we will consider are: 1) binary, 2) gray-scale, 3) color,and 4) multispectral.
1. Binary images
Binary images are the simplest type of images and can take on two values, typically black and
white, or 0 and 1. A binary image is referred to as a 1-bit image because it takes only 1 binary
digit to represent each pixel. These types of images are frequently used in applications where
the only information required is general shape or outline, for example optical character
recognition (OCR).
Binary images are often created from the gray-scale images via a threshold operation, where
every pixel above the threshold value is turned white („1‟), and those below it are turned black
(„0‟). In the figure below, we see examples of binary images.
(a) (b)
Figure: Binary images. (a) Object outline. (b) Page of text used in OCR application.
2. Gray-scale images
Gray-scale images are referred to as monochrome (one-color) images. They contain gray-level
information, no color information. The number of bits used for each pixel determines the
number of different gray levelsavailable. The typical gray-scale image contains 8bits/pixel data,
which allows us to have 256 different gray levels. The figure below shows examples of gray-
scale images.
In applications like medical imaging and astronomy, 12 or 16 bits/pixel images are used. These
9|Page
extra gray levels become useful when a small section of the image is made much larger to
discern details.
3. Color images
Representation of color images is more complex and varied. The twomost common ways of
storing color image contents are:
Figure 5 illustrate that in addition to referring to arrow or column as a vector, we can refer to a
single pixel red, green, and blue values as a colorpixel vector –(R, G, B ).
10 | P a g e
Indexed Color Images: A problem with 24-bit color representations is backward compatibility
with older hardware that may not be able to display the 16 million colors simultaneously. A
solution devised before 24-bit color displays and video cards were widely available consisted
of an indexed representation, in which a 2D array of the same size as the image contains indices
(pointers) to a color palette (or color map) of fixed maximum size (usually 256 colors). The
color map is simply a list of colors used in that image. Figure 6 shows an indexed color image
and a 4 × 4 detailed region, where each pixel shows the index and the values of R, G, and B at
the color palette entry that the index points to.
Figure: An indexed color image and the indices in a 4 × 4 neighborhood. Original image
4. Multispectral images
Multispectral images typically contain information outside the normal human perceptual
range. This may include infrared, ultraviolet, X-ray, acoustic, or radar data. These are not
images in the usual sense because the information represented is not directly visible by the
human system. However, the information is often represented in visual form by mapping the
different spectral bands to RGB components.
Types of image data are divided into two primary categories: bitmap and vector. Bitmap
images (also called raster images) can be represented as 2-dimensional functions f(x,y), where
they have pixel data and the corresponding gray-level values stored in some file format.
Vector images refer to methods of representing lines, curves, and shapes by storing only the
key points. These key points are sufficient to define the shapes. The process of turning these
into an image is called rendering. After the image has been rendered, it can be thought of as
being in bitmap format, where each pixel hasspecific values associated with it.
Most of the types of file formats fall into the category of bitmap images,for example:
11 | P a g e
PPM (Portable Pix Map) format
TIFF (Tagged Image File Format)
GIF (Graphics Interchange Format)
JPEG (Joint Photographic Experts Group) format
BMP (Windows Bitmap)
PNG (Portable Network Graphics)
XWD (X Window Dump)
2.6 Mathematical Tools used in Digital Image Processing
Images are viewed as the matrix. But in this series of DIP, we are using array operation. There is a
difference is Matrix and Array Operation. In Array, the operation is carried out by Pixel by Pixel
in Image.
Linear operation is Addition, Subtraction, Multiplication, and Division on the Image. Non-Linear
operation is Max, Min, Median, Mode, and Mean of the Image for Image Enhancement.
Considering a general operator H that when applied on an input image f(x,y) gives an output
image g(x,y) .i.e.,
Where a and b are arbitrary constants, f1(x,y) and f2(x,y) are input images, and g1(x,y) and
g2(x,y) are the corresponding output images.
That is, if H satisfies the properties of additivity and homogeneity, then it is a linear operator.
12 | P a g e
Arithmetic Operations:
1. Addition Operation:
Let s(x,y) is the new corrupted image as we are adding noise g(x,y) to original image f(x,y) to
hide the noise in the original image s(x,y)=f(x,y)+g(x,y). Adding constant to the image makes the
image brighter i.e s(x,y)=f(x,y)+constant.
2. Subtraction Operation:
The subtraction between two images is s(x,y)=f(x,y)-y(x,y). Where f(x,y) is image 1 and g(x,y) is
image 2. The Practical Application of image subtraction is in medical imaging called mask mode
radiography. Subtracting the constant from the original image makes it darker.
3. Multiplication Operation:
In this equation h(x,y)=f(x,y)*g(x,y) , h(x,y) is the new image formed f(x,y) is image1 and g(x,y)
is image2. We can also multiple constant to an image like h(x,y)=f(x,y)*constant. Multiplication
Operation is used in shading correction.
13 | P a g e
Figure: (a) image 1 i.e. the original image (b) multiplying image1 with 1.25 with increases the
contrast on the image
4. Division Operation
In division operation h(x,y)=f(x,y)/g(x,y) where f(x,y) and g(x,y) are two images and h(x,y) is the
new image formed. We can also divided it by constant i.e. h(x,y)=f(x,y)/constant.
Figure: (a) Image1/1.25 (b) image2 (c) image3 (d) image4= image2 *image3
(e) image5=image4/image2
Set Operations for gray scale images, set operations are array operations. The union and
intersection operations between two images are defined as the maximum and minimum of
corresponding pixel pairs respectively. The complement operation on an image is defined as the
pairwise differences between a constant and the intensity of every pixel in the image.
Let set A represent a gray scale image whose elements are the triplets (x, y, z) where (x,y) is the
location of the pixel and z is its intensity. Then,
14 | P a g e
Logical operators:
When dealing with binary images, the 1 – valued pixels can be thought of as foreground and 0 –
valued pixels as background. Now, considering two regions A and B composed of foreground
pixels,
The OR operation of these two sets is the set of coordinates belonging either to A or to B or to
both.
The AND operation is the set of elements that are common to both A and B. The NOT operation
on set A is the set of elements not in A.
The logical operations are performed on two regions of same image, which can be irregular and
of different sizes.
Figure: (a) image1 (b) image2 (c) image1 AND image2 (d) image1 OR image2
15 | P a g e