0% found this document useful (0 votes)
4 views

Module 1

The document covers the fundamentals of digital image processing, including concepts like spatial and intensity resolution, point processing techniques, and the transition from 3D to 2D images. It discusses various applications of image processing such as biometrics, vehicle number plate detection, and medical imaging, as well as the basic components and steps involved in image processing systems. Additionally, it explains the electromagnetic spectrum and the methods of image acquisition using different sensor arrangements.

Uploaded by

aryandake2004
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)
4 views

Module 1

The document covers the fundamentals of digital image processing, including concepts like spatial and intensity resolution, point processing techniques, and the transition from 3D to 2D images. It discusses various applications of image processing such as biometrics, vehicle number plate detection, and medical imaging, as well as the basic components and steps involved in image processing systems. Additionally, it explains the electromagnetic spectrum and the methods of image acquisition using different sensor arrangements.

Uploaded by

aryandake2004
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/ 50

DIGITAL IMAGE FUNDAMENTALS AND POINT

PROCESSING
Introduction –Steps in Digital Image Processing, concept of spatial and
intensity resolution, Relationships between pixels
Point Processing : Image Negative, Log Transform, Power Law transform, Bit
plane slicing, Contrast stretching , Histogram equalization and Histogram
Specification

Human beings are primarily visual creatures who depend on their eyes to
gather information around them. Of the five senses that human beings have, sight

ar
is what we depend upon the most. Not many animals depend on their visual
systems; the way human beings do.

nk
Bats use high frequency sound waves. They emit sound waves which reflect
back when they encounter some obstruction. Cats have poor vision but an excellent

ao
sense of smell. Snakes locate prey by heat emission and fish have organs that sense
electrical fields.
g
What Do We Mean by Image Processing?
or

What happens when we look at an object?


K

The eye records the scene and sends signals to the brain. These signals get
processed in the brain and some meaningful information is obtained. Let us take a
li

simple example: when we see fire, we immediately identify it as something hot. Two
things have happened here.
ja

The scene has been recorded by the eye.


an

(1) The brain processed this scene and gave out a warning signal.

This is image processing.


it
G

 We start processing images from the day we are bom. Hence image processing
is an integral part of us and we continue to process images till the day we die. So
even if this subject seems to be new, we have been subconsciously doing this, all
these years. The human eye-brain mechanism represents the ultimate imaging
system.
 Apart from our vision, we have another important trait that is common to all
human beings. We like to store information, analyse it, discuss it with others and
try to better it. This trait of ours is responsible for the rapid development of the
human race.
 Early human beings strove to record their world by carving crude diagrams on
stone. All the drawings that we see in old caves is just that; storing images seen,
trying to analyse them and discussing it with others in the tribe. Refer below
figure:

ar
nk
Figure 11

ao
 This art developed through the ages by way of materials and skill. By the mid-
nineteenth century, photography was well established. Image processing that we
g
study starts from this era.
or
 Though it was stated earlier that the human eye-brain mechanism represents the
ultimate imaging system, image processing as a subject involves processing
K

images obtained by a camera. With the advent of computers, image processing


as a subject grew rapidly.
li

 Images from a camera are fed into a computer where algorithms are written to
process these images. Here, the camera replaces the human eye and the computer
ja

does the processing.


an

 Hence image processing as an engineering subject is basically manipulation of


images by a computer.
it
G

Figure 12
Image
Let us now define what we mean by an image. The world around us is 3-
dimensional, while images obtained through a camera are 2-dimensional. Hence an
image can be defined as a 2-dimensional representation of a 3-dimensional world.
Consider the image shown in Fig.

Figure 13
In moving from the 3-dimensional world to the 2-dimensional image, we lose one
dimension. Depth information is lost as can be seen from the above figure; the

ar
handle of the tea cup is missing.
All family pictures, photographs on identity cards etc. are 2-dimensional. If this

nk
statement is not clear, let us take a simple example.

ao
Example of a 1 •dimensional and a 2-dlmenslonal signal
Consider a voltage signal shown in Fig. 1.4. We are all familiar with a signal of this
g
kind. Here the voltage is varying with respect to time. This is a typical 1-
or
dimensional signal. If we want to locate a dot on the wave, all we need to know is it
corresponding time.
K
li
ja
an

Figure 14
it

Let us see why images are 2-dimensional functions. Consider the image shown in
G

Fig.1.5.

Figure 15
In this case, to locate the dot shown, we need to know its position in two directions
(x and y) Fig.1.6 Hence all images that we see are 2-dimensional functions.

Figure 16
A typical image is represented as shown in Fig.1-6. Here (x1,y1) are the spatial

ar
coordinates and f is the grey level (colour in the case of colour image) at that point.
Hence grey level f varies with respect to the x and y coordinates.

nk
Image: An image may be defined as a two dimensional function f(x, y) where x & y
are spatial coordinates and amplitude of at any pair of coordinates(x, y) is called the

ao
intensity or grey level of the image at that point.
Digital Image: when x, y & amplitude values of f are all finite, discrete quantities
we call the image a digital image.
g
Digital image is composed of a finite number of elements.
or
These elements are known as pixel (picture element).
Pixels have particular location and value.
K

Analog image: it can be mathematically represented as continuous range of values


representing position & intensity.
li
ja
an

The Electromagnetic Spectrum:


it

The apparatus shown in Fig. 1.2 will work only if light is incident on the object.
G

What we call light is actually a very small section of the electromagnetic energy
spectrum. The entire spectrum is shown in Fig. 1.7.
Figure 18
Electromagnetic energy, exists in the simultaneous form of electricity and
magnetism. These two forms of the same energy are transmitted together as
electromagnetic radiation. One cannot exist without the other. A flow of
electric current always produces magnetism, and magnetism is used to
produce electricity. Electromagnetic radiation is propagated outwards from
its source at a velocity of 300,00.0000 meters per second (3x10* m/sec).
Although our natural source of electromagnetic radiation is the sun. there are
also a number of man-made sources which. among many others, include
tungsten filament lamps, gas discharge lamps and lasers. Light is a band of
electromagnetic radiation mediated by the human eye and is limited to a

ar
spectrum extending from 380 nm to 760 nm. Most of the images that we
encounter in our day-to-day life are taken from cameras which are sensitive
to this range of the electromagnetic spectrum (380-760 nm). We must not

nk
forget though, that there are cameras which are capable of detecting infrared,
ultraviolet light. X-rays and radio waves too. The electromagnetic spectrum
can be expressed in terms of wavelength and frequency. The wavelength (λ)

ao
and the frequency (v) are related by the expression
λ= c/v
g
or
Applications of Image Processing
Image Processing as a subject is growing leaps and bounds. From a very
K

modest beginning. Image Processing, has been constantly evolving. With the
advent of computers, the area of image processing has emerged today as a
subject of interdisciplinary study. Given below are a few areas of image
li

processing.
ja

(1) Biometrics : A concise definition of biometrics is “the automatic


recognition of a person using distinguishing traits. A more expansive
an

definition of biometrics is “any automatically measurable, robust and


distinctive physical characteristic or personal trait that can be used to identify
an individual or verify the claimed identity of an individual.” Biometrics is
it

used for human recognition which consists of identification and verification.


G

(2) Vehicle number plate detection: Automated license plate recognition is a


very relevant topic that is gaining importance. With the number of accidents
taking place each year, this tool can be used in monitoring the speed of
vehicles. This could also be used in reducing bottlenecks at toll centres. The
first step in the recognition process is obtaining a photo of the vehicle, usually
by use of a mounted CCD camera. After this, various algorithms are used to
transform an image to a string consisting of the license plate number. One
would require doing basic pre-processing like image enhancement, plate area
localisation and noise reduction.
(3) Content Based Image Retrival (CB1R): Content-based image retrieval
(CBIR), is an application of computer vision and is used for searching digital
images in a large database. The term ‘content’ in CBIR refers to colors,
shapes, textures, or any other information that can be derived from the image
itself. In a content-based image retrieval algorithm, a search analyses the
actual contents of the image.
(4) Steganography: Steganography is the art of hiding information. With the
growth of networked multimedia systems, the need of secure data transfer
increases. Steganography is a technique in which secret data is hidden in a
carrier signal, in this case image. An intruder of the network sees the carrier
image without realising that there is hidden information present in it.
(5) Medical Imaging: This is another area which has progressed
tremendously with the advent of various algorithms. Some of the imaging

ar
modalities which use image processing extensively are X-rays, Computer
Tomography (CT), Magnetic resonance Imaging (MRI), Positron Emission
Tomography (PET).

nk
Basic components of Image Processing System :

g ao
or
K
li
ja
an

Computer: In an image processing system is a general purpose computerand


it

can range from a PC to a super computer. In dedicated applications, sometimes


specially designed computers are used to achieve a required level of
G

performance.
- Software: for image processing consists of specialized modules that perform
specific tasks.
Mass storage: capability is must in image processing applications. Digital
storage for image processing applications falls into three principle categories:
(1) short-term storage
(2) on-line storage for relatively fast recall,
(3) archival storage, characterized by infrequent access.

- Image display: It displays the images.


- Hardcopy devices: Used for recording images include laser printers, film
cameras, heat sensitive devices, inkjet units and digital units such as optical and
CDROM disks.

Fundamental steps in Digital Image Processing :

ar
nk
g ao
or
K
li

1. Image Acquisition:
ja

- This is the first step or process of the fundamental steps of digital image
processing. Image acquisition could be as simple as being given an image that
an

is already in digital form. Generally, the image acquisition stage involves pre-
processing, such as scaling etc.
2. Image Enhancement:
it

- Image enhancement is among the simplest and most appealing areas of


digital image processing. Basically, the idea behind enhancement techniques
G

is to bring out detail that is obscured, or simply to highlight certain features of


interest in an image. Such as, changing brightness & contrast etc.

3. Image Restoration:
- Image restoration is an area that also deals with improving the appearance of
an image. However, unlike enhancement, which is subjective, image
restoration is objective, in the sense that restoration techniques tend to be
based on mathematical or probabilistic models of image degradation.

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.

5. Wavelets and Multi-Resolution Processing:


- Wavelets are the foundation for representing images in various degrees of
resolution. Images subdivision successively into smaller regions for data
compression and for pyramidal representation.

6. Compression:
- Compression deals with techniques for reducing the storage required to save
an image or the bandwidth to transmit it. Particularly in the uses of internet it
is very much necessary to compress data.

ar
7. Morphological Processing:
- Morphological processing deals with tools for extracting image components
that are useful in the representation and description of shape.

nk
8. Segmentation:
- Segmentation procedures partition an image into its constituent parts or

ao
objects. In general, autonomous segmentation is one of the most difficult
tasks in digital image processing. A rugged segmentation procedure brings
the process a long way toward successful solution of imaging problems that
g
require objects to be identified individually.
or
9. Representation and Description:
- Representation and description almost always follow the output of a
K

segmentation stage, which usually is raw pixel data, constituting either the
boundary of a region or all the points in the region itself.
- Choosing a representation is only part of the solution for transforming raw
li

data into a form suitable for subsequent computer processing.


- Description deals with extracting attributes that result in some quantitative
ja

information of interest or are basic for differentiating one class of objects


from another.
an

10. Object recognition:


- Recognition is the process that assigns a label, such as, “vehicle” to an
it

object based on its descriptors.


G

11. Knowledge Base:


- Knowledge may be as simple as detailing regions of an image where the
information of interest is known to be located, thus limiting the search that
has to be conducted in seeking that information. The knowledge base also can
be quite complex, such as an interrelated list of all containing high-resolution
satellite images of a region in connection with change-detection applications.

Image Sensing and Acquisition


- The images 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.
- There are 3 principal sensor arrangements (produce an electrical output
proportional to light intensity).
(i)Single imaging Sensor
(ii)Line sensor
(iii)Array sensor

ar
nk
g ao
or
K

Incoming energy is transformed into a voltage by the combination of input


electrical power and sensor material.
- The output voltage waveform is the response of the sensor(s), and a digital
li

quantity is obtained from each sensor by digitizing its response


ja

∙ Image Acquisition Using a Single Sensor:


an

- The most common sensor of this type is the photodiode, which is made of
silicon The use of a filter in front of a sensor improves selectivity. For example,
a green (pass)filter in front of a light sensor favours light in the green band of the
it

color spectrum.- As a consequence, the sensor output will be stronger for green
G

light than for other components in the visible spectrum.


- 2D image generated by displacement in x- and y directions between the sensor
and the area to be imaged
Fig. shows an arrangement used in high-precision scanning, where a film
negative is mounted onto a drum whose mechanical rotation provides
displacement in one dimension.
- The single sensor is mounted on a lead screw that provides motion in the
perpendicular direction, because mechanical motion can be controlled with high
precision. This method is an inexpensive (but slow) way to obtain high-
resolution images.

∙ Image Acquisition Using Sensor Strips:


- Fig (a) shows the strip provides imaging elements in one direction.- Fig (b)
shows motion perpendicular to the strip provides imaging in the other direction.
- This is the type of arrangement used in most flatbed scanners. Sensing devices
with 4000 or more in-line sensors are possible.

ar
- In-line sensors are used routinely in airborne imaging applications, in which the
imaging system is mounted on an aircraft that flies at a constant altitude and

nk
speed over the geographical area to be imaged.
- One-dimensional imaging sensor strips that respond to various bands of the
electromagnetic spectrum are mounted perpendicular to the direction of flight.-

ao
The imaging strip gives one line of an image at a time, and the motion of the
strip completes the other dimension of a two-dimensional image.
- Sensor strips mounted in a ring configuration are used in medical and industrial
g
imaging to obtain cross sectional (“slice”) images of 3 -D objects.
- A rotating X-ray source provides illumination and the portion of the sensors
or
opposite the source collect the X-ray energy that pass through the object.
- This is the basis for medical and industrial computerized axial tomography
K

(CAT)imaging
li
ja
an
it
G

∙ Image Acquisition using Sensor Arrays:


ar
An example of the digital image acquisition process. (a)Energy
(“illumination”) source.(b) An element of a scene. (c) Imaging system. (d)

nk
Projection of the scene onto the imageplane. (e) Digitized image.

- This type of arrangement is found in digital cameras. A typical sensor for these

ao
cameras is a CCD array, which can be manufactured with a broad range of
sensing properties and can be packaged in rugged arrays of 4000 * 4000
elements or more.
g
or
The response of each sensor is proportional to the integral of the light energy
projected on to the surface of the sensor, a property that is used in astronomical
and other applications requiring low noise images.
K

- The first function performed by the imaging system in Fig.(c) is to collect the
incoming energy and focus it onto an image plane.
- If the illumination is light, the front end of the imaging system is a lens, which
li

projects the viewed scene onto the lens focal plane as Fig.(d) shows.
- The sensor array, which is coincident with the focal plane, produces outputs
ja

proportional to the integral of the light received at each sensor.


- The output is a digital image, as shown diagrammatically in Fig.(e)
an

6. Sampling and Quantization:


it

- The o/p of most sensors is a continuous voltage w/f whose amplitude & spatial
behaviour are related to the physical phenomenon being sensed.
G

- To create a digital image, we need to convert the continuous sensed data into
digital form. This involves two processes: Sampling and Quantization.
ar
nk
g ao
Fig (a) shows continuous image f(X,Y) that we want to convert into digital
image - Continuous in x and y coordinates & amplitude also.
or
- We have to sample the function in both coordinates and in amplitude.
-Digitizing the coordinate values is called sampling.
K

-Digitizing the amplitude values is called quantization


- Consider line AB (s segment) in fig (b), it is plot of grey levels (amplitude)
of continuous image along the line segment AB.
li

- Radom variation is due to image noise.


- Fig (c) shows location of each sample which is given by vertical mark on
ja

bottom part. - Samples are shown as small white squares superimposed on the
function. - Set of discrete samples gives sampling function.
an

- Vertically it represents grey level values.


- Right side on Fig c shows different grey level values, ranging from black to
white. - Digital samples resulting from both sampling and quantization are
it

shown in fig (d). - After this process we will get image which shown in below
figure.
G
ar
nk
Quantization: The samples values are represented by finite set of integer values.
This is known as quantization

ao
Question: Justify “Quality of picture depends on the number of pixels & grey
levels”. OR g
Justify “Quality of an image is decided by its tonal and spatial
or
resolution”.
K

Answer:

- Every image is seen on screen is actually in matrix form. Each element of matrix is
li

called pixel if matrix is N X M so total pixels are NX M.


ja
an

If size of N x M is large than pixel value becomes more & sampling rate will be
increased therefore, we will get better resolution (quality). Value of each pixel is
it

known as grey level.


- Computer understands only 0’s and 1’s. Hence these grey levels need to be
G

represented in terms of 0’s and 1’s.


- If we have two bits to represent the grey levels only 4 diff grey levels are
available 00,01,10,11. Here 00 – black, 11- White remaining values are shades
of grey. Similar 8 bits are used for 1 pixel representation so 28 =256 grey levels
are available.
So, more bits, more grey levels & better resolution. total size of image is N X M
X m where m is no of bits used for 1 pixel. Here m is no bits for 1 pixel.
- So we can say quality of image depends on pixels & grey levels.
Question: explain image sampling & quantization of a medical image has size of 8

ar
X 8 inches. The sampling resolution is 5 cycles/mm. How many pixels are
required? Will an image of size 256 X 256 be enough?

nk
Solution:
- 1 cycle/mm = 1 line pair /mm
- 1 line pair means 1 line white and 1 line black

ao
- For 1 line pair at least we require 2 pixels/mm
- So 5 cycle/mm = 10 pixels/mm
- Size is 8 inch X 8 inch g
- 1 inch = 25.4 mm
- 8 X 25.4= 203.2 mm
or
- 203.2 mm X 203.2 mm
- each mm there are 10 pixels
K

- total pixels= (2032 X 2032 )


- We require 2032 X 2032 pixels to represent image so 256
X256 pixels will not be enough to represent the given image.
li

Image types
ja

1) Binary image /monochrome image:


The binary image as it name states, contain only two pixel values: 0 and 1. Here 0
an

refers to black colour and 1 refers to white colour. It is also known as


Monochrome.
2) Grey scale image:
it

It has 256 different shades of colours in it. It is commonly known as Grayscale


G

image. The range of the colours in 8 bit varies from 0-255, where 0 stands for
black, 255 stands for white and 127 stands for grey colour.
3) Colour image(24 bit): 24 bit colour format is also known as true colour
format. In a 24 bit colour format, the 24 bits are again distributed in three
different formats of Red, Green and Blue.
Since 24 is equally divided on 8, so it has been distributed equally between three
different colour channels.
- Their distribution is like this. 8 bits for R, 8 bits for G, 8 bits for B. A 24-bit

ar
colour image supports 16777216 diff combination of colours. Colour image can
be converted in grey scale image using this equation

nk
- X= 0.30 R + 0.59G + 0.11B.
4) Volume Image: A 3-dimensional image is an example. It can be obtained
from some medical imaging equipment in which individual data points are

ao
called “Voxels”, which stands for volume pixels. A CT scan is an example of
volume image.
g
Image file format:
or
1) BMP (bit mapped graphic Image): colour as well as monochrome image. - Ex.
Paint and saved images in computer.
- Quality is good but more storage is required.
K

2) TIFF (also known as TIF) :TIFF stands for Tagged Image File Format.
- TIFF images create very large file sizes.
- TIFF images are uncompressed and thus contain a lot of detailed image data
li

(which is why the files are so big) TIFFs are also extremely flexible in terms
ja

of colour
3) JPEG (also known as JPG): JPEG stands for Joint Photographic Experts Group,
which created this standard for this type of image formatting.
an

- JPEG files are images that have been compressed to store a lot of information
in a small size file.
- Most digital cameras store photos in JPEG format, because then you can take
it

more photos on one camera card than you can with other formats. A JPEG is
G

compressed in a way that loses some of the image detail during the
compression in order to make the file small (and thus called “lossy”
compression).
- JPEG files are usually used for photographs on the web, because they create a
small file that is easily loaded on a web page and also looks good.
4) GIF (Graphic Interchange Format): This format compresses images but, as
different from JPEG, the compression is lossless (no detail is lost in the
compression, but the file can’t be made as small as a JPEG).
- This format is never used for photography, because of the limited number of
colours. GIFs can also be used for animations.
5) PNG (Portable Network Graphics): It was created as an open format to replace
GIF, because the patent for GIF was owned by one company and nobody else
wanted to pay licensing fees. - It also allows for a full range of colour and better
compression. It’s used almost exclusively for web images, never for print
images.
- For photographs, PNG is not as good as JPEG, because it creates a larger
file. But for images with some text, or line art, it’s better, because the images
look less “bitmappy.”

Image resolution:
1. Spatial resolution: It depends on the numbers of pixels. The principal factor
determining spatial resolution is sampling.
2. Grey level Resolution: It depends on number of grey levels. Smallest discernible
changes in grey level.

ar
nk
Colour models:
1. RGB models:

ao
This is an additive model, i.e. the colours present
in the light add to form new colours, and is
appropriate for the mixing of coloured light for
g
example. Red, green and blue are primary colors
to form the three secondary colours yellow (red +
or
green), cyan (blue + green) and magenta (red +
blue), and white ((red + green + blue).
K

2. CMY model:
li

The CMYK color model (process color, four color) is a


subtractive color model, used in color printing, and is
ja

also used to describe the printing process itself. CMYK


refers to the four inks used in some color printing:
an

cyan, magenta, yellow, and key (black).


C= 1-R
M=1-G
it

Y=1-B
To save cost on ink, and to produce deeper black tones, unsaturated and black
G

colors are produced by using black ink instead of combination of cyan, magenta
and yellow.

3. HIS Model:
Hue: Dominant colour observe by observer
Intensity: Amount of white color mixed with Hue.
Saturation: Amount of brightness reflection.
ar
nk
g ao
or
K
li
ja

4. YIQ color model:


This is used for color TV. Here Y is the luminance (the only component
an

necessary for B&W TV). I and Q gives Chromaticity. The conversion from
RGB to YIQ is given by
it
G

The advantage of this model is that more bandwidth can be assigned to the Y-
component (luminance) to which the human eye is more sensible than to
color information.

Basic relationship between pixels:


Neighbours of Pixels:
- A pixel p at coordinates (x, y) has four horizontal and vertical neighbors whose
coordinates are given by (x+1, y), (x-1, y), (x, y+1), (x, y-1). This set of
pixels, called the 4-neighbors of p, is denoted by N4 (p). Each pixel is a unit
distance from (x, y), and some of the neighbors of p lie outside the digital
image if (x, y) is on the border of the image.
The four diagonal neighbors of p have coordinates (x+1, y+1), (x+1, y-1), (x-1,
y+1), (x-1, y 1) and are denoted by ND
(p). These points, together with the 4-
neighbors, are called the 8-neighbors of
p, denoted by N8 (p). As before, some of
the points in ND (p) and N8 (p) fall

ar
outside the image if (x, y) is on the
border of the image.

nk
Adjacency:
- Two pixels are connected if they are neighbours and their grey levels are satisfy

ao
some specified criteria of similarity.
- For example, in a binary image two pixels are connected if they are 4-neighbors
and have same value (0/1).
g
- Let V be set of gray levels values used to define adjacency
or

4-adjacency: Two pixels p and q with values from V are 4- adjacent if q is in the set
K

N4(p)
li

8-adjacency: Two pixels p and q with values from V are 8- adjacent if q is in the set
ja

N8(p).
an

m-adjacency: Two pixels p and q with values from V are m- adjacent if,
it

i)q is in N4(p)
G

ii)q is in ND(p) and the set [N4(p) Ո N4(q)] is


empty

connectivity:
- To determine whether the pixels are adjacent in some sense. Let V the set of grey
level values used to define connectivity then two pixels p & q that have values from
the set v are:
4 connected: if q is in set of N4(p)
8 connected: if q is in set of N8(p)
m-connected: if
i) q is in set of N4(p)
ii)q is in ND(p) and the set [N4(p) Ո N4(q)] is empty
Here V= ( 1,2)

ar
nk
g ao
or
K
li

Spatial and Intensity Resolution :


Spatial Resolution Spatial resolution is indicative of the number of samples that are
ja

present in the linage. Hence Spatial resolution depends on the Sampling. Spatial
resolution can be defined as is the smallest discernible detail in an image.
an

Intensity resolution which is also known as Gray level resolution or Tonal resolution
is indicative of the number of grey levels that are present in the image. Hence
it

Intensity resolutiondepends on the number of bits used to represent the image and
can be defined as the smallest discernible change in gray level.
G

12. Distance Transform:


1) Euclidean Distance: it is the straight line distance between two pixels. If p and q
are the two pixels with coordinates(x1,y1) and (x2,y2) then
DE = [(x1,y1 ) 2+ (x2,y2)2]1\2

2) City block distance (D4 distance): If p and q are the two pixels with
coordinates(x1,y1) and (x2,y2) then
D(city) = D(p,q) = │ x1-x2 │ + │ y1-y2 │
3) Chess Board Distance (D8 Distance):

If p and q are the two pixels with coordinates(x1,y1) and (x2,y2) then
D8(p,q) =Max( │ x1-x2 │ , │ y1-y2 │)
4) Dm Distance: This distance is measured based on m adjacency. Pixel p and q are
m adjacent ifi) q is in set of N4(p)
ii)q is in ND(p) and the set [N4(p) I N4(q)] is empty
Example : Let V = {0,1}. Compute DE, D4 ,D8, Dm distance between two pixels p
and q let the pixel coordinates of p and q be (3,0) and (2,3) respectively for the
image shown. Find distance measures.

ar
nk
Solution:
g ao
or
V = {0,1} implies that the distance traversed can pass through 0 and 1.
K
li
ja
an
it
G

Here V={0,1} so we traverse the path shown below.


Example: Let V = {2,4}. Compute D4, D8, Dm distance between two pixels p

ar
and q.

nk
g ao
or
K

Solution:
li

here p(0,2) and q(3,0)


ja

i) D4 distance: D4 (p,q) = │ x1-x2 │ + │ y1-y2 │ = │ 0-3 │ +


│ 2-0 │ = 5
an

ii) D8 Distance : D8(p,q) =Max( │ x1-x2 │ , │ y1-y2 │)


Max(│ 0-3│ , │ 2-0 │)
= Max(3,2)
it

=3
G

iii) Dm Distance: This distance is measured based on m


adjacency. Pixel p and q are m adjacent if
i) q is in set of N4(p)
ii)q is in ND(p) and the set [N4(p) ∩ N4(q)] is empty
here V={2,4} so we traverse the path shown below.
ar
Dm = 1.4+1+1+1= 4.4

nk
Image Enhancement in Spatial Domain:
Image enhancement is one of the first steps in image processing. As the name

ao
suggests, in this technique, the original image is processed so that the
resultant image is more suitable than the original for specific applications i.e.
the image is enhanced. Image enhancement is a purely subjective processing
g
technique. By subjective we mean that the desired result varies from person
or
to person. An image enhancement technique used to process images might be
excellent for a person, but the same result might not be good enough for
another. It is also important to know at the outset that image enhancement is a
K

cosmetic procedure i.e. it does not add any extra information to the original
image. It merely improves the subjective quality of the images by working
with the existing data Image enhancement can be done in two domains :
li

(1) The spatial domain


ja

(2) The frequency domain.


an

Spatial Domain Methods


The term spatial domain means working in the given space, in this case, the
it

image. It implies working with the pixel values or in other words, working
directly with the raw data.
G

Let f(x. y) be the original image where f is the grey level value and (x. y) are
the image coordinates. For a 8-bit image, f can take values from 0 - 255
where 0 represents black, 255 represents white and all the intermediate values
represent shades of grey. In a image of size 256 x 256. x and y can take
values from (0,0) to (255,255) as shown below

The modified image can be expressed as


Here f(x. y) is the original image and T is the transformation applied to it to
get a new modified image g(x, y). For all spatial domain techniques, it is
simply T that changes. The general equation remains the same. To
summarize, spatial domain techniques are those, which directly work with the
pixel values to get a new image based on above Equation. Spatial domain
enhancement can be carried out in two different ways
(1) Point processing
(2) Neighbourhood processing

Point Processing:

ar
In point processing, we work with single pixels i.e. T is 1 x 1 operator. It
means that the new value f(x. y) depends on the operator T and the present

nk
f(x, y). This statement will be clear as we start giving some examples.
In the Fig., the solid line is the transformation T. The horizontal axis
represents the grey scale of the input image (r) and the vertical axis represents

ao
the grey scale of the output image (s). It is called an identity transformation
because it does not modify the new image at all !!. As seen, the grey level 10
is modified to 10.125 to 125 and finally 255 to 255. In general s1=r1 ,below
g
Fig. will help us to understand point processing techniques better.
or
K
li
ja
an
it
G

s = T(r)
r = input pixel
Intensity
s = output pixel
Intensity
T is a function

Some of the common examples of point processing ire

ar
1) Digital Negative:
Digital negatives are useful in a lot of applications, common example of

nk
digital negative is the displaying of an X-i image As the name suggests,
negative simply means inverting i grey levels i.e. black in the original image
will now look white a vice versa. The Fig. is the digital negative

ao
transformation for 8-bit image.
g
or
K
li
ja

L is number of Grey levels


- In this case, L=256, thus, S = (256 – 1) – r
an

- So we can write, S = 255- r


- Thus, S = 255 for r=0
it

Negatives are normally used to make positive prints on photographic paper by


G

projecting the negative onto the paper with a photographic enlarger or making
a contact print.

2. Contrast Stretching :
Fig. a) Form of T function b) Low Contrast Image c) Contrast Stretching d)

ar
Threshold function

- The Contrast stretching is used to increase the contrast of image by making the

nk
dark portions darker and bright portions brighter.

g ao
- We make dark area darker by assigning a slope less than 1 & make bright area
or
brighter by assigning a slope greater than 1.
K

3. Thresholding
∙ Extreme contrast is known as Thresholding.
li
ja
an
it
G

- In contrast stretching figure,

- We get Thresholding function,

-Thresholding has only 2 values, black or white.( Threshold image has maximum
contrast). In thresholding, we convert an image from color or grayscale into a
binary image, i.e., one that is simply black and white. Most frequently, we use
thresholding as a way to select areas of interest of an image, while ignoring the
parts we are not concerned with.
4. Grey Level Slicing (Intensity Slicing)

- When we have to highlight a specific range of grey value like enhancing the flaws
in x ray or CT image for that we have to use a transformation is known as Grey
Level Slicing.
(Without background)

This method is known as Grey level slicing without background. This is because in

ar
this process, we have completely lost the background.
(With background)

nk
In some applications, we not only need to enhance a band of grey levels but also
need to retain the background. This technique of retaining the background is called

ao
as Grey-level slicing with background.
g
or
K

(Without background) (With background)


li

5. Bit Plane Slicing


ja

- Suppose we consider 256*256*8 image pixels.


an

- Black – 00000000 0 level


- White – 11111111 255 level
it

- Remaining 254 are shades of grey


G

- In Bit Plane Slicing, we have to consider particular bit of pixel and draw an image.
- Suppose make image of only LSB, only MSB like total 8 different images. - All 8
images will be binary.

- Observing the images we come to conclusion that the higher order bits contain majority of
visually significant data, while the lower bits contain the suitable details in the image.
- Bit Plane Slicing used for an image compression, we can remove lower order bits and
transmit only higher order bits.

ar
nk
ao
g
or
K
li
ja
an
it
G
6. Dynamic Range Compression (Log Transformation)

- Dynamic range of the image exceeds the capability of the display devices. -
Some images have pixels with high value (intensity) and some images with low
value. So, we cannot see the low value pixels in the image. For example, in day
time we cannot see stars because sun has high intensity compare with stars so
that the eye cannot adjust to such a large dynamic range.

Dynamic range refers to the ratio of max and min intensity values. When the
dynamic range of the image is greater than that of displaying device(like in
Fourier transform), the lower values are suppressed. To overcome this issue, we

ar
use log transform. Log transformation first compresses the dynamic range and
then upscales the image to a dynamic range of the display device. In this way,

nk
lower values are enhanced and thus the image shows significantly more details.

Applications:1) Expands the dark pixels in the image while compressing the

ao
brighter pixels.2) Compresses the dynamic range (display of Fourier transform).

- In image processing, a classic example of such large differences in grey levels


g
is the Fourier spectrum. In that only some of the values are large while most of
the values are too small. The dynamic range of pixel is of order of 106. Hence,
or
when we plot the spectrum, we see only the small dots which represent the large
values. Sometimes we need to be able to see the small values as well. This
K

technique used to compress dynamic range of pixels is known as Dynamic


Range Compression. - For this technique we could use LOG operator.
li

Thus, a logarithmic transform is appropriate when we want to enhance the low


ja

pixel values at the expense of loss of information in the high pixel values.
an

Be careful, if most of the details are present in the high pixel values, then
applying the log transform results in the loss of information as shown below
it
G
7. Power Law Transformation
Formula

- γ Gamma function: for different value of γ we get different curve.

ar
nk
g ao
or

But the main question is why we need this transformation, what’s the benefit of
K

doing so?

To understand this, we first need to know how our eyes perceive light. The
li

human perception of brightness follows an approximate power function(as


ja

shown below) according to Stevens’ power law for brightness perception.


an
it
G

See from the above figure, if we change input from 0 to 10, the output changes
from 0 to 50 (approx.) but changing input from 240 to 255 does not really
change the output value. This means that we are more sensitive to changes in
dark as compared to bright. You may have realized it yourself as well!

But our camera does not work like this. Unlike human
perception, camera follows a linear relationship. This means that if light falling
on the camera is increased by 2 times, the output will also increase 2 folds. The
camera curve looks like this

ar
nk
g ao
or
So, where and what is the actual problem?

The actual problem arises when we display the image.You might be amazed to
K

know that all display devices like your computer screen have Intensity to voltage
response curve which is a power function with exponents(Gamma) varying from
1.8 to 2.5.
li

This means for any input signal(say from a camera), the output will be
ja

transformed by gamma (which is also known as Display Gamma) because of


non-linear intensity to voltage relationship of the display screen. This results in
an

images that are darker than intended.


it
G

To correct this, we apply gamma correction to the input signal(we know the
intensity and voltage relationship we simply take the complement) which is
known as Image Gamma. This gamma is automatically applied by the
conversion algorithms like jpeg etc. thus the image looks normal to us.

This input cancels out the effects generated by the display and we see the image
as it is. The whole procedure can be summed up as by the following figure

ar
nk
If images are not gamma-encoded, they allocate too many bits for the bright
tones that humans cannot differentiate and too few bits for the dark tones. So, by

ao
gamma encoding, we remove this artifact.

Images which are not properly corrected can look either bleached out, or too
dark.
g
or
Non-linearities encountered during image capturing, printing and displaying can
be corrected using gamma correction Hence gamma correction is important if
the image needs to be displayed on the computer The power law transformation
K

can also be used to improve the dynamic range of an image.


Application : MRI
li

Example: Obtain the digital negative of following 8 bits per pixel image
ja

121 205 217 156 151


an

139 127 157 117 125

252 117 236 138 142


it

227 182 178 197 242


G

201 106 119 251 240

8 bit image, thus, 28=256 levels


Minimum grey level = 0
Maximum grey level = 255 𝑆(𝑥,𝑦)=255−𝑟(𝑥,𝑦)
Here r(x,y) is input image so first pixel value is 255-121=134 & so on.

134 50 38 99 104
116 128 98 138 130

3 138 19 117 113

28 73 77 58 13

54 149 136 4 15

ar
Example: For a given image find: 1) Digital Negative of an image. 2) Bit Plane
Slicing.

nk
4 3 2 1

ao
3 1 2 4

5 1 6 2
g
or
2 3 5 6

Digital Negative
K

Max value of pixel is 6 so we need 3 bit for binary


representation of this pixel value.
li

23 = 8. So total Grey Levels are 0 to 7


3 4 5 6
ja

𝑆(𝑥,𝑦)=7−𝑟(𝑥,𝑦)
4 6 5 3
an

2 6 1 5
it

5 4 2 1
G

Bit Plane Slicing :

011 100 101 110

100 110 101 011

010 110 001 101


101 100 010 001

ar
nk
Example : For following image find Contrast Stretching

ao
r2 = 5 , r1 = 3 , s2 = 6 , s1 = 2
g
or
K
li
ja

Image to be 3 bit: 23 = 8. Grey Levels: 0 to 7


an
it
G
ar
nk
4 2 1.32 0.66
g ao
4 2 1 1
or

2 1 1 4
2 0.66 1.32 4
K

6 1 7 1
6 0.66 6.5 1.32

1 2 6 7
li

1.32 2 6 6.5
ja

Example: For 3 bit 4x4 image, perform the following operation:


1. Thresholding with T=4
an

2. Intensity level slicing with and without back ground r1 = 2 and r2 = 5


it

1 2 3 0
G

2 4 6 7

5 2 4 3

3 2 6 1

Image to be 3 bit: 23= 8. Grey Levels: 0 to 7

1. Thresholding with T=4


2. Intensity level slicing with and without back ground
r1 =2 and r2 = 5

ar
nk
g ao
or
K
li

Histogram :
ja
an

Histogram of images provide a global description of the appearance of an


image. The information obtained from histograms is enormous.
it

By definition, histogram of an image represents the relative frequency of


occurrence of the various grey levels in an image. It is plot of number of
G

occurrences of grey levels in image against with grey level values. It provides
more information about brightness & contrast of image.
Histogram of dark image will be clustered towards lower grey levels.
Histogram of bright image will be clustered towards higher grey levels.
For low contrast image the histogram will not be spread equally, that is, the
histogram will be narrow.
For high contrast image the histogram will have an equal spread in the grey
level. Image brightness may be improved by modifying the histogram of the
image.
Histogram of an image can be plotted in two ways. In the first method, the x-
axis has the grey levels and the y-axis has the number of pixels in each grey
level, while in the second method, the x-axis represents the grey levels, while
the y-axis represents the probability of the occurrence of that grey level.
Method 1:
Grey level No of pixels

0 40

ar
1 20

2 10

nk
3 15

4 10

ao
5 3

6 2
g
or
K
li
ja

Method 2:
an

Instead of plotting no of pixels, we directly plot its probability values.


Pr(k) = nk/n
it

Grey level No of pixels Pr(k)


G

0 40 0.40

1 20 0.20

2 10 0.10

3 15 0.15

4 10 0.10

5 3 0.03

6 2 0.02
n = 100

ar
This is known as a normalised histogram. The advantage of the second method

nk
is that the maximum value to be plotted will always be 1. Generally black is
considered as grey level 0 and white as the maximum. Just by looking at the
histogram of the image, a great deal of information can be obtained. Some of the

ao
typical histograms are shown in Fig.
g
or
K
li
ja
an
it
G
ar
nk
g ao
or
K
li
ja
an

In fig a all the pixels belong to the lower grey levels 0,1,.... and hence we can be
it

sure that the image, represented by this histogram, is a dark image. Similarly.
Fig b is the histogram of a bright image. Fig.c is a low contrast image since only
G

a small range of grey levels are present. Fig.d is a high contrast image. Of all the
4 histograms shown, the last histogram represents the best image.

Histogram stretching :
- One way to increase dynamic range of histogram this technique is known as
histogram stretching.
- In this histogram is spread over entire dynamic range.
Where smax= Maximum grey level of output image
smin = Minimum grey level of output image
rmax = Maximum grey level of input image
rmin=Minimum grey level of input image

Example: Perform histogram stretching on the following image. So that new image has dynamic
range [0,7].

ar
nk
Solution:

Here,
rmin = 2
g ao
or
rmax = 6
smax = 0
K

smin = 7
li
ja
an
it

Modified Histogram:
G
ar
nk
Histogram Equalization :

ao
There are many applications, wherein we need a Hat histogram. This cannot be
achieved by histogram stretching. We now introduce a new technique known as
histogram equalization. A perfect image is one which has equal number of
g
pixels in all its grey levels. Hence our objective is not only to spread the
dynamic range, but also to have equal pixels in all the grey levels. This
or

technique is known as histogram equalization. We now search for a


transformation that would transform a bad histogram to a flat histogram.
K
li
ja
an
it
G

Example: Perform histogram equalization on the following image histogram. Plot the
original and equalized histogram.
Gray 0 1 2 3 4 5 6 7
Levels
No.of 790 1023 850 656 329 245 122 81
Pixels

Solution:

Grey nk Pr(k) = Sk=∑ (L-1) Roundin Grey


nk/n g Off
level.(r Pr(k) Sk level.(s)
)

ar
0 790 0.19 0.19 1.33 1 1

1 1023 0.25 0.44 3.08 3 3

nk
2 850 0.21 0.65 4.55 5 5

ao
3 656 0.16 0.81 5.67 6 6

4 329 0.08 0.89 6.23 6 6


g
or
5 245 0.06 0.95 6.65 7 7

6 122 0.03 0.98 6.86 7 7


K

7 81 0.02 1 7 7 7
li

n=
ja

4096
an

gray 0 1 2 3 4 5 6 7
level(s)
it

No.of 0 790 0 1023 0 850 656+329 245+122+81=4


G

=985 48
Pixels
ar
nk
Example: consider given image and find out equalized histogram

ao
F(x,y)=
g
4 4 4 4 4
or

3 4 5 4 3
K

3 5 5 5 3
li

3 4 5 4 3
ja

4 4 4 4 4
an
it

Solution:
G

Gray Levels 0 1 2 3 4 5 6 7

No.of Pixels 0 0 0 6 14 5 0 0

Grey nk Pr(k) = nk/n Sk=∑ (L-1) Rounding Grey


Off
level.(r) Pr(k) Sk level.(s)
0 0 0 0 0 0 0

1 0 0 0 0 0 0

2 0 0 0 0 0 0

3 6 0.24 0.24 1.68 2 2

4 14 0.56 0.8 5.6 6 6

ar
5 5 0.20 1 7 7 7

nk
6 0 0 1 7 7 7

7 0 0 1 7 7 7

n =25 g ao
or
Gray 0 1 2 3 4 5 6 7
Levels
K

No.of 0 0 6 0 0 0 14 5+0+0=5
Pixels
li
ja
an
it
G

Question: Justify-the entropy of an image is maximum by histogram equalization.


Solution: histogram equalization gives flat histogram in continuous domain
- As a result of this the probability of occurrence of each grey level in the image is equal.
- If all grey levels are equal probable, the entropy is maximized.
- Consider 256 grey level image with equal probability of occurrence for each grey level
- the maximum word length is given by

-So we require 8 bits /pixels.


- This simply Means that an equal length code can be used an image that has uniform pdf.

ar
nk
g ao
or
K
li
ja
an

Histogram specification:
From the earlier method (Histogram equalization) we note that histogram
equalization is automatic. It is not interactive, i.e., it always gives one result - an
it

approximation to an uniform histogram. It is at times desirable to have an


G

interactive method in which certain grey level are highlighted. It should be noted
that if we modify the grey level of an image that has a uniform PDF, p,(s), using
the inverse transformation r = T'(s), we get back the original histogram p,(r).
Exploiting this knowledge, we can obtain any shape of the grey % level
histogram by processing the given image in the following way. Suppose pr(r)
and p,(s) represent grey level PDFs of input and output images and r and s are
their respective grey levels. Suppose k represents grey level of some
intermediate image result i.e.,
The procedure of histogram specification can be computed as follows:
(1) Equalize the levels of the original image.
(2) Specify the desired density function and obtain the transformation function.
(3) Apply the inverse transformation function.

Example: Given histogram (a) and (b) modify histogram (a) as given (b).
Histogram (a):

ar
Gray 0 1 2 3 4 5 6 7
Levels

nk
No.of 790 1023 850 656 329 245 122 81

ao
Pixels

Histogram (b):
Gray
g 0 1 2 3 4 5 6 7
Levels
or

No.of 0 0 0 614 819 1230 819 614


K

Pixels

Solution: first equalized histogram (a)


li

Grey nk Pr(k) = nk/n Sk=∑ Pr(k) (L-1) Sk Rounding Grey


ja

Off
level.(r) level.(s)
an

0 790 0.19 0.19 1.33 1 1

1 1023 0.25 0.44 3.08 3 3


it
G

2 850 0.21 0.65 4.55 5 5

3 656 0.16 0.81 5.67 6 6

4 329 0.08 0.89 6.23 6 6

5 245 0.06 0.95 6.65 7 7

6 122 0.03 0.98 6.86 7 7


7 81 0.02 1 7 7 7

n=
4096

gray 0 1 2 3 4 5 6 7
level(s)

ar
No.of 0 0 1023 0 850 656+329 245+122+
790 =985 81=448
Pixels

nk
Now equalized histogram (b):
Grey nk Pr(k) = Sk=∑ Pr(k) (L-1) Sk Rounding

ao
level.(r) g nk/n Off

0 0 0 0 0 0
or
1 0 0 0 0 0
K

2 0 0 0 0 0

3 614 0.149 0.149 1.05 1


li

4 819 0.20 0.35 2.45 2


ja

5 1230 0.30 0.65 4.45 5


an

6 819 0.20 0.85 5.97 6


it

7 614 0.15 1 7 7
G

n = 4096

Applying inverse transform and comparing histogram (a) and histogram (b).

gray 01 2 3 4 5 6 7
level(s)

No.of 0 0 0 790 0 850 985 448


Pixels

Example: For given image, perform the following


operation:

ar
1. Contrast starching as per the characteristics given in
fig

nk
2. Draw original and new histogram
1. Equalize the histogram
10 2 13 7

11

4
14

7
g 6

3
ao9

2
or

0 5 10 7
K
li
ja
an
it
G
ar
nk
12 0.8 13.8 6 12 1 14 6

ao
12.6 14.4 4 10 13 14 4 10
S(x,y) =
1.6 6 1.2 0.8 2 6 1 1
g
or
0 2 12 6 0 2 12 6

2)
K
li
ja
an
it
G

3)
Grey nk Pr(k) = Sk=∑ Pr(k) (L-1) Sk Rounding Grey
Off
level.(r) nk/n level.(s)

0 1 0.067 0.067 1.005 1 1


1 0 0 0.067 1.005 1 1

2 1 0.067 0.134 2.01 2 2

3 1 0.067 0.201 3.015 3 3

4 1 0.067 0.268 4.02 4 4

5 1 0.067 0.335 5.025 5 5

ar
6 1 0.067 0.402 6.03 6 6

nk
7 3 0.2 0.602 9.03 9 9

8 0 0 0.602 9.03 9 9

10
1

2
0.067

0.13
0.669

0.799
g10.035

11.985
ao
10

12
10

12
or

11 1 0.067 0.866 12.99 13 13


K

12 0 0 0.866 12.99 13 13

13 1 0.067 0.933 14 14 14
li
ja

14 1 0.067 1 15 15 15

15 0 0 1 15 15 15
an

n =15
it
G

grey 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
levels

No of 0 1 1 1 1 1 1 0 0 3 1 0 2 1 1 1
pixels
Question: Continuous image histogram can be perfectly equalized but it may not
be so for digital image.

ar
Solution: This statement is true.
- The cumulative density function ensures that we get a flat histogram is the

nk
continuous domain.
- The discrete domain, as we are aware is an approximation of the continuous
domain i.e. values between integers values are not known because of which

ao
redistribution takes place.
- For example values such as 1.1, 1.2, and 1.3, are all grouped together and
placed in value 1. Due to this perfectly flat histograms are never obtained in the
g
discrete domain.
Question: Difference between Histogram and Contrast Stretching.
or

Solution: Histogram Contrast Stretching


1. It is about modifying the intensity 1. It is all about increasing the difference
K

values of all pixels in the image as between the minimum and maximum
equally. intensity value in image.
li

2. The transformation function used in 2. Transformation function is selected


Histogram is selected automatically manually based on the requirement of
ja

from PDF of the image. application.


an

3. It is reliable. 3. It is unreliable.
4. It is non-linear normalization. 4. It is linear normalization.
5. In histogram equalization, the original 5. In contrast stretching, the original
it

image cannot be restored from equalized image can be restored from contrast
image. stretched image
G

6. Histogram equalization is obtained 6. Contrast stretching can be obtaining


using the cumulative distribution by changing the slopes of various
function. sections

You might also like