0% found this document useful (0 votes)
61 views10 pages

Digital Image Processing Geometric and Shape Properties of The Regions

The document provides an overview of common geometric and shape properties that are used to characterize shapes and structures in image processing and computer vision. It describes properties like area, centroid, perimeter, circularity, elongation, bounding box, and second order moments. Methodologies for extracting each property from a binary image containing a sample rectangle are also presented.

Uploaded by

asadafredee
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
61 views10 pages

Digital Image Processing Geometric and Shape Properties of The Regions

The document provides an overview of common geometric and shape properties that are used to characterize shapes and structures in image processing and computer vision. It describes properties like area, centroid, perimeter, circularity, elongation, bounding box, and second order moments. Methodologies for extracting each property from a binary image containing a sample rectangle are also presented.

Uploaded by

asadafredee
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Digital Image Processing

Geometric and Shape Properties Of The Regions


Asad Ullah
May 2024

1 Introduction
Geometric features play a crucial role in characterizing shapes and structures
in various fields such as image processing, computer vision, and pattern recog-
nition. This report aims to provide an overview and analysis of key geometric
features commonly used in these domains.

2 Geometric and Shape Properties


• Area: The area of a shape represents the extent or size of the region
enclosed by its boundary.
• Centroid: The centroid is the center of mass of a shape, often used as a
reference point for various spatial calculations.
• Perimeter: The perimeter of a shape is the total length of its boundary.
• Perimeter Length: This refers to the length of the perimeter itself,
which is a significant metric in understanding the shape’s boundary com-
plexity.
• Circularity: Circularity measures how closely an object resembles a per-
fect circle, typically calculated as the ratio of the area to the square of the
perimeter.
• Elongation: Elongation quantifies the degree of stretching or elongation
of a shape along its principal axes.
• Mean and Standard Deviation of Radial Distance: These metrics
describe the average distance of points within a shape from its centroid,
providing insights into its overall spread or compactness.
• Bounding Box: The bounding box is the smallest rectangular box that
completely encloses the shape, characterized by its dimensions and orien-
tation.

1
• Extremal Axis Length from Bounding Box: This feature measures
the length of the longest diagonal within the bounding box, providing an
indication of the shape’s overall size.
• Second Order Moments: These moments describe the distribution of
mass or intensity within a shape and are used to calculate parameters such
as orientation and eccentricity.
• Lengths and Orientations of Axes of Best-Fit Ellipse: This feature
involves fitting an ellipse to the shape and analyzing its major and minor
axes, providing valuable information about the shape’s orientation and
elongation.

3 Utilized Image
A single binary image containing a rectangle was utilized as the basis for im-
plementing and evaluating the extraction of geometric properties. This section
provides details about the utilized image and its characteristics.

3.1 Image Description:


• Object: A single rectangular object present in the binary image. Dimen-
sions: The dimensions of the rectangle were carefully chosen to ensure
variability and comprehensiveness in evaluating the extraction of geomet-
ric properties.
• Background: The background of the image was set to zero (black), while
the object was represented by non-zero pixel values (white).

• Resolution: The image resolution was set to a suitable value to ensure


accurate computation of geometric properties.
• Format: The image was saved in a standard format compatible with
image processing libraries such as PNG or JPEG.

3.2 Image Representation:


• The rectangular object in the binary image was represented by connected
pixels forming its boundary.
• Each pixel belonging to the object was assigned a non-zero value to dis-
tinguish it from the background pixels.

3.3 Image Visualization:


A visual representation of the binary image containing the rectangle object is
provided below:

2
Figure 1: Rectangle Object

4 Methodology
4.1 Area
• Utilize a binary image containing objects, where the object of interest is
represented by non-zero pixel values (foreground).
• Initialize area variable to zero.
• Iterate through each pixel in the binary image.
• the pixel value is non-zero, increment area by one.
• Final area value represents the total object area.

4.2 Centroid
• Iterate through each pixel in the binary image.
• If the pixel value is non-zero:
• Increment sum x by the x coordinate of the current pixel.
• Increment sum y by the y coordinate of the current pixel.
• Calculate the centroid coordinates:
PN
• Centroid x = A1 i=1 xi
PN
• Centroid y = A1 i=1 yi
• The centroid coordinates (Centroid x, Centroid y) represent the center of
mass of the object in the binary image.

3
4.3 Perimeter
• Apply the erosion operation to the binary image using a suitable struc-
turing element, such as a 3x3 or 5x5 square.
• Subtract the eroded image from the original binary image to obtain the
boundary pixels of the object.
• The resulted image will contain the perimeter of the object

4.4 Perimeter Length


• Use the perimeter image containing object perimeter only, where the
perimeter of is represented by non-zero pixel values (foreground).
• Initialize a variable perimeter length to zero.
• Iterate through each pixel in the binary image.

• If the pixel value is non-zero:


• Check the neighboring pixels (8-connectivity) to determine if the current
pixel is part of the object boundary.
• If
√ any neighboring pixel has a zero value, increment perimeter length by
2.
• The final value of perimeter length represents the total perimeter length
of the object in the binary image.

4.5 Circularity
• Calculate the area, A, and the perimeter, P, of the object using the pre-
viously described methods.
|p2 |
• Compute the circularity using the formula: C = A

4.6 Elongation
• Identify coordinates of object pixels in the binary image.
• Determine the minimum and maximum coordinates of the object.
• Compute lengths of the minimum and maximum coordinates.

• Find the ratio of minimum and maximum coordinate lengths.

4
4.7 Mean and Standard Deviation of Radial Distance
• Calculate the radial distance of each object pixel from the centroid;
• Calculate the mean of the radial distances.

• Calculate the standard deviation of the radial distances.

4.8 Bounding Box


• Determine the coordinates of the pixels belonging to the object(s) in the
binary image.
• Compute the minimum and maximum coordinates of the object pixels
along the x and y axes.
• Use the minimum and maximum coordinates to calculate the dimensions
(width and height) of the bounding box.

• Construct the bounding box using the minimum and maximum coordi-
nates.
• Optionally, visualize the bounding box overlaid on the original image for
verification or analysis.

4.9 Extremal Axis Length From Bounding Box


• Determine the bounding box of the object(s) in the binary image using
the minimum and maximum coordinates.

• Measure the length of the longest and shortest axes of the bounding box.
• Determine which edges of the bounding box correspond to the longest and
shortest axes.
• Extract the lengths of the extremal axes from the bounding box dimen-
sions.

4.10 Second Order Moment


• Step 1: Find Object Pixels Indices: Identify the indices of pixels
corresponding to the objects in the binary image. These are pixels with a
value of 1.
• Step 2: Calculate Second-Order Moments: Compute the second-
order moments with respect to the origin:
– Row Moment (a′ ): Square the column indices of object pixels and
sum them.

5
– Column Moment (b′ ): Square the row indices of object pixels and
sum them.
– Mixed Moment (c′ ): Multiply the row and column indices of object
pixels element-wise and sum them.
• Step 3: Calculate Object Center: Compute the object center by
taking the average of x and y coordinates of the object pixels.
• Step 4: Calculate Total Number of Object Pixels: Determine the
total number of object pixels, which represents the object area.
• Step 5: Adjust Moments with Respect to the Center: Adjust the
calculated moments with respect to the object center:
– Row Moment (a): Subtract the squared center x-coordinate mul-
tiplied by the total number of object pixels from a′ .
– Column Moment (b): Subtract the squared center y-coordinate
multiplied by the total number of object pixels from b′ .
– Mixed Moment (c): Subtract the product of the center x-coordinate
and center y-coordinate multiplied by the total number of object pix-
els from c′ .

4.11 Lengths and Orientation of Axes of Best-Fit Ellipse


• Step 1: Calculate Common Term: Compute the common term using
the second-order moments (a, b, c):
p
Common Term = (a − b)2 + 4c2

• Step 2: Calculate Major Axis Length: Determine the length of the


major axis (a1 ) of the best-fit ellipse:
p
Major Axis Length = 2(a + b + Common Term)

• Step 3: Calculate Minor Axis Length: Determine the length of the


minor axis (b1 ) of the best-fit ellipse:
p
Minor Axis Length = 2(a + b − Common Term)

• Step 4: Calculate Orientation Angle: Compute the orientation angle


(θ) of the major axis relative to the x-axis:
1
Orientation Angle = × atan2(2c, a − b)
2

• Step 5: Convert Orientation Angle: Convert the orientation angle


from radians to degrees.

6
5 Results
5.1 Area
• The area of the rectangle in binary image is 18352 in term of pixels

5.2 Centroid
• The centroid of the rectangle object is;
– Centroid x: 127.5
– Centroid y: 127.5
and as shown in Figure.2

5.3 Perimeter
• The Perimeter of the Rectangle object is shown in Figure.3

5.4 Perimeter Length


• The Length of the perimeter of the Rectangle object is 392

5.5 Circularity
• The circularity of the rectangle in the image we use is 0.1194
• As the circularity value is near to zero this means that the object is far
from circle shape.

5.6 Elongation
• The Elongation is 1.6849 so it means that one of the axis is greater than
the other.
• This value show that the object is a rectangle object

5.7 Mean and Standard Deviation of Radial Distance


• The Mean of the radial distance is;
– mean r = 29.7040
– mean c = 42.2040
• The Standard Deviation of the radial distance is;
– std r = 10.9170
– std c = 20.4646
• These values are row-wise and column-wise respectively

7
Figure 2: Centroid

5.8 Bounding Box


• The Bounding Box of the rectangle object given in the binary image is
shown in Figure.4

5.9 Extremal Axis Length From Bounding Box


• The extremal axis length frm the bounding box which encloses the rect-
angle shown in Figure.4 is 123.

• This value show the width of the bounding box as it has greater width
than height

5.10 Second Order Moment


5.10.1 Column order moment
The column order moment of the rectangle is 11756750.0

5.10.2 Row order moment


The row order moment of the rectangle object is 4186550.0

5.10.3 Mixed order moment


The mixed order moment is 0.0

• Now these values shows that the column moment is greater than the row
moment so there will be less effort during row moment of the object than
column.

8
Figure 3: Perimeter

Figure 4: Bounding Box

9
• The mixed moment is zero because the distribution of pixels to the left
and right of the centroid, as well as above and below it, is equal.

5.11 Lengths And Orientations Of Axes Of Best-Fit El-


lipse
• The lengths of the axes of best-fit ellipse are;

– major axis = 6857.6234


– minor axis = 4092.2121
• The orientation of the axes of the best-fit ellipse is 0.0
• Orientation angle of zero for a best-fit ellipse of a rectangle object signifies
that the rectangle is aligned with one of the coordinate axes and does not
require rotation for fitting into the ellipse.

6 Conclusion
• Our task involved examining the shapes and geometric properties of ob-
jects within binary images—images where everything is either black or
white. We scrutinized properties such as size, position, and overall shape
of these objects.
• By gauging these properties, we acquire insights into the distinct features
of each object. For example, we can discern whether an object is more
elongated or more circular compared to others in the image. This type
of analysis aids in accurate identification and categorization of objects,
which holds significance for various applications like object detection in
autonomous vehicles or cell segmentation in biomedical imaging.
• Our task establishes a robust foundation for future endeavors in image
analysis. These methodologies can be implemented across diverse fields
where comprehending the shapes and structures in images is paramount.
Ultimately, our efforts contribute to enhancing the capabilities of image
processing techniques, fostering more precise and efficient analysis in a
multitude of domains.

10

You might also like