0% found this document useful (0 votes)
33 views25 pages

IA Unit 01

The document discusses image analytics and digital image processing. It defines key concepts like images, pixels, and digital images. It also explains different types of images and operations involved in image processing like acquisition, enhancement, representation, analysis, and more.

Uploaded by

21csme011anay
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)
33 views25 pages

IA Unit 01

The document discusses image analytics and digital image processing. It defines key concepts like images, pixels, and digital images. It also explains different types of images and operations involved in image processing like acquisition, enhancement, representation, analysis, and more.

Uploaded by

21csme011anay
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/ 25

UNIT-01

IMAGE ANALYTICS (KDS-061)

Introduction of Image analytics

Image analysis or imagery analysis is the extraction of meaningful information from


images; mainly from digital images by means of digital image processing techniques.
Image analysis tasks can be as simple as reading bar coded tags or as sophisticated as
identifying a person from their face.

Image analytics can bring out that information for you, letting you see who, where and
how people are using your products. It also lets you, deep-dive, into the sentiment of
people when they are using your products.

Image

An image is defined as a two-dimensional function F(x,y), where x and y are spatial


coordinates, and the amplitude of F at any pair of coordinates (x,y) is called
the intensity of that image at that point. When x,y, and amplitude values of F are
finite, we call it a digital image. In other words, an image can be defined by a two-
dimensional array specifically arranged in rows and columns. Digital Image is
composed of a finite number of elements, each of which elements have a particular
value at a particular location.These elements are referred to as picture elements,image
elements,and pixels.A Pixel is most widely used to denote the elements of a Digital
Image.

Digital Image

A digital image is a representation of a two dimensional image as a finite set of digital


values, called picture elements or pixels.

Digital Image Processing

Digital image processing focuses on two major tasks: Improvement of pictorial


information for human interpretation and Processing of image data for storage,
transmission and representation for autonomous machine perception. Digital Image
Processing means processing digital image by means of a digital computer. We can
also say that it is a use of computer algorithms, in order to get enhanced image either
to extract some useful information. Digital image processing is the use of algorithms
and mathematical models to process and analyze digital images. The goal of digital
image processing is to enhance the quality of images, extract meaningful information
from images, and automate image-based tasks.
The fundamental steps in image processing systems

1. Image acquisition: This involves capturing an image using a digital camera or


scanner, or importing an existing image into a computer.
2. Image enhancement: This involves improving the visual quality of an image, such
as increasing contrast, reducing noise, and removing artifacts.
3. Image restoration: This involves removing degradation from an image, such as
blurring, noise, and distortion.
4. Image segmentation: This involves dividing an image into regions or segments,
each of which corresponds to a specific object or feature in the image.
5. Image representation and description: This involves representing an image in a way
that can be analyzed and manipulated by a computer, and describing the features of
an image in a compact and meaningful way.
6. Image analysis: This involves using algorithms and mathematical models to extract
information from an image, such as recognizing objects, detecting patterns, and
quantifying features.
7. Image synthesis and compression: This involves generating new images or
compressing existing images to reduce storage and transmission requirements.
8. Digital image processing is widely used in a variety of applications, including
medical imaging, remote sensing, computer vision, and multimedia.

Image processing mainly include the following steps:


1. Importing the image via image acquisition tools;
2.Analysing and manipulating the image;
3.Output in which result can be altered image or a report which is based on analysing
that image.
Types of an image
1. BINARY IMAGE– The binary image as its name suggests, contain only two pixel
elements i.e 0 & 1, where 0 refers to black and 1 refers to white. This image is also
known as Monochrome.
2. BLACK AND WHITE IMAGE– The image which consists of only black and
white color is called BLACK AND WHITE IMAGE.
3. 8 bit COLOR FORMAT– It is the most famous image format.It has 256 different
shades of colors in it and commonly known as Grayscale Image. In this format, 0
stands for Black, and 255 stands for white, and 127 stands for gray.
4. 16 bit COLOR FORMAT– It is a color image format. It has 65,536 different
color in it. It is also known as High Color Format. In this format the distribution of
color is not as same as Grayscale image.

A 16 bit format is actually divided into three further formats which are Red, Green and
Blue. That is famous RGB format.

Image as a Matrix
As we know, images are represented in rows and columns we have the following
syntax in which images are represented:
The right side of this equation is digital image by definition. Every element of this
matrix is called image element, picture element, or pixel.

DIGITAL IMAGE REPRESENTATION IN MATLAB:

In MATLAB the start index is from 1 instead of 0. Therefore, f(1,1) = f(0,0).


Henceforth the two representation of image are identical, except for the shift in origin.
In MATLAB, matrices are stored in a variable i.e X,x,input_image , and so on. The
variables must be a letter as same as other programming languages.

PHASES OF IMAGE PROCESSING:

1. ACQUISITION– It could be as simple as being given an image which is in digital


form. The main work involves:
a) Scaling
b) Color conversion(RGB to Gray or vice-versa)
2.IMAGE ENHANCEMENT– It is amongst the simplest and most appealing in areas
of Image Processing it is also used to extract some hidden details from an image and is
subjective.
3. IMAGE RESTORATION– It also deals with appealing of an image but it is
objective (Restoration is based on mathematical or probabilistic model or image
degradation).
4. COLOR IMAGE PROCESSING– It deals with pseudo color and full color image
processing color models are applicable to digital image processing.
5. WAVELETS AND MULTI-RESOLUTION PROCESSING– It is foundation of
representing images in various degrees.
6. IMAGE COMPRESSION-It involves in developing some functions to perform
this operation. It mainly deals with image size or resolution.
7. MORPHOLOGICAL PROCESSING-It deals with tools for extracting image
components that are useful in the representation & description of shape.
8. SEGMENTATION PROCEDURE-It includes partitioning an image into its
constituent parts or objects. Autonomous segmentation is the most difficult task in
Image Processing.
9. REPRESENTATION & DESCRIPTION-It follows output of segmentation stage,
choosing a representation is only the part of solution for transforming raw data into
processed data.
10. OBJECT DETECTION AND RECOGNITION-It is a process that assigns a
label to an object based on its descriptor.

Sampling and Quantization


It creates a digital image; we need to convert the continuous sensed data into digital
form. This process includes 2 processes:
1. Sampling: Digitizing the co-ordinate value is called sampling.
2. Quantization: Digitizing the amplitude value is called quantization.
To convert a continuous image f(x, y) into digital form, we have to sample the function
in both co-ordinates and amplitude.

Mathematical Tool for Image Processing

Array versus Matrix Operation: 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. But in Matrix, the
operation is carried out simply multiplication.

Linear versus Non-Linear Operation Linear operation is Addition, Subtraction,


Multiplication, Division on the Image. Non-Linear operation is Max, Min, Median,

Mode, Mean of the Image for Image Enhancement.

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.

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.

LOGICAL OPERATION:

Logical operations are AND, OR, NOT, XOR.

Basic Intensity Transformation Functions

In the realm of image processing, basic intensity transformations play a crucial role in
tailoring images to meet specific needs and applications. They are particularly useful
when images have a limited intensity range, and they help to stretch or compress this
range to bring out finer details.

Linear (negative and identity transformations)


Linear intensity transformations, including negative and identity transformations, are

basic operations used in image processing to alter the pixel intensities of an image. These

transformations can be represented mathematically as follows:

Negative Transformation

The negative transformation is achieved by taking the complement of the original pixel

intensity values. If the original pixel intensity is denoted by “r,” the corresponding

negative intensity, denoted by “s,” can be calculated as:


s=L-1–r

Here, “L” represents the maximum intensity level in the image, often 255 in the case of
8-bit images. This equation subtracts the original intensity from the maximum possible
intensity, effectively inverting the pixel values. For example, if the original intensity is
100 in an 8-bit image (L = 255), the negative intensity will be (255–1–100) = 154.

Identity Transformation

The identity transformation is the simplest of all intensity transformations. It doesn’t

change the pixel intensities of the image. If “r” represents the original pixel intensity and

“s” is the transformed intensity, the identity transformation equation is:

s=r

Logarithmic (log and inverse-log transformations)

Logarithmic transformations in image processing are a group of nonlinear intensity

adjustments aimed at enhancing the visibility of details in images. They are particularly

useful for images with a wide range of pixel values, such as those captured in low-light or

high-contrast conditions. These transformations are composed of two common functions:

the log transformation (logarithm function) and the inverse-log transformation


(exponential function).
Log Transformation (Logarithm Function)

The log transformation involves applying the logarithm function to each pixel value in an

image. This operation spreads out the darker pixel values, making fine details in

shadowed regions more visible. The transformation equation is given by:

S=c.log(1+R)

 S represents the transformed pixel value.

 R is the original pixel value.

 c is a constant that adjusts the degree of enhancement.

 The logarithm function compresses high-intensity values and stretches low-intensity

values.

Inverse-Log Transformation (Exponential Function)

The inverse-log transformation is the reverse operation, aimed at expanding the range of

brighter pixels. This is especially useful for images with overexposed regions. The

transformation equation is:

S= e(R/c)-1

 S represents the transformed pixel value.

 R is the original pixel value.

 c is a constant that controls the degree of enhancement.


 The exponential function stretches high-intensity values.

Power-law transformations

Power-law transformations, also known as gamma correction, are a class of mathematical

transformations used to adjust the tonal and brightness characteristics of an image. These

transformations are particularly useful in image processing and computer vision to

enhance the visual quality of images or correct for issues related to illumination and

contrast.

The basic idea behind power-law transformations is to raise the pixel values of an image
to a certain power (exponent) in order to adjust the image’s overall brightness and

contrast. The general form of a power-law transformation is:

O= k.IƳ

Where:

 O is the output pixel value (transformed value).

 I the input pixel value (original value).

 γ is the exponent, which controls the degree of transformation.

 k is a constant that scales the result to fit within the desired intensity range.

Key points about power-law transformations:

Gamma Correction: When γ>1, it is known as gamma correction, and it brightens the

image. When γ<1, it darkens the image. Adjusting Contrast: Higher values of γ (greater
than 1) increase contrast by making dark areas darker and bright areas brighter, while

lower values (between 0 and 1) decrease contrast. No Change: When γ=1, the

transformation has no effect on the image; the output is the same as the input.

Nonlinear Transformation: Power-law transformations are nonlinear transformations

and are especially useful for images with non-uniform illumination.

Applications: Power-law transformations are used in various applications, including

image enhancement, gamma correction for display devices, and improving the visibility

of details in medical imaging.


Histograms Introduction

In digital image processing, the histogram is used for graphical representation of a


digital image. A graph is a plot by the number of pixels for each tonal value. Nowadays,
image histogram is present in digital cameras. Photographers use them to see the
distribution of tones captured.

In a graph, the horizontal axis of the graph is used to represent tonal variations whereas
the vertical axis is used to represent the number of pixels in that particular pixel. Black
and dark areas are represented in the left side of the horizontal axis, medium grey color
is represented in the middle, and the vertical axis represents the size of the area.

Applications of Histograms

1. In digital image processing, histograms are used for simple calculations in


software.
2. It is used to analyze an image. Properties of an image can be predicted by the
detailed study of the histogram.
3. The brightness of the image can be adjusted by having the details of its
histogram.
4. The contrast of the image can be adjusted according to the need by having details
of the x-axis of a histogram.
5. It is used for image equalization. Gray level intensities are expanded along the x-
axis to produce a high contrast image.
6. Histograms are used in thresholding as it improves the appearance of the image.
7. If we have input and output histogram of an image, we can determine which type
of transformation is applied in the algorithm.

Histogram Processing Techniques

Histogram Sliding

In Histogram sliding, the complete histogram is shifted towards rightwards or leftwards.


When a histogram is shifted towards the right or left, clear changes are seen in the
brightness of the image. The brightness of the image is defined by the intensity of light
which is emitted by a particular light source.

Histogram Stretching: In histogram stretching, contrast of an image is increased. The


contrast of an image is defined between the maximum and minimum value of pixel
intensity. If we want to increase the contrast of an image, histogram of that image will be
fully stretched and covered the dynamic range of the histogram. From histogram of an
image, we can check that the image has low or high contrast.

Histogram Equalization: Histogram equalization is used for equalizing all the pixel
values of an image. Transformation is done in such a way that uniform flattened
histogram is produced.

Histogram equalization increases the dynamic range of pixel values and makes an equal
count of pixels at each level which produces a flat histogram with high contrast image.

While stretching histogram, the shape of histogram remains the same whereas in
Histogram equalization, the shape of histogram changes and it generates only one image.

Spatial Filtering and its Types


Spatial Filtering technique is used directly on pixels of an image. Mask is usually
considered to be added in size so that it has specific center pixel. This mask is moved
on the image such that the center of the mask traverses all image pixels. Classification
on the basis of linearity: There are two types:
1. Linear Spatial Filter
2. Non-linear Spatial Filter
General Classification:
Smoothing Spatial Filter: Smoothing filter is used for blurring and noise reduction in
the image. Blurring is pre-processing steps for removal of small details and Noise
Reduction is accomplished by blurring. Types of Smoothing Spatial Filter:
1. Linear Filter (Mean Filter)
2. Order Statistics (Non-linear) filter
These are explained as following below.

1. Mean Filter: Linear spatial filter is simply the average of the pixels contained in
the neighborhood of the filter mask. The idea is replacing the value of every pixel
in an image by the average of the grey levels in the neighbourhood define by the
filter mask. Types of Mean filter:
 (i) Averaging filter: It is used in reduction of the detail in image. All
coefficients are equal.
 (ii) Weighted averaging filter: In this, pixels are multiplied by different
coefficients. Center pixel is multiplied by a higher value than average filter.

2. Order Statistics Filter: It is based on the ordering the pixels contained in the
image area encompassed by the filter. It replaces the value of the center pixel with
the value determined by the ranking result. Edges are better preserved in this
filtering. Types of Order statistics filter:
 (i) Minimum filter: 0th percentile filter is the minimum filter. The value of the
center is replaced by the smallest value in the window.
 (ii) Maximum filter: 100th percentile filter is the maximum filter. The value of
the center is replaced by the largest value in the window.
 (iii) Median filter: Each pixel in the image is considered. First neighboring
pixels are sorted and original values of the pixel is replaced by the median of
the list.
Sharpening Spatial Filter: It is also known as derivative filter. The purpose of the
sharpening spatial filter is just the opposite of the smoothing spatial filter. Its main
focus in on the removal of blurring and highlight the edges. It is based on the first and
second order derivative. First order derivative:
 Must be zero in flat segments.
 Must be non zero at the onset of a grey level step.
 Must be non zero along ramps.
First order derivative in 1-D is given by:
f' = f(x+1) - f(x)
Second order derivative:
 Must be zero in flat areas.
 Must be zero at the onset and end of a ramp.
 Must be zero along ramps.
Second order derivative in 1-D is given by:
f'' = f(x+1) + f(x-1) - 2f(x)

Color Image Processing

The use of color is important in image processing because:

 Color is a powerful descriptor that simplifies object identificationand


extraction.
 Humans can discern thousands of color shades and intensities, compared
to about only two dozen shades of gray.
Color image processing is divided into two major areas:
 Full-color processing: images are acquired with a full-color sensor,such as a
color TV camera or color scanner.
 Pseudocolor processing: The problem is one of assigning a color toa
particular monochrome intensity or range of intensities.

Color Fundamentals

Colors are seen as variable combinations of the primary color s of light: red (R),
green (G), and blue (B). The primary colors can be mixed to produce the secondary
colors: magenta (red+blue), cyan (green+blue), and yellow (red+green). Mixing the
three primaries, or a secondary withits opposite primary color, produces white light.

Figure 15.1 Primary and secondary colors of light

RGB colors are used for color TV, monitors, and video cameras.

However, the primary colors of pigments are cyan (C), magenta (M), and yellow (Y),
and the secondary colors are red, green, and blue. A proper combination of the three
pigment primaries, or a secondary with its opposite primary, produces black.

Figure 15.2 Primary and secondary colors of pigments

CMY colors are used for color printing.

Color characteristics

The characteristics used to distinguish one color from another are:


 Brightness: means the amount of intensity (i.e. color level).
 Hue: represents dominant color as perceived by an observer.
 Saturation: refers to the amount of white light mixed with a hue.

Color Models

The purpose of a color model is to facilitate the specification of colors in some


standard way. A color model is a specification of a coordinate system and a subspace
within that system where each color is represented by a single point. Color models
most commonly used in image processingare:

 RGB model for color monitors and video cameras


 CMY and CMYK (cyan, magenta, yellow, black) models for colorprinting
 HSI (hue, saturation, intensity) model

The RGB color model

In this model, each color appears in its primary colors red, green, and blue. This
model is based on a Cartesian coordinate system. The color subspace is the cube
shown in the figure below. The different colors in this model are points on or inside
the cube, and are defined by vectors extending from the origin.

Figure 15.3 RGB color model


All color values R, G, and B have been normalized in the range [0, 1]. However, we can
represent each of R, G, and B from 0 to 255.
Each RGB color image consists of three component images, one for each primary color
as shown in the figure below. These three images are combined on the screen to
produce a color image.

Figure 15.4 Scheme of RGB color image

The total number of bits used to represent each pixel in RGB image is called pixel
depth. For example, in an RGB image if each of the red, green, and blue images
is an 8-bit image, the pixel depth of the RGB image is 24-bits. The figure below
shows the component images of anRGB image.

Full color
Red Green
Blue Figure 15.5 A full-color
image and its RGB component images

The CMY and CMYK color model

Cyan, magenta, and yellow are the primary colors of pigments. Most printing devices
such as color printers and copiers require CMY data input or perform an RGB to
CMY conversion internally. This conversionis performed using the equation
𝐶 1 𝑅
𝑀= 1 − 𝐺
𝑌 1 𝐵
where, all color values have been normalized to the range [0, 1].
In printing, combining equal amounts of cyan, magenta, and yellow produce
muddy-looking black. In order to produce true black, a fourth color, black, is
added, giving rise to the CMYK color model.

The figure below shows the CMYK component images of an RGB image.

Full color Cyan Magenta

Yellow Black

Figure 15.6 A full-color image and its CMYK component


images
The HSI color model

The RGB and CMY color models are not suited for describing colors in terms of
human interpretation. When we view a color object, we describe it by its hue,
saturation, and brightness (intensity). Hence the HSI color model has been presented.
The HSI model decouples the intensity component from the color-carrying
information (hue and saturation) in a color image. As a result, this model is an ideal
tool for developing color image processing algorithms.
The hue, saturation, and intensity values can be obtained from the RGB color cube.
That is, we can convert any RGB point to a corresponding point is the HSI color
model by working out the geometrical formulas.

Converting colors from RGB to HSI

The hue H is given by


𝜃 if 𝐵 ≤ 𝐺
𝐻={
}
360 − 𝜃 if 𝐵 > 𝐺
Where
1
[(𝑅 − 𝐺) + (𝑅 − 𝐵)]
−1 2
𝜃 = 𝑐o𝑠 { }
√(𝑅 − 𝐺) + (𝑅 − 𝐵)(𝐺 − 𝐵)
2

The saturation S is given by


3
𝑆=1− [min (𝑅, 𝐺, 𝐵)]
(𝑅 + 𝐺 + 𝐵)
The intensity I is given by
I=1/3(R+G+B)
All RGB values are normalized to the range [0,1].
Converting colors from HSI to RGB

The applicable equations depend on the value of H:


If 0° ≤ 𝐻 < 120° :

𝐵 = (1 − 𝑆)
𝑆 cos 𝐻
𝑅 = 𝐼 [1 + ]
cos (60°− 𝐻)
𝐺 = 3𝐼 − (𝑅 + 𝐵)

If 120° ≤ 𝐻 < 240° :


𝐻 = 𝐻 − 120°
𝑅 = (1 − 𝑆)
𝑆 cos 𝐻
𝐺 = 𝐼 [1 + ]
cos (60°−𝐻)
𝐵 = 3𝐼 − (𝑅 + 𝐺)

If 240° ≤ 𝐻 ≤ 360° :
𝐻 = 𝐻 − 240°
𝐺 = (1 − 𝑆)
𝑆 cos 𝐻
𝐵 = 𝐼 [1 + ]
cos (60°−𝐻)
𝑅 = 3𝐼 − (𝐺 + 𝐵)

The next figure shows the HSI component images of an RGB image.
Full color

Hue Saturation

IntensityFigure 15.7 A full-color

image and its HSI component images

Basics of Full-Color Image Processing

Full-color image processing approaches fall into two major categories:

 Approaches that process each component image individually and then form a
composite processed color image from the individuallyprocessed components.
 Approaches that work with color pixels directly.
In full-color images, color pixels really are vectors. For example, in the RGB
system, each color pixel can be expressed as
𝑐𝑅(𝑥, 𝑦) 𝑅(𝑥, 𝑦)
𝑐(𝑥, 𝑦) = [𝑐𝐺(𝑥, 𝑦)] = [𝐺(𝑥, 𝑦)]
𝑐𝐵(𝑥, 𝑦) 𝐵(𝑥, 𝑦)
For an image of size M×N, there are MN such vectors, c(x, y), for x = 0,1,2,...,M-1; y
= 0,1,2,...,N-1.
Color Transformation

As with the gray-level transformation, we model color transformationsusing the


expression
(𝑥, 𝑦) = 𝑇[ƒ(𝑥, 𝑦)]
where f(x, y) is a color input image, g(x, y) is the transformed color outputimage, and T is
the color transform.
This color transform can also be written
𝑠i = 𝑇i(𝑟1, 𝑟2, … , 𝑟𝑛) i = 1,2, … , 𝑛
For example, we wish to modify the intensity of the image shown in Figure 14.8(a)
using
(𝑥, 𝑦) = 0.7ƒ(𝑥, 𝑦)

 In the RGB color space, three components must be transformed:


𝑠i = 0.7𝑟i i = 1,2,3

 In CMY space, also three component images must be transformed


𝑠i = 0.7𝑟i + 0.3 i = 1,2,3

 In HSI space, only intensity component 𝑟3is transformed


𝑠3 = 0.7𝑟3

(a) (b)
Figure 15.8 (a) Original image. (b) Result of decreasing its intensity
Some Basic Relationships between Pixels

4.1 Neighbors of a Pixel


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 is called the 4-neighbors of p, is denoted by . Each pixel is a
unit distance from (x,y), and some of the neighbor locations of p lie outside the
digital image if (x,y) is on the border of the image.
The four diagonal neighbor of p have coordinates:
(x+1,y+1),(x+1,y-1), (x-1,y+1), (x-1,y-1)

And are denoted by . These points together with the 4-neighbors, are
called the 8-neighbors of p, denoted by . As before , some of the neighbor
locations in and fall outside the image if (x,y) is on the border of
the image.

x-1,y- X-
X-1,y
1 1,y+1
X,y-1 X,y X,y+1
X+1,y- X+1,y-
X+1,y
1 1

Fig. (4.1): Sub-image of size 3x3of 8-neighbor

4-2 Adjacency, Connectivity, Regions, and Boundaries


Let V be the set of intensity values used to define adjacency. In binary
image V={1} if we referring to adjacency of pixels with value 1. In a
gray-scale image, the idea is the same, but set V typically contain more
elements. For example, in the adjacency of pixels with range of possible
intensity values 0 to 255, set V could be any subset of these 256 values. we
consider three types of adjacency:
1. 4-adjacency,two pixels p and q with values from are 4-adjacency if q is in
the set .
2. 8-adjacency, two pixels p and q with values from are 8-adjacency if q is in
the set .

1
3. m-adjacency (mixed adjacency), two pixels p and q with values from are
m-adjacency if q :
 q is in , or
 q is in and the set has no pixels whose values are from V

mixed adjacency is a modification of 8-adjacency.

Example:
Consider the pixel arrangement shown in fig.(a) for V={1}. The three pixels at
the top fig.(b) show multiple 8-adjacency as indicated by the lines. This
ambiguity is removed by using m-adjacency, as shown in fig.(c).

Fig.(a) Fig.(b) Fig.(c)


8-adjacency m-adjacency

A (digital) path (or curve) from pixel p with coordinates (x,y) to pixel q with
coordinates (s,t) is a sequence of distinct pixels with coordinates:

Where
=(s,t),
and pixels and are adjacent for .
In this case, n is the length of the path. If , the path is a
closed path. We define 4-, 8-, or m-paths depending on the type of adjacency
specified. For example, the path shown in fig.(b) between the top right and
bottom rights are 8-paths, and the path in fig.(c) is an m-path.

Let S represent a subset of pixels in an image. Two pixels p and q are said
to be connected in S if there exists a path between them consisting entirely
of pixels in S. For any pixel p in S, the set of pixels that are connected to it in
S is called a connected component of S. If it only has one connected
component, then set S is called a connected set.

Let R be a subset of pixels in an image. We call R a region of the image if R


is a connected set. Two regions, and are said to be adjacent if their
2
union forms a connected set. Regions that are not adjacent are said to be
disjoint.

Example:
The two regions are adjacent only if 8-adjacent is used. A 4-path between
the two regions does not exist, so there union is not a connected set.

Suppose that an image contains K disjoint regions, none of


which touches the image border. Let denote the union of all the K regions,
and let ( )c denote its complement. We call all the points in the foreground
And all the points in ( )c the background of the image.

The boundary (also called the border or counter) of a region R is the set of
points that are adjacent to points in the complement of R. said another way,
the border of a region is the set of pixels in the region that have at least one
background neighbor.

Example:
The point circled in figure below is not a member of the border of the 1-
valued region if 4-connectivity is used between the region and its background.
As a rule, adjacency between points in a regions and its background is defined
in terms of 8-connectivity to handle situation like this.

0 0 0 0 0
0 1 1 0 0
0 1 1 0 0
0 1 1 1 0
0 1 1 1 0
0 0 0 0 0

3
4-3 Distance Measures
For pixels p, q, and z, with coordinates (x,y),(s,t),and(v,w), respectively, D is a
distance function or metric if:
1. D(p,q) 0, D(p,q)=0 if p=q
2. D(p,q)= D(q,p) ,and
3. D(p,z) D(p,q)+ D(q,z).
1) The Euclidean distance between p and q is define as

For this distance measure, the pixels having a distance less than or equal to
some value r from (x,y) are the points contained in the disk of radius r
centered at (x,y).
2) The distance (called the city-block distance)between p and q is
defined as:
| | | |
In this case, the pixels having a distance from (x,y) less than or equal to
some value r from a diamond centered at (x,y).
Example
The pixels with distance from (x,y) ( the center point) from
the following contours of constant distance:

2
2 1 2
2 1 0 2 1
2 1 2
2
The pixels with =1 are the 4-nieghbors of (x,y).
3) The distance (called the chessboard distance)between p and q is
defined as:
| || |
In this case, the pixels having a distance from (x,y) less than or equal to
some value r from a square centered at (x,y).

Example
The pixels with distance from (x,y) ( the center point) from
the following contours of constant distance:

4
2 2 2 2 2
2 1 1 1 2
2 1 0 1 2
2 1 1 1 2
2 2 2 2 2
The pixels with =1 are the 8-nieghbors of (x,y).
Note
and distances between p and q are independent of any paths that might
exist between the points because these distances involve only the coordinates
of the points.
4) -distance between two points is defined as the shortest m-path
between the points.
In this case the distance two pixels will depend on the values of the pixels
along the path as well as the values of their neighbors.
Example
Consider the following arrangement of pixels and assume that , , and
Have value 1 and that and can have a value of 0 or 1:

Suppose that we consider adjacency of pixels valued 1 (i.e., v={1} )


1) if and are 0,

The m-path( distance between p and is 2

2) if is 1
The distance between p is 3
3) if =1 and =0
The distance between p is 3

5
4) if and are 1

The distance between p is 4

You might also like