You are on page 1of 60

IMAGE PROCESSING QB SOLUTIONS

1.Define image. Explain digital and analog image. Explain digital image processing.
Ans:-
Image:An image is a visual representation or depiction of an object, scene, or phenomenon.
It is typically a two-dimensional representation composed of a grid of picture elements,
commonly referred to as pixels. Images can be captured, generated, or stored in various
formats and can represent different types of visual information, such as photographs,
graphics, or digital illustrations.
Digital Image :A digital image is a representation of visual information in a digital format. It is
composed of discrete elements called pixels, where each pixel represents a specific color or
grayscale value. Digital images are typically stored as binary data, where each pixel's value is
represented by a binary number. The resolution of a digital image refers to the number of
pixels in width and height, determining the level of detail and clarity.
Analog Image: An analog image, also known as a continuous-tone image, is a representation
of visual information in an analog format. It is characterized by continuous variations in
intensity or color values across the image. Analog images are typically captured using
traditional photographic techniques or analog cameras, and they exist as continuous physical
representations without discrete pixel elements. Examples of analog images include
photographs developed from film or printed images.
Digital Image Processing: Digital image processing (DIP) is the manipulation and analysis of
digital images using computer algorithms and techniques. It involves applying various
operations, filters, and transformations to enhance, modify, or extract useful information
from digital images. DIP techniques can be used to improve image quality, remove noise,
adjust brightness and contrast, perform image segmentation, detect objects or features, and
much more.
common operations in digital image processing include image filtering, image restoration,
image compression, image enhancement, and image analysis. Digital image processing finds
applications in various fields, such as medical imaging, remote sensing, computer vision,
multimedia processing, and scientific research.
2.Describe fundamental steps in image processing.
ANS:-
The fundamental steps in image processing typically involve the following:
1. Image Acquisition: The process of capturing or obtaining an image using cameras,
scanners, or other imaging devices. This step involves converting the physical image into a
digital representation.
2. Image Preprocessing: This step involves preparing the acquired image for further
processing. It includes operations such as noise removal, image resizing, color space
conversion, and adjusting brightness or contrast. Preprocessing aims to enhance image
quality, correct artifacts, and improve the suitability of the image for subsequent analysis.
3. Image Enhancement: Image enhancement techniques are applied to improve the visual
quality or perception of the image. This step can involve adjusting brightness and contrast,
enhancing sharpness, reducing noise, and improving color accuracy. The goal is to highlight
important features, improve visibility, and make the image visually appealing.
4. Image Restoration: Image restoration techniques are employed to recover or reconstruct
degraded or damaged images. This can involve removing blur, deconvolution to restore
sharpness, correcting geometric distortions, or eliminating artifacts caused by sensor or
transmission errors. Image restoration aims to reverse the effects of image degradation and
restore the original image as much as possible.
5. Image Segmentation: Image segmentation involves dividing the image into meaningful
and distinct regions or objects. It aims to identify and separate different areas based on their
properties such as color, texture, or intensity. Segmentation is useful for object recognition,
tracking, and further analysis of specific regions within the image.
6. Feature Extraction: Feature extraction is the process of identifying and extracting relevant
visual information or features from the image. These features can be edges, corners,
textures, shapes, or other characteristics that are essential for subsequent analysis or
recognition tasks. Feature extraction helps in reducing the complexity of the image and
capturing meaningful information for further processing.
7. Image Analysis and Interpretation: In this step, the extracted features or processed image
are analyzed and interpreted to extract meaningful information. This can involve object
detection, pattern recognition, classification, or measurement of specific properties. Image
analysis aims to understand the content and context of the image and extract useful
information for decision-making or further applications.
8. Image Compression: Image compression techniques are applied to reduce the storage
space required for storing or transmitting images. Compression algorithms exploit
redundancies and eliminate unnecessary information while preserving important visual
details. Lossless compression techniques preserve the original image quality, while lossy
compression methods sacrifice some details to achieve higher compression ratios.

3. Write down advantages and disadvantages of digital image.


ANS:-
Advantages of Digital Images:
1. Easy Storage and Sharing: Digital images can be easily stored, copied, and shared
electronically. They can be stored on various digital devices, such as computers, hard drives,
cloud storage, or portable storage devices. Digital images can be quickly shared through
email, messaging apps, social media platforms, or online galleries, allowing for convenient
and instant sharing with others.
2. Easy Reproduction: Digital images can be reproduced or duplicated without any loss in
quality. They can be copied and printed multiple times, allowing for efficient distribution or
archival purposes. This makes digital images suitable for applications such as printing,
publishing, advertising, and multimedia presentations.
3. Non-Destructive Editing: Digital images can be edited and manipulated using various
software tools and techniques without damaging the original image. This non-destructive
editing capability allows for experimentation and creative adjustments, as the original image
can be preserved while applying modifications or enhancements. It provides flexibility and
control over the editing process.
4. Image Processing and Enhancement: Digital images can undergo various image
processing techniques to improve their quality, adjust colors, remove noise, enhance
sharpness, and perform other modifications. Digital image processing allows for precise
control and fine-tuning of image properties, resulting in high-quality and visually appealing
images.
5. Metadata and Information Embedding: Digital images can store additional information
such as metadata, which includes details about the image, camera settings, date, and
location. This metadata can be useful for organizing and searching images, as well as
providing valuable information for analysis, archiving, or copyright purposes.

Disadvantages of Digital Images:


1. Vulnerability to Loss: Digital images are susceptible to loss or corruption due to hardware
failures, software errors, viruses, or accidental deletion. If proper backup measures are not
in place, valuable digital images can be lost permanently. It is essential to regularly back up
digital image collections to ensure their safety and prevent data loss.
2. Dependence on Technology: Digital images rely on technology for storage, retrieval, and
display. Compatibility issues, file format obsolescence, or hardware/software limitations can
pose challenges in accessing or using digital images, especially when older image formats or
software become incompatible with newer systems.
3. Image Manipulation and Authenticity: The ease of digital image editing and manipulation
raises concerns about the authenticity and trustworthiness of digital images. It is relatively
simple to alter or manipulate digital images using software tools, which can lead to
misrepresentation, forgery, or deception. Ensuring the integrity and authenticity of digital
images can be a challenge.
4. Higher Storage Requirements: Digital images, especially those captured at high
resolutions or in RAW formats, can consume significant storage space. This necessitates the
need for ample storage capacity, which can be costly. Efficient storage management and
compression techniques are often employed to mitigate this issue.
5. Lack of Tangibility: Unlike physical prints or photographs, digital images lack the
tangibility and physical presence. They exist as electronic files and can be easily overlooked
or forgotten if not appropriately organized or displayed. Some people still value the tactile
experience and sentimental value associated with physical prints.

4 .Explain the components of digital image processing with labelled diagram.


ANS:-
1. Input Image: The input image is the initial digital image that serves as the input to the
digital image processing system. It can be obtained through various means, such as image
acquisition devices (e.g., cameras, scanners) or digital image files.
2. Preprocessing Module: The preprocessing module consists of a set of operations
performed on the input image to prepare it for further processing. This module includes
tasks such as noise removal, image resizing, color space conversion, and contrast
adjustment. Preprocessing aims to enhance the quality of the image and make it suitable for
subsequent processing steps.
3. Enhancement Module: The enhancement module focuses on improving the visual quality
or perception of the image. It includes operations such as histogram equalization, contrast
stretching, sharpening, and denoising. Enhancement techniques aim to enhance specific
image features, increase image clarity, or improve overall image quality.
4. Transformation Module: The transformation module involves applying mathematical
transformations to the image. It includes operations such as Fourier transform, wavelet
transform, and geometric transformations (e.g., rotation, scaling, and shearing).
Transformations are used to analyze or modify the image in the frequency or spatial domain.
5. Feature Extraction Module: The feature extraction module focuses on identifying and
extracting relevant visual information or features from the image. It includes operations such
as edge detection, corner detection, texture analysis, and blob detection. Feature extraction
aims to capture important characteristics of the image that can be used for further analysis
or recognition tasks.
6. Segmentation Module: The segmentation module involves dividing the image into
meaningful regions or objects based on their properties. It includes operations such as
thresholding, region growing, edge-based segmentation, or clustering. Segmentation is
crucial for object detection, tracking, and further analysis of specific regions within the
image.
7. Analysis and Interpretation Module: The analysis and interpretation module involves
analyzing the processed image or extracted features to extract meaningful information. It
includes tasks such as object recognition, pattern matching, classification, or measurement
of specific properties. This module aims to understand the content and context of the image
and extract useful information for decision-making or further applications.
8. Output Image: The output image represents the final result of the digital image
processing system. It can be the processed image itself or derived information from the
analysis and interpretation module. The output image can be displayed, stored, or used for
further applications depending on the specific goals of the image processing system.

5. What are the applications of digital image processing?


Ans:-
Digital image processing is widely used in different fields like (i) Medicine, (ii) Forensics, (iii)
remote sensing, (iv) communications, and (v) Automotive.
(i) Medicine: Digital image processing techniques like image segmentation and
pattern recognition is used in digital mammography to identify tumours.
Techniques like image registration and fusion play a crucial role in extracting
information from medical images.
(ii) Forensics: Security can be enhanced by personal identification. Different
biometrics used in personal identification are face, fingerprint, iris, vein pattern,
etc. Pre-processing of the input data is necessary for efficient personal
identification. Commonly used pre-processing techniques include edge
enhancement, denoising, skeletonisation, etc.
(iii) Remote Sensing: Remote sensing is the use of remote observations to make
useful inferences about a target. Observations usually consist of measurements
of electromagnetic radiation with different wavelengths of the radiation carrying
a variety of information about the earth’s surface and atmosphere. Remote
sensing is being used increasingly to provide data for diverse applications like
planning, hydrology, agriculture, geology and forestry.
(iv) Communications: With the growth of multimedia technology, information can be
easily transmitted through the Internet. Video conferencing helps the people in
different locations to interact lively. For video conferencing to be effective, the
information has to be transmitted fast.
(v) Automotive: The latest development in the automotive sector is ‘night vision
system’. Night vision system helps to identify obstacles during night time to avoid
accidents. Infrared cameras are invariably used in a night-vision system. The
image-processing techniques commonly used in a night-vision system include
image enhancement, boundary detection and object recognition.
6. Explain Image Sensing and Acquisition with its types.
Ans:-

 The term image acquisition refers to the process of capturing real-world images and
storing them into a computer.

 Conventional silver-based photographs in the form of negatives, transparencies or


prints can be scanned using a variety of scanning devices.

 Digital cameras which capture images directly in digital form are more popular
nowadays.

 Films are not used in digital cameras. Instead, they use a charge-coupled device or
CMOS device as the image sensor that converts light into electrical charges.

 An image sensor is a 2D array of light-sensitive elements that convert photons to


electrons.

 Most of the digital cameras use either a CCD or a CMOS image sensor.

 A typical solid-state image sensor consists of many discrete photo-sensing elements.

 The charge packet is then transferred through the transport mechanism to the
output circuit where it is converted into a measurable voltage.

 The types of photo-sensing elements used in solidstate imagers include photodiodes,


MOS capacitors, Schottky-barrier diodes and photoconductive layers.
Image-Sensor Terminology
(i)Charge-coupled Device (CCD)- CCD is a charge-transfer device that collects light in
pixels and then uses clock pulses to shift the charge along a chain of pixels.
(ii) Dark Current- The charge of the signal collected by the pixel in the absence of light is
termed dark current.
(iii) Photo Site- Photo site is the portion of the silicon that functions as a light-sensitive
area.
(iv) Pixel- Pixel is a discrete photosensitive cell that collects and holds a photo charge.
(v)Fill Factor- A pixel is divided into a sensing portion and a read-out portion. Fill factor is
the ratio of the sensing area to the total area.
(vi) Quantum Efficiency- Quantum efficiency is the ratio of the photon-generated
electrons that the pixel captures to the photons incident on the pixel area.

7 How is image formed in Human eye?


Ans.: NOT FOUND
8 Explain in detail Elements of Human Visual Perception with suitable diagram.
Ans:-

 The human visual system can detect the range of light spectrum from about 400 nm
to about 700 nm.

 Vision and hearing are the two most important means by which humans perceive the
outside world.

 It is estimated that 75% of the information received by a human is visual.

 The use of visual information is referred to as perception, sight or understanding.

 An understanding of the perceptual processing capabilities of humans provided


motivation for developing similar paradigms for computers.

 The complex aspects of visual perception are best introduced by a brief description
of the anatomy of the human visual system.

 The Human Visual System (HVS) is an information-processing system, receiving


spatially sampled images from the cones and rods in the eye, and deducing the
nature of the objects it observes by processing the image data.

 The photoreceptors responsible for colour vision are the cones. There are three types
of cones in the retina. They are
(i) L-receptors which are sensitive to light of long wavelengths
(ii) M-receptors which are sensitive to light of middle wavelengths
(iii) S-receptors which are sensitive to light of short wavelengths

 It is customary to denote the RGB sensors with the Greek letters rho (red), gamma
(green) and beta (blue).
 The sensitivity curves of the rho, gamma and beta sensors in the human eye
determine the intensity of the colours that one perceives for each of the wavelengths
in the visual spectrum.

 Selective sensing of different light wavelengths allows the visual system to create the
perception of colour.
Q9. Write a short note on Sampling and Quantization.
Ans:-
Sampling:

Quantization:
Q10. Explain the different types of connectivity of pixels with suitable example.
Ans:-
1. the term "connectivity" refers to the relationships between pixels in an image. It
describes how pixels are connected or adjacent to each other based on their spatial
arrangement.
2. There are different types of connectivity, commonly known as neighborhood
systems, which define the set of pixels considered as neighbors of a given pixel. Here
are some examples:
a. 4-connectivity: In 4-connectivity, also known as the Von Neumann neighborhood,
a pixel is connected to its four immediate neighbors - the pixels above, below, to
the left, and to the right. This type of connectivity forms a square shape around
each pixel. Here's an example:
00000
01100
01100
00000
In this example, the pixel with value 1 is connected to its four neighboring pixels with
value 1.
b. · 8-connectivity: In 8-connectivity, also known as the Moore neighborhood, a
pixel is connected to its eight immediate neighbors - the four neighbors from 4-
connectivity plus the diagonally adjacent pixels. This type of connectivity forms a
square shape with diagonals around each pixel. Here's an example:
00000
01110
01110
01110
00000
In this example, the pixel with value 1 is connected to its eight neighboring pixels with
value 1.
c. N-connectivity: N-connectivity is a more generalized form of connectivity, where
the value of N determines the number of connected neighbors. For example, in 5-
connectivity, a pixel is connected to its four immediate neighbors and one
diagonal neighbor. Similarly, in 6-connectivity, a pixel is connected to its four
immediate neighbors and two diagonal neighbors. The pattern continues, and
higher values of N result in more connected neighbors
Q11. List and explain elements of image processing system?
Ans:-
1. An image processing system consists of several key elements that work together to
analyze and manipulate images. Here are the main elements of an image processing
system:
a. Image Acquisition: Image acquisition involves the process of receiving and
digitizing the image data from the input devices.
It includes tasks such as sampling, quantization, and color space conversion to represent
the image in a suitable digital format.
b. Preprocessing: Preprocessing refers to the initial stage of image processing where
various techniques are applied to enhance the quality of the input image.
This may involve operations such as noise reduction, image resizing, color correction,
and image enhancement.
c. Image Enhancement: Image enhancement techniques are used to improve the
visual quality of an image or to extract useful information from it.
These techniques can include contrast enhancement, brightness adjustment,
sharpening, filtering, and histogram equalization.
d. Input Devices: Input devices capture the raw image data and convert it into a
digital format that can be processed by the system. Examples of input devices
include digital cameras, scanners, and video capture devices.
e. Image Compression: Image compression is the process of reducing the size of an
image while maintaining an acceptable level of quality. It involves techniques
such as lossless compression or lossy compression to achieve efficient storage or
transmission of images.
f. Input Devices: Input devices capture the raw image data and convert it into a
digital format that can be processed by the system. Examples of input devices
include digital cameras, scanners, and video capture devices.

Q12. Explain the term (a) Thresholding (b) Log Transformation (c) Negative
Transformation
Ans:-
a. Thresholding:
1. Thresholding is a simple and commonly used technique in image processing for
image segmentation.
2. It involves converting a grayscale or color image into a binary image by assigning
different intensity values to pixels based on a predefined threshold value.
3. The threshold value separates the image pixels into two categories: those below the
threshold are assigned one value (usually 0 or black), and those above or equal to
the threshold are assigned another value (usually 255 or white).
4. Thresholding is useful for separating objects from the background or separating
regions of interest in an image.
5. It is often applied in scenarios where there is a clear distinction between foreground
and background intensities.
6. However, thresholding can be sensitive to noise and lighting variations, and choosing
an appropriate threshold value can be challenging in some cases.
b. Log Transformation:
1. The log transformation, also known as logarithmic transformation or logarithmic
correction, is a nonlinear image enhancement technique that adjusts the pixel
values based on the logarithm function.
2. It is used to expand or compress the dynamic range of an image.
3. The log transformation is applied to the intensity values of the pixels in an image
using the formula:
4. Output pixel value = c * log(1 + Input pixel value)
5. The log transformation is particularly useful when dealing with images that have
a wide range of intensity values, such as images with high contrast or images with
a predominance of dark or bright regions.
6. It can help to enhance the details in the darker areas while compressing the
brighter areas, resulting in a more visually pleasing image.
c. Negative Transformation:
1. The negative transformation, also called image negation, is a simple image
processing operation that produces the inverse of an image's original intensity
values. It involves subtracting each pixel value from the maximum intensity value
(e.g., 255 for an 8-bit image) to obtain the new pixel value.
2. The formula for negative transformation is:
Output pixel value = Maximum pixel value - Input pixel value
3. This transformation converts dark pixels to bright ones and vice versa. It
effectively produces a "negative" version of the original image, similar to the
concept of a photographic negative.
4. The negative transformation is often used for artistic purposes, visual effects, or
to enhance certain features in an image by highlighting areas that were originally
dark.
The negative transformation does not alter the overall structure or content of the image
but changes the visual appearance by inverting the pixel intensities.
13. Explain the following (a) Contrast stretching (b) Grey level slicing.
ANS:-
CONTRAST STRETCHING:-

 Many times we obtain low Contrast image due to poor illumination or due to wrong
setting of the aperture.

 The idea behind contrast stretching is to increase the contrast of the image by
making the dark portion darker and bright portion brighter.

 The dotted line indicates the identity transformation and the centre line is the
contrast stretching information.

 We make dark grey level darker by assigning a slope of <1 and make bright grey level
by assigning the slopes >1.
 The formulation of the contrast stretching algorithm is :


GREY LEVEL SLICING:

 The purpose of gray-level slicing is to highlight a specific range of gray values. Two
different approaches can be adopted for gray-level slicing.
A. Gray-level Slicing without Preserving Background:-

 This displays high values for a range of interest and low values in other areas.

 The main drawback of this approach is that the background information is discarded.


B. Gray-level Slicing with Background:-

 In gray-level slicing with background, the objective is to display high values for the
range of interest and original gray level values in other areas.

 This approach preserves the background of the image.

THE FORMULATION OF THE GRAY LEVEL SLICING IS:


14. Explain –i) Power law transformation ii) Bit Plane Slicing.
ANS:-
POWER LAW TRANSFORMATION:

 The intensity of light generated by a physical device such as a CRT is not a linear
function of the applied signal. The intensity produced at the surface of the display is
approximately the applied voltage, raised to the power of 2.5.

 The power law transformation is given by :


g(m,n )=[f(m,n)] ^γ

 where f(m, n) is the input image and g(m, n) is the output image. Gamma (γ) can take
either integer or fraction values.

BIT PLANE SLICING:-

 The gray level of each pixel in a digital image is stored as one or more bytes in a
computer.

 For an 8-bit image, 0 is encoded as 0 0 0 0 0 0 0 0, and 255 is encoded as 1 1 1 1 1 1


1 1. Any number between 0 and 255 is encoded as one byte.

 The bit in the far left side is referred as the Most Significant Bit (MSB), because a
change in that bit would significantly change the value encoded by the byte.

 The bit in the far right is referred as the Least Significant Bit (LSB).

 Bit-plane slicing is a method of representing an image with one or more bits of the
byte used for each pixel.
 One can use only the MSB to represent a pixel, which reduces the original gray level
to a binary image.

 The three main goals of bit plane slicing are


(i) Converting a gray level image to a binary image
(ii) (ii) Representing an image with fewer bits and compressing the image to a
smaller size
(iii) (iii) Enhancing the image by focussing.

15. Explain the concept of brightness adaptation and discrimination.


ANS:- BRIGHTNESS ADAPTATION:-

 The human visual system has the ability to operate over a wide range of illumination
levels.

 Dilation and contraction of the iris of the eye can account for a change of only 16
times in the light intensity falling on the retina.

 The process which allows great extension of this range by changes in the sensitivity
of the retina is called brightness adaptation.
BRIGHTNESS DISCRIMINATION:-

 Brightness discrimination refers to the ability of our visual system to distinguish


between different levels of brightness in an image.

 Our visual system can detect differences in brightness levels as small as one
percent.

 This ability is crucial in image processing because it allows us to perceive and


distinguish different features and objects in an image.

16. Apply the following image enhancement techniques for the given 3 bits per pixel
image
segment. Digital Negative
Thresholding T=5
I=
[2 1 2 1 0
71432
24137
13463
1 4 1 3 4]
SOLN:-

17) Explain the following (a) Contrast stretching (b) Grey level slicing ?
ANS:-
 a) Contrast stretching :
1) is an image enhancement technique that improves the contrast of an image by stretching
the range of intensity values it contains to span a desired range of values. 2) This is done by
mapping the original intensity values to new intensity values that are linearly distributed
between 0 and 255.
3) For example, if an image has a low contrast, the contrast stretching technique can be
used to stretch the range of intensity values so that the image has a higher contrast.
4) This can make the image easier to see and can also help to highlight certain features in
the image.
Gray level slicing :
1) is another image enhancement technique that is used to highlight specific ranges of
intensity values in an image.
2) This is done by assigning different output values to different input values within a
specified range.
3) For example, if you want to highlight all of the pixels in an image that are between 100
and 200, you could use gray level slicing to assign a value of 255 to all of those pixels and a
value of 0 to all of the other pixels.
4) This would effectively create a mask that would only allow the pixels in the specified
range to be seen.
Both contrast stretching and gray level slicing are simple image enhancement techniques
that can be used to improve the quality of an image. However, it is important to note that
these techniques can also introduce artifacts into an image. For example, contrast stretching
can introduce banding artifacts, which are visible stripes that can appear in an image. Gray
level slicing can also introduce edge artifacts, which are visible lines that can appear around
the edges of objects in an image.
Here are some examples of how contrast stretching and gray level slicing can be used to
enhance images:
 Contrast stretching can be used to improve the contrast of a low-contrast image,
making it easier to see.
 Gray level slicing can be used to highlight specific features in an image, such as edges
or objects of a certain color.
 Contrast stretching and gray level slicing can be used together to create more
complex image enhancements.

18) Explain – i) Power law transformation ii) Bit Plane Slicing.


ANS;-
a) Power Law Transformation :
Power law transformation is a non-linear intensity transformation technique that is used to
enhance the contrast of an image. It is a simple and effective technique that can be used to
improve the visibility of details in an image.
The power law transformation is defined as:
Code snippet
s = c * r^gamma
where:
 s is the output intensity value
 r is the input intensity value
 c is a constant that controls the overall brightness of the image
 gamma is a constant that controls the contrast of the image
The value of gamma can be positive or negative. A positive value of gamma will increase the
contrast of the image, while a negative value of gamma will decrease the contrast of the
image.

b) Bit Plane Slicing :


Bit plane slicing is a technique for reducing the spatial resolution of an image by dividing the
image into bit planes. A bit plane is a group of bits that represent a single pixel value. For
example, in an 8-bit image, there are 8 bit planes, each of which represents a single pixel
value.
Bit plane slicing can be used to reduce the spatial resolution of an image by selecting a
subset of the bit planes. For example, if we select the first 4 bit planes, we will be left with
an image that has a spatial resolution of 1/2 that of the original image.
Bit plane slicing can also be used to extract specific features from an image. For example, if
we select the bit planes that represent the high-frequency components of an image, we will
be left with an image that contains only the edges of the image.
Here are some of the advantages of using power law transformation and bit plane slicing:
 They are simple and easy to implement.
 They are effective in enhancing the contrast and reducing the spatial resolution of
images.
 They can be used to extract specific features from images.
However, there are also some disadvantages to using these techniques:
 They can introduce artifacts into images.
 They can be lossy, meaning that some information is lost when the image is
transformed.
 They may not be suitable for all types of images.

19) Explain the concept of brightness adaptation and discrimination ?


ANS:-
Brightness adaptation : is the process by which the human visual system adjusts its
sensitivity to light based on the level of illumination in the environment. Our eyes have a
remarkable ability to adapt to different levels of brightness and adjust our perception of
brightness accordingly. For example, if you walk from a dark room into a brightly lit room,
your eyes will initially be overwhelmed by the brightness and everything will appear washed
out. However, after a few seconds, your eyes will adapt and you will be able to see normally.

Brightness discrimination : is the ability to distinguish between different levels of


brightness. This is important for tasks such as reading, driving, and operating machinery. The
human visual system is very good at brightness discrimination, even in low-light conditions.
This is because our eyes have a number of mechanisms that help us to see in low light, such
as the pupil dilation and the retina's ability to amplify light.
Brightness adaptation and discrimination are two important concepts in image processing.
Image processing algorithms often need to take into account the level of brightness in an
image in order to produce accurate results. For example, an image processing algorithm that
is used to detect edges in an image will need to be aware of the level of brightness in the
image in order to determine which pixels are edges and which pixels are not.
Here are some of the ways that brightness adaptation and discrimination are used in
image processing:
 Contrast enhancement: Contrast enhancement techniques are used to improve the
visibility of details in an image. These techniques often rely on brightness adaptation
and discrimination to determine which pixels should be brightened or darkened.
 Image segmentation: Image segmentation is the process of dividing an image into
different regions. Brightness adaptation and discrimination can be used to segment
images by identifying regions that have different levels of brightness.
 Object detection: Object detection is the process of identifying objects in an image.
Brightness adaptation and discrimination can be used to detect objects by identifying
regions that have different levels of brightness and that are consistent with the
appearance of the object being detected.
Brightness adaptation and discrimination are two important concepts in image processing.
By understanding these concepts, you can better understand how image processing
algorithms work and how they can be used to improve the quality of images.
20) With an example show that the discrete histogram equalization technique does not, in
general yield a flat histogram ?
 code:
import cv2
import numpy as np

def hist_equalize(img):
hist, bins = np.histogram(img.ravel(), 256, [0, 256])
cdf = np.cumsum(hist)
cdf_m = np.max(cdf)

new_img = np.zeros_like(img)
for i in range(img.shape[0]):
for j in range(img.shape[1]):
new_img[i, j] = cdf[img[i, j]] * 255 / cdf_m

return new_img

img = cv2.imread('lena.png')

# Original image histogram


plt.subplot(121)
plt.hist(img.ravel(), 256, [0, 256])
plt.title('Original image histogram')

# Histogram equalized image


new_img = hist_equalize(img)
# Equalized image histogram
plt.subplot(122)
plt.hist(new_img.ravel(), 256, [0, 256])
plt.title('Equalized image histogram')
plt.show()
There are a few reasons why the discrete histogram equalization technique does not, in
general, yield a flat histogram. First, the technique is based on the assumption that the
image has a continuous distribution of intensities. However, most images have a discrete
distribution of intensities, which means that there are a finite number of possible values for
each pixel. This can lead to artifacts in the equalized image, such as banding and staircasing.
Second, the histogram equalization technique is a global operation. This means that it
applies the same transformation to all pixels in the image. However, not all pixels in an
image are equally important. For example, pixels in the background of an image are often
less important than pixels in the foreground. A local histogram equalization technique would
be able to take this into account and would be more likely to produce a flat histogram.
Despite these limitations, the histogram equalization technique is a powerful tool for
improving the contrast of images. It is often used in image processing applications such as
image enhancement, image segmentation, and image compression.

21.Explain any two properties of 2D DFT.


ANS:-
1.The 2D Discrete Fourier Transform (DFT) is a mathematical operation used to transform a
2D signal or image from the spatial domain to the frequency domain.
2.Here are two properties of the 2D DFT:
A.Linearity: The 2D DFT exhibits linearity, which means that it follows the principles of
superposition. Linearity states that if you take the DFT of a linear combination of two signals
or images, it is equal to the same linear combination of their individual DFTs.
Mathematically, if x?[n?, n?] and x?[n?, n?] are two 2D signals, and a? and a? are two
constants, then the 2D DFT of the linear combination a?x?[n?, n?] + a?x?[n?, n?] is given by
A?X?[k?, k?] + A?X?[k?, k?], where A? and A? are the DFTs of x?[n?, n?] and x?[n?, n?],
respectively.
B.Shift Property: The 2D DFT also exhibits a shift property, which states that a shift in the
spatial domain corresponds to a linear phase shift in the frequency domain. Specifically, if
x[n?, n?] is a 2D signal and x?[n?, n?] is the same signal shifted by (n??, n??), then the 2D
DFT of x?[n?, n?] can be expressed as a linear phase shift of the DFT of x[n?, n?].
Mathematically, if X[k?, k?] represents the DFT of x[n?, n?], then the DFT of x?[n?, n?] is
given by X?[k?, k?] = X[k?, k?] * exp(-j2π(k??k?/N? + k??k?/N?)), where N? and N? are the
dimensions of the 2D signal and * denotes the complex multiplication.
3.This property is essential for various applications, such as image registration, where it
allows for the alignment of images in the frequency domain by introducing appropriate
phase shifts.
4.These properties, linearity and shift property, are fundamental in the analysis and
manipulation of 2D signals using the 2D DFT, providing a powerful tool for various signal and
image processing tasks.
22 Explain the terms: (a)Smoothing (b) Sharpening
ANS:-
A.Smoothing
1.Smoothing, in the context of image processing and signal analysis, refers to a process or
technique used to reduce or suppress high-frequency variations or noise in data.
2.It involves applying a filter or mathematical operation to the data in order to create a
smoother representation with fewer abrupt changes or irregularities. Smoothing is often
employed to enhance the quality, clarity, or interpretability of signals or images.
3.Smoothing can be achieved using various types of filters, commonly known as smoothing
filters or low-pass filters. These filters attenuate or reduce the amplitudes of high-frequency
components, effectively blurring or averaging out rapid changes in the data. 4.Smoothing
filters typically employ a moving window or kernel that slides over the data, calculating an
average or weighted sum of the values within the window. The resulting output represents a
smoothed version of the original data. Smoothing filters inherently introduce a blurring
effect, as they reduce the sharp transitions and fine details in the data. This blurring can be
beneficial in certain applications.
5.smoothing parameter allows for trade-offs between noise reduction, blurring, and the
preservation of important features. The selection of an appropriate smoothing parameter
depends on the specific application, the characteristics of the data, and the desired level of
smoothing.
B.Sharpening
1.Sharpening,refers to a technique or process used to enhance the edges and details in an
image, resulting in a visually sharper appearance. It involves accentuating the transitions
between pixels with significant intensity changes, thereby increasing the perception of
image clarity and crispness.
2.Sharpening techniques aim to reverse the effects of blurring or loss of sharpness that may
occur during image capture, compression, or other image processing operations.
3.sharpening techniques is the emphasis on edges, which are areas of rapid intensity
transitions in an image. These transitions represent changes in color, brightness, or texture
and are responsible for defining the boundaries and fine details in an image. Sharpening
methods enhance the contrast and visibility of these edges, making them more pronounced
and perceptually sharper.
4.Sharpening techniques often involve boosting the high-frequency components while
preserving the lower-frequency information. This selective emphasis on high-frequency
details enhances the perception of sharpness without significantly affecting the overall
image characteristics.
5.sharpening techniques in image processing are used to enhance the edges and fine details
in an image, resulting in a visually sharper appearance. By accentuating the transitions
between pixels with significant intensity changes, sharpening methods improve the clarity
and crispness of an image, making it more visually appealing and easier to interpret.
23.Explain Low pass averaging filter with example?
ANS:-
1.A low pass averaging filter is a type of filter commonly used in signal and image processing
to attenuate high-frequency components while preserving low-frequency components.
2.It achieves this by averaging the values of neighboring pixels or samples in the input signal.
Let's take an example to understand the low pass averaging filter better:
3.Consider a grayscale image represented by a 2D matrix, where each element represents
the intensity value of a pixel. Let's say we have the following 3x3 image matrix:
1001201101301401251151051354.To apply a low pass averaging filter, we convolve the
image matrix with a 3x3 filter kernel, where each element represents the weights assigned
to the corresponding pixel in the neighborhood. In the case of a simple averaging filter, each
element in the kernel is set to 1/9 (since there are 9 elements in the kernel):
1/91/91/91/91/91/91/91/91/95.To obtain the filtered output, we perform a convolution
operation between the image matrix and the filter kernel. At each position, the output value
is computed as the element-wise multiplication and summation of the corresponding
elements in the image matrix and the filter kernel.
6.For example, let's calculate the filtered value at position (1,1) in the output image matrix.
We multiply the elements in the 3x3 neighborhood centered around (1,1) with the
corresponding elements in the filter kernel and sum them up:
(1001/9) + (1201/9) + (1101/9) + (1301/9) + (1401/9) + (1251/9) + (1151/9) + (1051/9) +
(135*1/9) = 121.11
So, the filtered value at position (1,1) in the output image matrix would be approximately
121.11.
7.By applying the same process to each position in the input image matrix, we obtain the
filtered output image matrix. The resulting image matrix will have reduced high-frequency
components, resulting in a smoother image.

24.Write a note on image enhancement using spatial filters.


ANS:-
1.Image enhancement using spatial filters is a widely used technique in image processing
that aims to improve the visual quality of an image by manipulating its pixel values in the
spatial domain.
2.Spatial filters operate on the pixel values of an image within a local neighborhood and
modify them based on predefined rules or mathematical operations. This technique allows
for the enhancement of various image characteristics such as contrast, sharpness, and edge
definition.
3.Spatial filters, also known as neighborhood filters or convolution filters, apply a
mathematical operation to each pixel in an image by considering its surrounding pixels
within a specified neighborhood.
4.The neighborhood is typically defined by a filter kernel or mask, which is a small matrix of
coefficients. The size and shape of the kernel determine the extent of the neighborhood and
the nature of the enhancement.
5.Types of Spatial Filters: There are different types of spatial filters used for image
enhancement, each with its own purpose and characteristics.
6.Some commonly used filters include:
A.Smoothing Filters: These filters, such as the mean or Gaussian filters, are used to reduce
noise and blur the image slightly. They work by averaging the pixel values in the
neighborhood, resulting in a smoother appearance.
B.Sharpening Filters: Sharpening filters, such as the Laplacian or high-pass filters, are used
to enhance edges and fine details in the image. They emphasize high-frequency components
by subtracting a smoothed version of the image from the original.
C.Gradient Filters: Gradient filters, such as the Sobel or Prewitt filters, are used for edge
detection. They highlight areas of significant intensity changes by computing the gradient
magnitude or direction at each pixel.
D.Histogram Equalization: Histogram equalization is a global enhancement technique that
redistributes the pixel intensities to achieve a more balanced histogram. It enhances the
contrast of an image by stretching the intensity range.
7.While spatial filters can enhance certain aspects of an image, they may also introduce
artifacts or amplify noise if used improperly. It is crucial to strike a balance between
enhancement and preserving the image's original features.
8.Additionally, spatial filters are sensitive to the selection of neighborhood size and kernel
coefficients, which may require fine-tuning for different images and applications.
9.image enhancement using spatial filters is a powerful technique in image processing. It
allows for the enhancement of various image characteristics by manipulating pixel values
within a local neighborhood.
25. What are high boost filters? How are they used? Explain.
ANS: NOT SUBMITTED YET.
26 What is histogram of an image? Compare between histogram equalization and
histogram matching.
ANS: NOT SUBMITTED YET.
27. Explain various image enhancement techniques in frequency domain.
ANS: NOT SUBMITTED YET
28 Define Gaussian low pass filter. Compare its ringing and blurring effects with Ideal
low pass filter.
ANS: NOT SUBMITTED YET.
Q. 29 Compare contrast stretching and histogram equalization.
ANS:-
Contrast stretching and histogram equalization are two common techniques used in digital
image processing to enhance the contrast and improve the visual appearance of images.
While they serve a similar purpose, there are differences in how they work and the results
they produce. Let's compare and contrast these two techniques:
1. Definition:
Contrast Stretching: Contrast stretching, also known as intensity stretching, is a process of
expanding the range of pixel intensities in an image to span the full dynamic range.
Histogram Equalization: Histogram equalization is a technique that redistributes the intensity
values of an image to achieve a more balanced histogram.
2. Operation:
Contrast Stretching: Contrast stretching works by stretching the original pixel intensity range
to a desired range. It linearly scales the pixel values based on the minimum and maximum
intensity values in the image.
Histogram Equalization: Histogram equalization calculates the cumulative distribution
function (CDF) of the histogram of an image and maps the original pixel intensities to new
values based on this CDF. This redistribution aims to create a uniform histogram, thus
enhancing the contrast.
3. Process:
Contrast Stretching: In contrast stretching, the process involves specifying the desired
minimum and maximum intensity values. The pixel values below the minimum are mapped
to the minimum, and the values above the maximum are mapped to the maximum. The
remaining values are linearly scaled between the specified minimum and maximum.
Histogram Equalization: Histogram equalization computes the histogram of the image and
calculates the cumulative distribution function. The CDF is then normalized and used to
create a mapping function that assigns new pixel values to the original ones.
4. Impact on Image:
Contrast Stretching: Contrast stretching increases the dynamic range of an image, making
the dark regions darker and the bright regions brighter. It enhances the overall contrast but
may result in loss of details in very bright or dark areas.
Histogram Equalization: Histogram equalization redistributes the intensity values to achieve
a more balanced histogram. It tends to enhance the details in the mid-range intensity levels
and can improve the visibility of low-contrast areas. However, it may amplify noise and result
in unnatural-looking images.
5. Applicability:
Contrast Stretching: Contrast stretching is suitable for images with low or moderate contrast,
where the pixel intensities are concentrated within a limited range. It is a simple and quick
method for improving the contrast.
Histogram Equalization: Histogram equalization is effective for images with uneven or
skewed histograms, where certain intensity levels dominate. It is commonly used for
enhancing medical images, satellite images, and other applications where global contrast
improvement is desired.
6. Local vs. Global Operation:
Contrast Stretching: Contrast stretching operates globally on the entire image. It does not
consider the local characteristics or neighboring pixel values.
Histogram Equalization: Histogram equalization also works globally but can be applied locally
by dividing the image into smaller regions and applying the equalization independently. This
adaptive or local histogram equalization can better preserve local details and avoid over-
enhancement.
33 describe colour model and list explain its types 11-2
Ans:-
i)colour model also known as colour space.
In image processing, a color model is a system that represents and defines colors in a digital
image. It provides a mathematical representation of colors, allowing computers to
understand and manipulate them.
There are various color models used in image processing, and each has its own
characteristics and uses. Here are some commonly used color models:
1. RGB (Red, Green, Blue): RGB is the most common color model used in digital imaging. It
represents colors by combining different intensities of red, green, and blue primary colors.
Each pixel in an RGB image has three color channels, and the intensity values range from 0
to 255. By varying the intensity values of these three channels, a wide range of colors can be
achieved.
RGB is an additive colour model.
Magenta = Red + Blue
Yellow = Red + Green
Cyan = Blue + Green
2. CMYK (Cyan, Magenta, Yellow, Black): CMYK is primarily used in printing and represents
colors by combining different percentages of cyan, magenta, yellow, and black inks. Unlike
RGB, which is an additive color model, CMYK is a subtractive color model. It is used to
specify colors for printing purposes and is based on the idea that subtracting colors from
white gives the desired color.
CMY is a subtractive colour model.
Magenta = White – Green
Cyan = White – Red
Yellow = White –Blue

3. HSI stands for Hue, Saturation and Intensity : HSI is a cylindrical color model that
represents colors based on their hue, saturation, and lightness values. Hue represents the
actual color, saturation determines the purity or intensity of the color, and lightness
represents the brightness or darkness of the color. HSI is often used for color selection and
manipulation as it provides an intuitive way to adjust color properties.
4. YIQ Colour Model
The YIQ colour model is defined by the National Television System Committee (NTSC). In this
model, Y represents the luminance; and I and Q describe the chrominance. Conversion
between RGB and YIQ is given below.
5. YCbCr Colour Coordinate:
The YCbCr colour coordinate was developed as part of the ITU-R BT.601 during the
establishment of a worldwide digital video component standard.
The YCbCr signals are scaled and offset versions of the YIQ format. Y is defined to have a
nominal range of 16 to 235; Cb and Cr are defined to have a range of 16 to 240, with zero
signal corresponding to level 128.
There are several YCbCr formats such as 4:4:4, 4:2:2 and 4:1:1.
The sampling format implies that the sampling rates of Cb and Cr are one-half of that of Y.
These are just a few examples of color models used in image processing. Each model has its
own advantages and applications, and the choice of color model depends on the specific
task at hand.
34 draw and explain block diagram of jpeg encoder and decoder .
35 Generate the huffmon code for the word "COMMITTEE" 452
Ans:-
Total number of symbols in the word ‘COMMITTEE’ is 9.

Probability of the symbol C = p(C) = 1/9


Probability of the symbol O = p(O) = 1/9
Probability of the symbol Μ = p(Μ) = 2/9
Probability of the symbol I = p(I) = 1/9
Probability of the symbol T = p(T) = 2/9
Probability of the symbol E = p(E) = 2/9

Step 1 Arrange the symbols into descending order according to the probability.

Step 2 Construction of Huffman tree


The Huffman tree corresponding to the term COMMITTEE is shown below.
Step 3 Code word from the Huffman Tree
The code word for each symbol and the corresponding word length is

Step 4 Determination of average length (L)


The formula to calculate the average length is given by

where L = average length of the symbol.


Pk = probability of occurrence of the symbol.
lk = length of each symbol.

Solving this, we get the average length as


L = 2 5553 . bits/symbol
Step 5 Determination of the entropy (H(S ))
36 Explain run length coding with suitable example 9-4 (jayaram 449)
Ans:-
37. Compare lossy and lossless image compression.
ANS:-

Lossy compression is the method While Lossless Compression does


1
which eliminate the data which is not eliminate the data which is not
.
not noticeable. noticeable.
In Lossy compression, A file does While in Lossless Compression, A
2
not restore or rebuilt in its file can be restored in its original
.
original form. form.

3 In Lossy compression, Data’s But Lossless Compression does not


. quality is compromised. compromise the data’s quality.

4 Lossy compression reduces the But Lossless Compression does not


. size of data. reduce the size of data.

Algorithms used
Algorithms used
in Lossy compression are:
in Lossless compression are: Run
5 Transform coding, Discrete Cosine
Length Encoding, Lempel-Ziv-
. Transform, Discrete Wavelet
Welch, Huffman Coding,
Transform, fractal compression
Arithmetic encoding etc.
etc.

6 Lossy compression is used in Lossless Compression is used in


. Images, audio, video. Text, images, sound.

Lossless Compression has less


7 Lossy compression has more data-
data-holding capacity than Lossy
. holding capacity.
compression technique.

8 Lossy compression is also termed Lossless Compression is also


. as irreversible compression. termed as reversible compression.

OR

Key Lossy Compression Lossless Compression

By using lossy compression, you can get Even unnoticeable bytes are retained with
Data
rid of bytes that are regarded as lossless compression.
Elimination
unnoticeable.
Key Lossy Compression Lossless Compression

After lossy compression, a file cannot be After lossless compression, a file can be
Restoration
restored to its original form. restored to its original form.

Quality suffers as a result of lossy No quality degradation happens in lossless


Quality compression. It leads to some level of compression.
data loss.

Lossy compression reduces the size of a Lossless compression reduces the size but
Size
file to a large extent. less as compared to lossy compression.

Transform coding, Discrete Cosine Run length encoding, Lempel-Ziv-Welch,


Algorithm
Transform, Discrete Wavelet transform, Huffman Coding, Arithmetic encoding, etc.
used
fractal compression, etc.

Lossy compression is used to compress Lossless compression is used to compress


Uses audio, video and images. files containing text, program codes, and
other such critical data.

The data holding capacity of the lossy Lossless compression has low data holding
Capacity
compression approach is quite significant. capacity as compared to lossy compression.

38. Explain the image compression model.


ANS:- IMAGE COMPRESSION MODEL

 The source encoder and decoder pair is commonly referred as source codec module,
whereas the channel encoder and decoder pair is commonly referred as channel
codec module.
 Over the past decades, the separate designs of the two coding modules was justified
by Shannon’s classic separation theorem.

 Source Coding The goal of source coding is efficient conversion of the source data
(input image data) into a sequence of bits. The source coder reduces the entropy,
which means decrease in the average number of bits required to represent the
image.

 The source decoding is essentially an inverse operation.

 Channel The channel is a mathematical model of the medium over which


communication occurs.

 Channel Coding The channel encoder introduces controlled redundancy to the


compressed output of the source encoder. The purpose of channel encoder is to
protect the communication system against noise and other transmission errors in the
channel.

 The channel decoder exploits the redundancy in the bit sequence to reproduce the
compressed bits.
39. Write down steps of Shannon-Fano coding.
Ans:- The Shannon–Fano Coding

 This coding is a top-down binary tree method.

 The algorithm of Shannon–Fano coding is given below:


1. The set of source symbols are sorted in the order of non-increasing probabilities.
2. Each symbol is interpreted as the root of a tree.
3. The list is divided into two groups such that each group has nearly equal total
probabilities.
4. The code word of the first group is appended with 0.
5. The code word of the second group is appended with 1.
6. Steps (3) to (4) are repeated for each group until each subset contains only one node.

 Construct the Shanon–Fano code for the word MUMMY


40. How Arithmetic coding is used in image compression?
Ans:-

 In arithmetic coding, the interval from zero to one is divided according to the
probabilities of the occurrences of the intensities.
 Arithmetic coding does not generate individual codes for each character but performs
arithmetic operations on a block of data, based on the probabilities of the next
character.

 Using arithmetic coding, it is possible to encode characters with a fractional number of


bits, thus approaching the theoretical optimum.

 Arithmetic coding performs very well for sequences with low entropy where Huffman
codes lose their efficiency.
41. What is Structuring Element? What is the use of it in morphological operation?
ANS:-

 Mathematical morphology is a collection of non-linear processes which can be


applied to an image to remove details smaller than a certain reference shape, which
is called structuring element.

 The structuring element in a morphological operation plays an important role with its
different shape and size.

 Shape and size are defined by a number of 0s and 1s in the structuring elements.

 The circle shown in Fig. is called the centre pixel, where the resultant value is applied.
This circle can be anywhere in the structuring element according to the user
perspective.
 Morphological operations are defined by moving a structuring element over the
binary image to be modified, in such a way that it is centred over every image pixel at
some point.

 When the structuring element is centred over a region of the image, a logical
operation is performed on the pixels covered by the structuring element, yielding a
binary output.

 The morphological image processing is like a convolution process as shown in Fig.


10,3 . Like the convolution kernel, the structuring element can be of any size, and it
can contain complements of 1s and 0s.

 At each pixel position, a specified logical operation is performed between the


structuring element and the underlying binary image.

 The binary result of that logical operation is stored in the output image at that pixel
position.

 The effect created depends upon the size and content of the structuring element and
the nature of the logical operation.

 The binary image and structuring element sets need not be restricted to sets in the
2D plane, but could be defined in 1, 2, 3 (or higher) dimensions.

 If the structuring element is perfectly fit on to the binary image then perform the
logical operation; else do not perform any operation into resultant binary image
pixel.

42. What is dilation and erosion of and erosion of an image? State its applications.
Dilation:
Dilation is a process in which the binary image is expanded from its original shape.
 The way the binary image is expanded is determined by the structuring element.

 This structuring element is smaller in size compared to the image itself, and normally
the size used for the structuring element is 3 × 3.

 The dilation process is similar to the convolution process, that is, the structuring
element is reflected and shifted from left to right and from top to bottom, at each
shift; the process will look for any overlapping similar pixels between the structuring
element and that of the binary image.

 If there exists an overlapping then the pixels under the centre position of the
structuring element will be turned to 1 or black. Let us define X as the reference
image and B as the structuring element.

 The dilation operation is defined by given Eq.


 where Bˆ is the image B rotated about the origin.

 Equation states that when the image X is dilated by the structuring element B, the
outcome element z would be that there will be at least one element in B that
intersects with an element in X.

 If this is the case, the position where the structuring element is being centred on the
image will be ‘ON’. This process is illustrated in given Fig. .

 The black square represents 1 and the white square represents 0.

 Initially, the centre of the structuring element is aligned at position *. At this point,
there is no overlapping between the black squares of B and the black squares of X;
hence at position * the square will remain white. This structuring element will then
be shifted towards right.

 At position **, we find that one of the black squares of B is overlapping or


intersecting with the black square of X. Thus, at position ** the square will be
changed to black.

 Similarly, the structuring element B is shifted from left to right and from top to
bottom on the image X to yield the dilated image as shown in Fig.
 The dilation is an expansion operator that enlarges binary objects. Dilation has many
uses, but the major one is bridging gaps in an image, due to the fact that B is
expanding the features of X.
Erosion:

 Erosion is the counter-process of dilation. If dilation enlarges an image then erosion


shrinks the image.

 The way the image is shrunk is determined by the structuring element.

 The structuring element is normally smaller than the image with a 3 × 3 size. This will
ensure faster computation time when compared to larger structuring-element size.

 Almost similar to the dilation process, the erosion process will move the structuring
element from left to right and top to bottom.

 At the centre position, indicated by the centre of the structuring element, the
process will look for whether there is a complete overlap with the structuring
element or not. If there is no complete overlapping then the centre pixel indicated by
the centre of the structuring element will be set white or 0.

 Let us define X as the reference binary image and B as the structuring element.
Erosion is defined by the equation


 Equation states that the outcome element z is considered only when the structuring
element is a subset or equal to the binary image X.

 This process is depicted in Fig. Again, the white square indicates 0 and the black
square indicates 1.

 The erosion process starts at position *. Here, there is no complete overlapping, and
so the pixel at the position * will remain white.
 The structuring element is then shifted to the right and the same condition is
observed. At position **, complete overlapping is not present; thus, the black square
marked with ** will be turned to white.

 The structuring element is then shifted further until its centre reaches the position
marked by ***. Here, we see that the overlapping is complete, that is, all the black
squares in the structuring element overlap with the black squares in the image.
Hence, the centre of the structuring element corresponding to the image will be
black.

 Figure shows the result after the structuring element has reached the last pixel.
Erosion is a thinning operator that shrinks an image. By applying erosion to an image,
narrow regions can be eliminated, while wider ones are thinned.
43. Explain the morphological image operations on an image. (imp)
ANS:-

 Morphological image operations are a set of techniques used in image processing


and computer vision to manipulate and analyze the shape and structure of objects
within an image.
 These operations are based on mathematical morphology, which deals with the
analysis of geometric structures in images.The two fundamental operations in
morphological image processing are dilation and erosion.
 These operations involve the use of a structuring element, which is a small shape or
template that is applied to the image.
1. Dilation: Dilation expands or thickens the shape of an object in an image. It works by
sliding the structuring element over the image and replacing each pixel in the image with the
maximum value of all the pixels covered by the structuring element. This has the effect of
increasing the size of the object or connecting nearby objects.
2. Erosion: Erosion shrinks or thins the shape of an object in an image. It works by sliding
the structuring element over the image and replacing each pixel in the image with the
minimum value of all the pixels covered by the structuring element. This has the effect of
reducing the size of the object or breaking apart connected objects.
 By combining dilation and erosion operations, more advanced morphological
operations can be performed:
3. Opening: Opening is the combination of an erosion followed by a dilation. It helps to
remove small objects and smooth out the boundaries of larger objects. Opening is useful for
removing noise or small details from an image while preserving the overall structure.
4. Closing: Closing is the combination of a dilation followed by an erosion. It helps to close
small gaps in the boundaries of objects and fill in holes or voids. Closing is useful for filling
gaps in objects or joining broken structures.
Morphological image operations are widely used in various applications such as image
segmentation, feature extraction, noise removal, and object detection. They provide
powerful tools for manipulating and analyzing the shape and structure of objects in images.

44. What do you mean by Image Segmentation?


ANS:-

 Image segmentation is a computer vision technique that involves dividing an image


into multiple segments or regions based on certain characteristics, such as color,
texture, or object boundaries.
 The goal of image segmentation is to partition an image into meaningful and
semantically coherent regions to facilitate further analysis and understanding of its
contents.
 In image segmentation, each pixel or group of pixels in an image is assigned a label or
class that corresponds to a particular object or region of interest.
 This process allows for the extraction and identification of individual objects or
regions within an image, which can be useful for various applications such as object
recognition, scene understanding, image editing, medical imaging, autonomous
driving, and more.
Image segmentation can be performed using various techniques, including:
1. Thresholding: Setting a threshold value to separate different regions based on
intensity or color information.
2. Region-based segmentation: Grouping pixels into regions based on similarity in color,
texture, or other features.
3. Edge-based segmentation: Detecting and linking edges or boundaries of objects in an
image.
4. Clustering: Using clustering algorithms like k-means or mean-shift to group pixels
with similar features together.
5. Watershed segmentation: Treating pixel intensities as a topographic landscape and
dividing regions based on watershed lines.
6. Deep learning-based segmentation: Utilizing convolutional neural networks (CNNs)
or other deep learning architectures to learn and predict pixel-level segmentation
masks.
Overall, image segmentation plays a fundamental role in extracting meaningful information
from images and enabling more advanced computer vision tasks by providing a more
detailed understanding of the image's content.
45. Explain the classification of image segmentation techniques.
Ans:- IMAGE SEGMENTATION:

 Image segmentation refers to the process of partitioning an image into groups of


pixels which are homogeneous with respect to some criterion

 Different groups must not intersect with each other, and adjacent groups must be
heterogeneous.

 Segmentation algorithms are area oriented instead of pixel-oriented.


CLASSIFICATION OF IMAGE-SEGMENTATION TECHNIQUES:

 Image segmentation can be broadly classified into two types:


(i) local segmentation, and
(ii) global segmentation.
1. LOCAL SEGMENTATION:

 Local segmentation deals with segmenting sub-images which are small windows
on a whole image.

 The number of pixels available to local segmentation is much lower than global
segmentation.

 Local segmentation must be frugal in its demands for pixel data.


2. GLOBAL SEGMENTATION:

 Global segmentation is concerned with segmenting a whole image.

 Global segmentation deals mostly with segments consisting of a relatively large


number of pixels.

 This makes estimated parameter values for global segments more robust.

 Image segmentation can be approached from three different philosophical


perspectives. They are (i) region approach, (ii) boundary approach, and (iii) edge
approach as illustrated in Fig. 7.1.
 In the region approach, each pixel is assigned to a particular object or region.

 In the boundary approach, the attempt is to locate directly the boundaries that
exist between the regions.

 In the edge approach, the edges are identified first, and then they are linked
together to form required boundaries.

 All the three approaches are useful for visualising the problem and implementing
a solution.

46. Explain clustering technique used for image segmentation.


ANS:- CLUSTERING TECHNIQUES:

 The clustering technique attempts to access the relationships among patterns of the
data set by organising the patterns into groups or clusters such that patterns within a
cluster are more similar to each other than patterns belonging to different clusters.

 Clustering methods can be divided into two categories—hierarchical and partitional.


Within each category, there exist many types of algorithms for finding clusters.

1. HIERARCHICAL CLUSTERING:

 Hierarchical clustering techniques are based on the use of a proximity matrix


indicating the similarity between every pair of data points to be clustered.

 The end result is a tree of clusters representing the nested group of patterns and
similarity levels at which groupings change.

 The resulting clusters are always produced as the internal nodes of the tree, while
the root node is reserved for the entire dataset and leaf nodes are for individual
data samples.

 The two main categories of algorithms used in the hierarchical clustering


framework are agglomerative and divisive.

 Agglomerative algorithms seek to merge clusters to be larger and larger by starting


with N singlepoint clusters.
 The algorithm can be divided into three classes: (i) single-link algorithm, (ii)
complete-link algorithm, and (iii) minimum-variance algorithm.

 Divisive clustering begins with the entire dataset in the same cluster, followed by
iterative splitting of the dataset until the single-point clusters are attained on leaf
nodes.

 It follows a reverse clustering strategy against agglomerative clustering.


2. PARTITIONAL CLUSTERING:

 Partition-based clustering uses an iterative optimisation procedure that aims at


minimising an objective function f, which measures the goodness of clustering.

 A common feature of partition-based clusterings is that the clustering procedure


starts from an initial solution with a known number of clusters.

 The cluster centroids are usually computed based on the optimality criterion such
that the objective function is minimised.

 Algorithms of the first type are further categorised into probabilistic clustering, K-
medoids, and K-means.
3. K-MEANS CLUSTERING:

 The K-means method is the simplest method in unsupervised classification.

 The clustering algorithms do not require training data.

 K-means clustering is an iterative procedure.

 The K-means clustering algorithm clusters data by iteratively computing a mean


intensity for each class and segmenting the image by classifying each pixel in the
class with the closest mean.

 The drawback the K-means algorithm is that the number of clusters is fixed, once K
is chosen and it always returns K cluster centres.
4. Fuzzy Clustering:

 Clustering methods can be classified as either hard or fuzzy depending on


whether a pattern data belongs exclusively to a single cluster or to several
clusters with different degrees.

 In hard clustering, a membership value of zero or one is assigned to each


pattern data, whereas in fuzzy clustering, a value between zero and one is
assigned to each pattern by a membership function.

 Fuzzy clustering seeks to minimise a heuristic global cost function by


exploiting the fact that each pattern has some graded membership in each
cluster.
 The fuzzy K-means algorithm iteratively updates the cluster centroid and
estimates the class membership function by using the gradient descent
approach.

 In general, fuzzy clustering methods can be considered to be superior to


those of their hard counterparts since they can represent the relationship
between the input pattern data and clusters more naturally.
47. Write a note on segmentation methods for point, line and edge detection.
Ans:- edge detection:

 Edge detection is the process of finding meaningful transitions in an image.

 Edge detection is one of the central tasks of the lower levels of image processing.

 The points where sharp changes in the brightness occur typically form the border
between different objects.

 These points can be detected by computing intensity differences in local image


regions.

 Importance of Edge Detection:-

 Edge detection is a problem of fundamental importance in image analysis.

 The purpose of edge detection is to identify areas of an image where a large change
in intensity occurs.

 These changes are often associated with some physical boundary in the scene from
which the image is derived.
48. How is thresholding used in image segmentation?
Ans:- Thresholding:

 Thresholding techniques produce segments having pixels with similar intensities.

 Thresholding is a useful technique for establishing boundaries in images that contain


solid objects resting on a contrasting background.

 There exist a large number of gray-level based segmentation methods using either
global or local image information.

 The thresholding technique requires that an object has homogenous intensity and a
background with a different intensity level.
Types of thresholding used in image segmentation are as follows:
1. Global Thresholding:

 Global thresholding is the simplest and most widely used of all possible
segmentation methods.
 In global thresholding, a threshold value of θ is chosen and the following condition is
imposed:


 Global thresholding will suffer when pixels from different segments overlap in their
use of intensities. If the overlap is due to variation in illumination across the image,
variable thresholding could be used.
2. Adaptive Thresholding:

 Global thresholding, or fixed thresholding, works well if the objects of interest have
a reasonably uniform interior gray level and rest on a background of unequal but a
relatively uniform gray level.

 In many cases, the background gray level is not constant, and object contrast varies
within an image.

 In such cases, a threshold that works well in one area might not work well in other
areas of the image.
3. Limitation of Thresholding Technique:

 The main limitation of thresholding techniques is that in its simplest form, only two
classes are generated and it cannot be applied to multi-channel images.

 A thresholding technique does not take into account the spatial characteristics of an
image
49 explain various edges detected in segmentation process ,
Ans:-
In image processing, edge detection is a fundamental step in segmentation, which aims
to partition an image into meaningful regions or objects. Edge detection algorithms
identify abrupt changes in intensity or color within an image, indicating the presence of
object boundaries or edges. There are several types of edges that can be detected in the
segmentation process:
1. Step Edges: Step edges are the most basic type of edges and occur when there is a
sudden change in intensity or color between adjacent regions in an image. These edges
have a distinct, discontinuous transition from one intensity level to another.
2. Ramp Edges: Ramp edges represent a gradual change in intensity or color. Unlike step
edges, ramp edges have a smooth transition from one region to another. They often
occur in textured areas or surfaces with varying reflectance.
3. Roof Edges: Roof edges are formed by a combination of step and ramp edges. They
typically occur when there is an abrupt change in the intensity or color, followed by a
gradual transition. Roof edges are commonly observed at object boundaries or edges
with a gradient.
4. Ridge Edges: Ridge edges are characterized by a series of parallel lines or contours.
They often occur in textured regions with repeated patterns or structures, such as
fabrics or natural scenes with repetitive elements.
5. Line Edges: Line edges are straight or curved lines detected within an image. They can
represent various objects or structures with linear features, such as roads, edges of
buildings, or outlines of objects.
6. Corner Edges: Corner edges occur at the intersection of two or more edges. They
represent points where intensity or color changes occur in multiple directions, indicating
the presence of corners or junctions in an image.
7. Junction Edges: Junction edges are formed at the convergence or divergence points
of multiple edges. They typically occur when three or more edges intersect,
representing complex geometrical structures or objects with intersecting boundaries.
These are some of the common types of edges detected during the segmentation
process in image processing. Edge detection algorithms aim to locate and highlight
these edges to facilitate subsequent segmentation tasks, such as region growing,
contour tracing, or object recognition.
50. Write short notes on i) segmentation by region splitting and merging ii) opening.
Ans:- 1.Segmentation by region splitting:

 Region splitting and merging is an image-segmentation technique that takes spatial


information into consideration. The region-splitting-and-merging method is as
follows:
 SPLITTING:
1. Let R represent the entire image. Select a predicate P.
2. Split or subdivide the image successively into smaller and smaller quadrant regions.
The splitting technique has a convenient representation in the form of a structure called
a quadtree as shown in Fig. 7.2. In a quadtree, the root of the tree corresponds to the
entire image and each node corresponds to a subdivision.
 The final partition is likely to contain adjacent regions with identical properties. This
drawback may be fixed by applying merging, and merging only adjacent regions
whose combined pixels satisfy the predicate P.
 MERGING:

 Merge any adjacent regions that are similar enough.

 The procedure for split and merge algorithm is given below:


1. Start with the whole image.
2. If the variance is too large, break it into quadrants.
3. Merge any adjacent regions that are similar enough.
4. Repeat steps (2) and (3) iteratively until no more splitting or merging occurs.

Q51. Define segmentation. State different methods based on similarity. Explain any
one method with example.
Ans:-
Segmentation in image processing refers to the process of partitioning an image into
meaningful and semantically coherent regions or objects. The goal is to separate the
image into distinct regions based on certain criteria such as color, texture, intensity, or
other visual properties.
There are several methods for image segmentation based on similarity:
1. Thresholding: This method involves selecting a threshold value and classifying pixels
as either foreground or background based on their intensity values. It is a simple and
commonly used method for segmenting grayscale or binary images.
2. Region Growing: Region growing methods start with seed pixels or regions and
iteratively expand them based on similarity criteria. Pixels or regions are added to
the growing region if they meet certain similarity conditions, such as intensity or
color similarity, texture consistency, or spatial proximity.
3. Clustering: Clustering methods group pixels into clusters based on their similarity in
feature space. Popular clustering algorithms such as k-means, mean-shift, or
Gaussian mixture models can be used for segmentation. Pixels within the same
cluster are considered to belong to the same region.
One example of an image segmentation method is the k-means clustering algorithm.
The k-means algorithm is an unsupervised learning technique that partitions data points
into k clusters based on their feature similarity. In the context of image segmentation,
each pixel in the image is considered as a data point with its feature vector, which can
include color values or other image attributes.
Here's a step-by-step explanation of how k-means segmentation works:
1. Choose the number of clusters, k, that you want to segment the image into.
2. Initialize k cluster centroids randomly in the feature space
3. Assign each pixel to the nearest centroid based on its feature similarity
4. Recalculate the centroids by computing the mean feature vector of all pixels assigned
to each centroid.
5. Repeat steps 3 and 4 until convergence or a specified number of iterations.
6. Once convergence is reached, assign each pixel to the cluster represented by its
nearest centroid.
The resulting segmentation map will have k distinct regions corresponding to the k
clusters found by the algorithm. Each pixel will be assigned a label representing its
cluster or region membership.
For example, in an image of a fruit bowl, k-means segmentation can be used to separate
the fruits into different clusters based on their color or other features. The algorithm
will group similar-colored pixels together, resulting in distinct regions corresponding to
each type of fruit in the image.
52. Describe Image Segmentation using Snakes.
ANS:-

 A promising image-analysis tool for refinement of an object boundary is the active


contour or snake.

 The curve formed by the connected edge points delineates the active contour.

 It is a set of connected points which interactively move so as to minimise a specified


energy function.

 Local properties of the image such as gray level, gradient, etc., contribute to the
energy of the snake.

 The snake reacts to the image, but moves in a smooth continuous manner towards
the desired object boundary.
 The choice of the energy function to be minimised determines the behaviour of the
algorithm.

 Given the parametric representation of the snake v s x s y s ( ) ( ( ), ( )) = where s ε [ , ]


0 1 , the energy function is given by:-

 Thus, the energy of the snake corresponds to three different forces:

 (i) Internal forces between points of the contour

 (ii) Image forces such as gray level and gradient magnitude that pull the snake
towards the optimal boundary position

 (iii) External constraints such as user forces applied to the contour The internal
energy of the snake can be modeled using two terms:

 The main advantages of the greedy-snake algorithm are computational efficiency and
relative simplicity.

 The two main drawbacks of snake formation are the following:


(i) Poor convergence property of the active contours—specifically, concavities in the
object of interest are rarely covered.
(ii) The second problem with snakes is the limited capture range, which is related to
the initialisation of the snake around the object of interest
53) List the advantages of performing watermarking in the frequency domain.
ANS:-
Imperceptibility: The watermark can be embedded in the frequency coefficients of
the image without significantly affecting the visual quality of the image.
 Robustness: The watermark can be more robust to attacks such as image
compression, cropping, and rotation when it is embedded in the frequency domain.
 Capacity: The watermark can be embedded with more data in the frequency domain
than in the spatial domain.
 Security: The watermark can be more secure when it is embedded in the frequency
domain, as it is more difficult to extract the watermark from the frequency
coefficients.
Here are some additional details about each of these advantages:
 Imperceptibility: The human visual system (HVS) is more sensitive to changes in the
spatial domain than in the frequency domain. This means that small changes in the
frequency coefficients of an image are less likely to be noticeable to the human eye.
 Robustness: Attacks such as image compression, cropping, and rotation can cause
changes to the spatial coefficients of an image. However, these attacks often have
less of an impact on the frequency coefficients of an image. This is because the
frequency coefficients represent the overall structure of the image, while the spatial
coefficients represent the details of the image.
 Capacity: The frequency coefficients of an image contain more information than the
spatial coefficients. This is because the frequency coefficients represent the overall
structure of the image, while the spatial coefficients represent the details of the
image. As a result, more data can be embedded in the frequency domain than in the
spatial domain.
 Security: The frequency coefficients of an image are more difficult to access than the
spatial coefficients. This is because the frequency coefficients are often stored in a
compressed format. As a result, it is more difficult for an attacker to extract the
watermark from the frequency coefficients.
Overall, there are a number of advantages to performing watermarking in the frequency
domain. These advantages include imperceptibility, robustness, capacity, and security.
54.Explain Edge Detection.
ANS:-
1.Edge detection is a fundamental technique in image processing and computer vision
that aims to identify and highlight the boundaries between objects or regions of
differing intensities in an image.
2.It plays a crucial role in various applications, including object recognition, image
segmentation, and feature extraction. Edge detection algorithms analyze the intensity
gradients or discontinuities in an image to detect these boundaries.
3.The first step in edge detection is to compute the intensity gradient of the image. The
intensity gradient represents the rate of change in pixel intensity values across the
image.
4.The gradient magnitude represents the strength of the edge, while the gradient
direction indicates the orientation of the edge.
5.thresholding is often applied to classify the gradient values as edge or non-edge
pixels. A threshold is set to determine the minimum gradient magnitude required for a
pixel to be considered part of an edge.
6.edge localization is performed to refine the detected edges and obtain more precise
boundaries. This process involves analyzing the gradient direction and neighboring
pixels to determine the exact position of the edges.
7.Once the edges are detected and localized, they can be represented in different ways
depending on the application. The most common representation is a binary image,
where edge pixels are set to white and non-edge pixels to black. Alternatively, edges can
be represented as a set of connected curves or a pixel-wise gradient map, indicating the
strength of the edges at each location.
8.edge detection is a challenging task due to factors like noise, varying illumination, and
image artifacts. The choice of edge detection algorithm and parameter settings can
significantly impact the results.
9.Different edge detection methods may be more suitable for specific types of images or
applications. Therefore, it is common to experiment with different algorithms and fine-
tune the parameters to achieve optimal edge detection results.
10.edge detection is a vital technique in image processing that involves identifying and
highlighting boundaries between regions of differing intensities in an image. By
analyzing the intensity gradients or discontinuities, edge detection algorithms enable
the extraction of essential features for further analysis, segmentation, or object
recognition tasks.
Q. 56 Write a short note on SIFT.
ANS:-
SIFT (Scale-Invariant Feature Transform) is a popular technique in digital image
processing and computer vision for detecting and describing local features in images. It
was developed by David Lowe in 1999 and has since become widely used in various
applications such as object recognition, image stitching, and 3D reconstruction. SIFT
addresses the challenge of finding robust and distinctive features that are invariant to
changes in scale, rotation, and illumination.
Here are some key points about SIFT:
1. Scale Space Extrema Detection: SIFT begins by constructing a scale space
representation of an image by applying Gaussian blurring and downsampling. This
scale space is used to identify potential interest points, or keypoints, at different
scales. Keypoints are detected by searching for local extrema in the difference of
Gaussian (DoG) images, which are obtained by subtracting adjacent scales in the
scale space pyramid.

2. Keypoint Localization: Once keypoints are detected, SIFT applies a process called
keypoint localization to accurately localize the keypoints. This involves fitting a 3D
quadratic function to the nearby samples in the scale space to refine the keypoint
positions and reject low-contrast keypoints and keypoints located on edges.
3. Orientation Assignment: SIFT assigns an orientation to each keypoint to achieve
rotation invariance. It computes a gradient orientation histogram in the
neighborhood of the keypoint and selects the dominant orientation as the keypoint's
orientation. This allows SIFT to handle images with arbitrary rotations.

4. Descriptor Extraction: After the keypoints are localized and assigned orientations,
SIFT constructs a descriptor for each keypoint that captures its local appearance and
is invariant to changes in scale, rotation, and illumination. The descriptor is
computed by taking the gradient magnitudes and orientations in the keypoint's local
region and forming a histogram of oriented gradients (HoG). This histogram is then
normalized to ensure invariance to changes in illumination.

5. Matching and Robustness: SIFT descriptors can be compared to establish


correspondences between keypoints in different images. Matching can be performed
using techniques like nearest neighbor matching and applying a distance ratio test to
ensure robustness against potential ambiguities. The matched keypoints can then be
used for tasks such as object recognition, image alignment, or 3D reconstruction.

You might also like