Unit 3

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 55

Unit 3

MODULE 3: (9 hrs)

Pixel classification; Grey level thresholding, global/local thresholding;

Optimum thresholding - Bayes analysis, Otsu method; Derivative based edge detection

operators, edge detection/linking, Canny edge detector; Region growing, split/merge techniques,

line detection, Hough transform.


• Image thresholding involves dividing an image into two or more
regions based on intensity levels, allowing for easy analysis and
extraction of desired features.
• By setting a threshold value, pixels with intensities above or below
the threshold can be classified accordingly This technique aids in tasks
such as object detection, segmentation, and image enhancement.
Global Thresholding

• Global Thresholding is a widely used technique where a single


threshold value is applied to an entire image.
• However, this technique may not be suitable for images with varying
lighting conditions or complex backgrounds.
• To overcome this limitation, adaptive thresholding techniques may be
employed, which adjust the threshold value locally based on the
characteristics of each pixel's neighborhood.
• These techniques are particularly useful in scenarios where there is
significant variation in illumination across different regions of the
image.
• Otsu’s method, introduced in 1979, has become an extremely popular
approach to determining a threshold.
• It’s commonly described, somewhat intimidatingly, as ‘minimizing the
intra-class intensity variance’.
• In essence, calculating a threshold using Otsu’s method involves
adding the variance of the background pixels to the variance of the
foreground pixels, for all possible thresholds.
• The threshold that is selected is the one for which the sum of the
variances is smallest.
• Otsu's Method for Automatic Threshold Determination is a widely
used technique for automatically determining the optimal threshold
value in image segmentation.
• It calculates the threshold by maximizing the between-class variance
of pixel value, which effectively separates foreground and
background regions.
• This method is particularly useful when dealing with images that have
bimodal or multimodal intensity distributions, as it can accurately
identify the threshold that best separates different objects or regions in
the image.
Picking T as Threshold as 2
• Derivative based edge detection
Morphological transformations
• Morphological transformations are some simple
operations based on the image shape.
• It is normally performed on binary images. It needs
two inputs, one is our original image, second one is
called structuring element or kernel which
decides the nature of operation.
• Two basic morphological operators are Erosion and
Dilation. Then its variant forms like Opening,
Closing, Gradient etc also comes into play.
Erosion

• The basic idea of erosion is just like soil erosion only, it erodes
away the boundaries of foreground object (Always try to keep
foreground in white).
• The kernel slides through the image (as in 2D convolution). A
pixel in the original image (either 1 or 0) will be considered 1
only if all the pixels under the kernel is 1, otherwise it is eroded
(made to zero).
• All the pixels near boundary will be discarded depending upon
the size of kernel.
• So the thickness or size of the foreground object decreases or
simply white region decreases in the image.
• It is useful for removing small white noises (as we have seen in
colorspace chapter), detach two connected objects etc.
• Dilation and Erosion are basic morphological processing operations that
produce contrasting results when applied to either gray-scale or binary
images.

Dilation:
Dilation is the reverse process with regions growing out from their boundaries.
Dilation is A XOR B.
Erosion:
Erosion involves the removal of pixels ate the edges of the region.
Erosion is just the dual of Dilation.
Dilation Erosion

It increases the size of the objects. It decreases the size of the objects.

It fills the holes and broken areas. It removes the small anomalies.

It connects the areas that are separated by space smaller than structuring It reduces the brightness of the bright objects.
element.

It increases the brightness of the objects. It removes the objects smaller than the structuring element.

Distributive, duality, translation and decomposition properties are followed. It also follows the different properties like duality etc.

It is XOR of A and B. It is dual of dilation.

It is used prior in Closing operation. It is used later in Closing operation.

It is used later in Opening operation. It is used prior in Opening operation.


• Dilation
• Dilation is a morphological operation that expands the boundaries of
an object in an image. This is done by convolving the image with a
structuring element, which determines the size and shape of the
dilation. The output of the dilation operation is a new image where the
pixels in the original image are expanded or dilated.
• 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.
• 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.
• It is just opposite of erosion. Here, a pixel element
is '1' if at least one pixel under the kernel is '1’.
• So it increases the white region in the image or
size of foreground object increases. N
• ormally, in cases like noise removal, erosion is
followed by dilation. Because, erosion removes
white noises, but it also shrinks our object.
• So we dilate it. Since noise is gone, they won't
come back, but our object area increases. It is also
useful in joining broken parts of an object.
•Properties:
•It can repair breaks
•It can repair intrusions
Erosion

• Erosion is a morphological operation that shrinks the boundaries of an


object in an image. This is done by convolving the image with a
structuring element, which determines the size and shape of the
erosion. The output of the erosion operation is a new image where the
pixels in the original image are eroded or shrunk
• 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
x 3 size.
Working of erosion:

1.A kernel(a matrix of odd size(3,5,7) is convolved with the image.


2.A pixel in the original image (either 1 or 0) will be considered 1 only
if all the pixels under the kernel are 1, otherwise, it is eroded (made to
zero).
3.Thus all the pixels near the boundary will be discarded depending
upon the size of the kernel.
4.So the thickness or size of the foreground object decreases or simply
the white region decreases in the image.
• Structuring Element
• The structuring element is a binary image that is used to probe an image to find the
region of interest. They are defined by their size, which determines the neighbourhood
around each pixel. They can have different shapes, such as squares, rectangles, circles,
or custom shapes. For example, if we want to detect a simple line in an image, we can
create a linear structuring element in this case.
• Fit: In this case, all pixels of the structural element completely overlap the object's
pixels.

• Hit: In this case, at least one pixel of the structural element overlaps the object's pixels.

• Miss: In this case, not a single pixel of structural element overlaps the object's pixel.
Opening
• Opening is just another name of erosion followed
by dilation.
Closing

• Closing is reverse of Opening, Dilation followed by


Erosion. It is useful in closing small holes inside the
foreground objects, or small black points on the
object.

You might also like