Unit 4
Unit 4
Unit 4
Overview
Images are everywhere! Sources of Images are paintings, photographs in magazines, Journals,
Image galleries, digital Libraries, newspapers, advertisement boards, television and Internet.
Images are imitations of real
real-world objects.
In image processing, the term ‘image’ is used to denote the image d data that is sampled,
quantized, and readily available in a form suitable for further processing by digital computers.
In digital image processing, the image shall be fed in as an input to the system and the system
shall interpret and understand the content to let the further actions happen.
In other words, Image processing enables us to perform the required operations on a particular
image which could help in either enhancing the image or to extract the information from the
image. One can categorize image p processing
rocessing as one of the fields of signal processing.
Nature of IP
Disadvantages
The disadvantages of digital images are very few.
Some of the disadvantages aare:
The initial cost,
problems associated with sensors such as high power consumption
potential equipment failure, and
other security issues associated with the storage and transmission of digital images.
Image processing
ocessing & Computer Graphics
Graphics:: Image processing deals with raster data or bitmaps,
whereas computer graphics primarily deals with vector data.
Image processing & Signal Processing: Digital signal processing deals with the processing of
a one dimensional signal
nal while image processing deals with visual information that is often in
two or more dimensions.
Image processing & Machine vision: The main goal of machine vision is to interpret the
image and to extract its physical, geometric, or topological properties
properties..
Image processing & Video Processing: Image processing is about still images.images A video can
be considered as a collection of images indexed by time. Thus, video processing is an extension
of image processing.
Image processing & Optics: Optical image processing sing deals with lenses, light, lighting
conditions, and associated optical circuits. The study of lenses and lighting conditions has an
important role in the study of image processing.
Image processing & Statistics: Statistics play an important role in imageima understanding and
image analysis.
The term gray level is used often to refer to the intensity of monochrome images. images
Color images are formed by a combination of individual 2 2-D images.
For example: The RGB color system.
When x, y, and f (x, y) are all finite, discrete quantities, we cacall the image a digital image.
image
Digital image is composed of a finite number of elements, each of which has a particular location and
value. These elements are referred to as:
picture elements
image elements
Pels
pixels
Pixel is the most widely used term.
Image
mage resolution depends on two factorsfactors—optical resolution of the lens and spatial resolution.
Optical resolution:
- Refers to the level of detail that an imaging system, such as a camera or scanner, can capture.
- It is primarily determined by the physical characteristics of the imaging system, including the quality
of its lenses, the size of it sensor
ensor or film, and other factors
- Typically measured in terms of the number of pixels per unit length, such as pixels per inch (PPI) or
pixels per millimeter (PPM).
- Higher optical resolution means more pixels are used to represent the same area, resulting in finer
detail and greater clarity in the captured image
Spatial resolution:
- Refers to the scale or size of the smallest unit of an image capable of distinguishing
distinguishin objects
or
-A
A measure of the smallest angular or linear distance to identify adjacent objects in an image.
- Spatial resolution is a term utilized to describe how many pixels are employed to comprise a digital
image
-Depends on two parameters— —
1. The numberr of pixels of the image
2. The number of bits necessary for adequate intensity resolution, referred to as the bit depth.
- Number of pixels determines quality of digital imageimage.
-Total
Total number pixels are measured by X (Number of rows) x Y(Number of Columns)
-To
To represent Pixel intensity value, certain bits are required
Example: Binary Image
- Binary image pixels can have only two colors, usually black and white
- Binary images are also called bi bi-level or two-level,
- Pixelart made of two colours is often ref referred to as 1-Bit or 1bit.
- This means that each pixel is stored as a single bit bit—i.e., a 0 or 1.
- Number of bits required to encode the pixel value called Bit Depth
- Bit Depth is power of two, written as 2m
- In Monochrome Gray scale image, pixel values can be rangefrom 0 to 255
- Eight bits are required to represent monochrome gray scaleimage as 28 = 256 (Range from 0 to
255), - So Bit Depth of Gray scale image is 8
So the total number of bits necessary to represent the image is = Number of rows *Number of
columns * Bit depth
The concept of 2D images can be extended to 3D images also. A 3D Image is a finction (x, y, z), where x,
y, and z are spatial coordinates.
In 3D images, the term 'voxel' is used for pixel. Voxel is an abbreviation of 'volume element'.
Classification of Images
1.Based on Nature:
i. Natural: Images of natural objects obtained using devices called cameras or scanners.
ii. Synthetic: Images that are generated using computer programs.
2.Based on Attributes:
i. Raster: Pixel based, quality based on no. of pixels
ii. Vector graphics: Use basic geometric attributes such as line andcircles to describe image
3. Based on Colour:
i. Grey scale images are different from binary images as they have many shades of grey
between black and white. These images are also called monochromatic as there is no
colour component in the image, like in binary images. Grey scale is the term that refers to
the range of shades between white and black or vice versa. versa.Gray scale use 8 bits
representation, produce 28 =256 levels. Human visual system can distinguish only 32
different gray levels
ii. In binary images, the pixels assume a value of 0 or 1. So one bit is sufficient to represent
the pixel value. Binary images are also called bibi-level images.
iii. In true colour images ges,, the pixel has a colour that is obtained by mixing the primary
colours red, green, and blue blue.. Each colour component is represented using 8 bits, sotrue
colour images use 24 bits to represent all the colours. That is 224 = 1,67,77,216 Colours
iv. A special category
ategory of colour images is the indexed image. In most images, the full range of
colours is not used. So it is better to reduce the number of bits by maintaining a colourmap,
gamut, or palette with the image.
v. Like true colour images, Pseudo-colour images are also used widely in image processing.
True colour images are called three-band images. However, in remote sensing
applications, multi-band
band images or multi
multi-spectral
spectral images are generally used. These images,
which are captured by satellites, contain many bands.
4. Based on Dimensions:
Images can be classified based on dimensions also.
Normally, digital images are a 2D rectangular array of pixels.
If another dimension, of depth or any other characteristic, is considered, it may be
necessary to use a higherer-order stack of images(3D).
A good example of a 3D image is a volume image, where pixels are called voxels.
By '3D image',, it is meant that the dimension of the target in the imaging system is 3D.
Example: CT images, MRIs, and microscopy images.
1. Image Acquisition:
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 workflow sequence because, without an image, no processing is
possible. The image that is acquired is completely unprocessed. In image acquisition using
pre-processing such as scaling is done.
2. Image Enhancement:
It is the process of adjusting digital images so that the results are more suitable for display
or further image analysis. Usually it includes sharpening of images, brightness & contrast
adjustment, removal of noise, etc.
In image enhancement, we generally try to modify the image, so as to make it more pleasing
to the eyes.
It is subjective in nature as for example some people like high saturation images and some
people like natural colour. That’s why it is subjective in nature as it differs from person to
person.
3. Image Restoration:
It is the process of recovering an image that has been degraded by some knowledge of
degraded function H and the additive noise term. Unlike image enhancement, image
restoration is completely objective in nature.
4. Color Image Processing:
Color image processing is an area that has been gaining its importance because of the
significant increase in the use of digital images over the Internet. This may include color
modeling and processing in a digital domain etc. This handles the image processing of
colored images either as indexed images or RGB images.
5. Wavelets and multiresolution processing:
Wavelets are small waves of limited duration which are used to calculate wavelet transform
which provides time-frequency information.
Wavelets lead to multiresolution processing in which images are represented in various
degrees of resolution.
6. Compression:
Compression deals with the techniques for reducing the storage space required to save an
image or the bandwidth required to transmit it.
This is particularly useful for displaying images on the internet as if the size of the image is
large, then it uses more bandwidth (data) to display the image from the server and also
increases the loading speed of the website.
7. Morphological Processing:
It deals with extracting image components that are useful in representation and description
of shape.
It includes basic morphological operations like erosion and dilation.
As seen from the block diagram that the outputs of morphological processing generally are
image attributes.
8. Segmentation:
It is the process of partitioning a digital image into multiple segments. It is generally used to
locate objects and boundaries in objects.
In general, autonomous segmentation is one of the most difficult tasks in digital image
processing. A segmentation procedure brings the process a long way toward successful
solution of imaging problems that require objects to be identified individually.
9. Representation and Description:
Representation deals with converting the data into a suitable form for computer
processing.
Boundary representation: it is used when the focus is on external shape
characteristics e.g. corners
Regional representation: it is used when the focus in on internal properties e.g.
texture
Description deals with extracting attributes that
results in some quantitative information of interest
is used for differentiating one class of objects from others
10. Recognition:
It is the process that assigns a label (e.g. Notebook, Laptop) to an object based on its
description.
It is the last step of image processing which use artificial intelligence.
Knowledge Base:
Knowledge about a problem domain is coded into an image processing system in the form
of a knowledge base.
This knowledge may be as simple as detailing regions of an image where the information of
the interest in known to be located.
The knowledge base also can be quite complex such interrelated list of all major possible
defects in a materials inspection problem or an image database containing high resolution
satellite images of a region in connection with change detection application.
However, in digital image processing, the discrete form of the image is often used. Discrete
images
ges are usually represented in the fourth quadrant of the Cartesian coordinate system. A
discrete image f(x, y), of dimension 3 x 3, is shown in Fig. 3.2(a).
Many programming environments including MATLAB start with an index of (1, 1). The
equivalent representation
sentation of the given matrix is shown in Fig. 3.2(b).
The coordinates used for discrete image is, by default, the fourth quadrant of the Cartesian
system.
2. Image Topology
Image topology is a branch of image processing that deals with the fundamental properties of
the image such as image neighborhood, paths among pixels, boundary, and connected
components.
It characterizes the image with topological properties such as neighborhood, adjacency, and
connectivity.
Neighborhood
Neighbourhood is fundamenta
fundamental to understanding image topology.
In the simplest case, the neighbours of a given reference pixel are those pixels with which the
given reference pixel shares its edges and corners.
The Diagonal Neighbours of pixel p(x,y) are represented as ND(p). The diagonal neighbours
are: {(x-1,y+1), (x+1,y+1), (x-1,y-1), (x+1,y-1)}
The 4-neighbourhood (N4) and ND are collectively called the 8-Neighbourhood (N8). This
refers to all the neighbours and pixels that share a common corner with the reference pixel
p(x, y). These pixels are called indirect neighbours. This is represented as N8(p) and is
shown graphically in Fig. 3.5.
The set of pixels N8(x) = N4(x) ꓴ ND (x)
2. 8-Connectivity It is assumed that the pixels p and q share a common grey scale value. The
pixels p and q are said to be in 8-connectivity if q is in the set N8(p).
For example, Fig. 3.6.1 shows 4-connectivity Fig. 3.6.2 shows 4-connectivity
connectivity when V= {0, 1}.
4- and 8-Connectivity
Connectivity is shown as lines. Here, a multiple path or loo
loopp is present. In m-connectivity,
m
there are no such multiple paths. The mm-connectivity
connectivity for the image in Fig. 3.6.2
3.6 is as shown in Fig.
3.7.It can be observed that the multiple paths have been removed.
Relations
A binary relation between two pixels a and b, denoted as aRb,, specifies a pair of elements of an
image. For example, consider the image pattern given in Fig. 3.8.
The set is given as A= {x1, x2, x3}. The set based on the 4-connectivity
connectivity relation is given as A =
(X1, X2). It can be observed that x3 is ignored as it is not connected to any other element of the
image by 4-connectivity.
The following are the properties of the binary relations:
Distance Measures
The distance between the pixels p and q in an image can be given by distance measures such as
Euclidian distance(De), D4 distance, and D8 distance.
Consider three pixels p, q, and z. If the coordinates of the pixels are P(x, y), Q(s, t), and Z(u,
w) as shown in Fig. 3.9, the distances between the pixels can be calculated.
i) Euclidian distance(De)
The Euclidean Distance between p and q is definedas:
𝑫𝒆 (𝒑, 𝒒) = (𝒙 − 𝒔)𝟐 + (𝒚 − 𝒕)𝟐
Example:
The pixels with distance D4≤ 2 from (x,y) form the following contours of constant distance. The
pixels with D4= 1 are the 4-neighbors of (x,y)
Example:
D8 distance ≤ 2 from (x,y) form the following contours of constant distance. The pixels with D8=1
are the 8-neighbors of (x, y).
iv) DmDistance:
It is defined as the shortest m
m-path between
tween the points.In this case, the distance between two
pixels will depend on the values of the pixels along the path, as well as the values of their
neighbors.
Example:
Solution:
3. Shortest-m path
Path
A digital path (or curve) from pixel p with coordinate (x, y) to pixel q with coordinate (s, t) is a
sequence of distinct pixels with coordinates (x0 , y0 ), (x1 , y1 ), ...,
.., (xn , yn ), where(x0 , y0 )=
(x, y), (xn , yn )= (s, t)
(xi , yi )and (xi-1 , yi-1 ) are adjacent pixel for 1≤j≤n ,
n- The length of the path.
If (x0 , y0 )= (xn , yn ):the
the path is closed path.
We can define 4- ,8- , or m-pathspaths depending on the typee of adjacency specified.
Region
A connected set is also called a Region.
Two regions (let Ri and Rj) are said to be adjacent if their union forms a connected set.
Adjacent Regions or joint regions
Regions that are not adjacent are said to be disjoint regions.
4- and 8-adjacency
adjacency is considered when referring to regions
Boundary
The boundary (border or contour) of a region R is the set of points that are adjacent to the
points in the complement of R.
Set of pixels in the region that have at least one background neighbor.
The boundary of the region R is the set of pixels in the region that have one or more neighb
neighbors
that are not in R.
Inner Border: Border of Foreground
Outer Border: Border of Background
2. Property of Homogeneity
A non-linear
linear operator does not follow above operations.
Image operations are array operations
operations.. These operations are done on a pixel-by-pixel basis.
Array operations are different from matrix operations.
For example, consider two images
The multiplication
lication of F1, and F2 is element
element-wise, as follows:
In addition, one can observe that F1 * F2 = F2 * F1, whereas matrix multiplication is clearly
different, since in matrices, A*B ≠B*A.
By default, image operations are array operations only.
Arithmetic Operations
Arithmetic operations in images include Addition, Subtraction, Multiplication, and Division.
1. Image Addition
Two images can be added in a direct manner, as given by
The pixels of the input images f1(x, y) and f2(x, y) are added to obtain th
the resultant image
g(x,y).
Similarly it is possible to add a constant value to a single image as follows to increase its
brightness or intensity
2. Image Subtraction
The Subtraction of two images can be done as follows:
To
o decrease the intensity or brightness.
Some of the practical applications of image subtraction are:
1.Background Elimination
2.Brightness reduction
3.Change detection
3. Image Multiplication
Image Multiplication can be done in the following manner
manner:
If ’k’ is less than 1, contrast of the image decreases, if ’k’ is greater than 1, contrast increases.
3. Image Division
Image Division operation can done as follows:
Logical Operations
Bit wise logical operations can be applied to image pixels.
The resultant pixel is determined by the rules of the particular operation.
Some of the logical operations that are widely used in image processing are as follows:
follow
1. AND/NAND
2. OR/NOR
3. EXOR/EXNOR
4. NOT
1. AND/NAND
The operators AND and NAND take two images as input and produce one output image.
The output image pixels are the output of the logical AND/NAND of the individual pixels.
Some of the practical applications of the AND and NAND operators are as follows:
1. Computation of the intersection of images
2. Design of filter masks
3. Slicing of grey scale images
2. OR/NOR
The practical applications of the OR and NOR operators are as follows:
1. OR is used as the union operator of two images.
2. OR can be used as a merging operator.
3. EXOR/EXNOR
The practical applications of the XOR and XNOR operators are as follows:
1. Change detection
2. Use as a subcomponent of a complex imaging operation. XOR for identical inputs is zero.
Hence it can be observed that the common region of image 1 and image 2 in Figs (a) and (b),
respectively, is zero and hence dark. This is illustrated in Fig. 3.19.
4. Invert/Logical NOT
Geometric operations
1. Translation
Translation is the movement of an image to a new position.
Let us assume a point at the co
co-ordinate position X=(x, y) of the matrix F is moved to the
new position X ′,, whose co
co-ordinate position is (x’, y’).
Mathematically this can be stated as a translation of a point X to the new position X’.
The translation is represented as
x ′ = x + δx
y ′ = y + δy
In a Homogeneous Co-ordinate
ordinate system, in matrix form as
as:
2. Scaling
Scaling means enlargement and shrinking.
In the homogeneous co-ordinate
ordinate system, the scaling of the point (x,y) of the image F to the
new point (x’, y’) of the image F’ is described as:
x ′ = x * Sx
y ′ = y * Sy
4. Shearing
4. Rotation
An image can be rotated by various degrees such as 900, 1800, 2700.
In the matrix form it is given as:
Affine Transformation
Inverse Transformation
3D Transforms
Set operations
Morphology is a collection of operations based on set theory, to accomplish various tasks such
as extracting boundaries, filling small holes present in the image, and removing noise present
in the image.
Mathematical morphology is a very powerful tool for analysing the shapes of the objects that
are present in the images. The theory of mathematical morphology is based on set theory.
The set operators such as intersection, union, inclusion, and complement can then be applied to
the images.
The two most widely used Morphological operations are Erosion and Dilation.
1. Erosion
Erosion shrinks the image pixels, or erosion removes pixels on object boundaries.
Let us assume that A and B are a set of pixel coordinates. The dilation of A by B can be denoted
as:
where x and y correspond to the set A, and u and v correspond to the set B.
B The coordinates are
subtracted and the intersection
rsection is carried out to create the resultant set.
se
2. Dilation
Dilation expands the image pixels, or it adds pixels on object boundaries.
It can be applied to binary as well as grey scale images.
The basic effect of this operator on a binary image is that it gradually increases the boundaries
of the region, while
le the small holes that are presen
presentt in the images become smaller.
Let us assume that A and B are a set of pixel coordinates. The dilation of A by B can be denoted
as:
where x and y correspond to the set A, and u and v correspond to the set B. The coordinates
are added and the union is carried out to create the resultant se
set.
Statistical operations
Questions on Unit-4
1. Write a Program to read a digital image. Split and display image into 4 quadrants, up, down,
right and left.
2. Write a program to show rotation, scaling, and translation on an image.
3. In detail explain the fundamental steps involved in digital image processing systems.
4. Explain in detail the classification of images.
5. Illustrate the relationship between image processing and other related fields.
6. Given a grey-scale image of size 5 inches by 6 inches scanned at the rate of 300 dpi, answer
the following:
(a) How many bits are required to represent the image?
(b) How much time is required to transmit the image if the modem is 28 kbps?
(c) Repeat (a) and (b) if it were a binary image.
7. Explain Digital image representation. A picture of physical size 2.5 inches by 2 inches is
scanned at 150 dpi. How many pixels would be there in the image?
8. Explain Distance measure. Compute the Euclidean Distance (D1), City-block Distance (D2)
and Chessboard distance (D3) for points p and q, where p and q be (5, 2) and (1, 5)
respectively. Give answer in the form (D1, D2, D3).
9. Describe the fundamental steps in image processing?
10. Describe the basic relationship between the pixels
a. Neighbours of a pixel
b. Adjacency, Connectivity, Regions and Boundaries
c. Distance measures
11. All solved problems in notes.
12. Summarize the Arithmetic operations on digital images with relevant expressions.
13. Summarize the Logical operations on digital images with relevant expressions.
14. Explain 2D Geometric transformation with equations and homogeneous matrix.
15. Consider two pixels x and y whose coordinates are (0, 0) and (6, 3) .Compute De, D4, D8 distance
between x and y
16. Consider the following two images. Perform the arithmetic operations: addition,
multiplication, division. Assume that all the operations are uint8.
17. Consider the images f1 and f2 in above question. What is the result of image subtraction
and image absolute difference? Is there any difference between them?
18.
19. Consider the following two images. The addition and subtraction of images are given by f1+f2 and
f1−f2. Assume both the images are of the 8-bit integer type.
20. Consider the following two images. Perform the logical operations AND, OR, NOT and
difference.
DIFFERENCE: