Você está na página 1de 38

CSE585/EE555: Digital Image Processing II

Computer Project #2:

The Morphological Skeleton and Shape Analysis

Timothy Hackett, Kenrick Dacumos, Matthew McTaggart

Date: 02/17/2017

A. Objectives

This purpose of this project is to understand the morphological skeleton and shape
analysis on various binary images. The objectives of the project are:
• Perform morphological skeletons on the “penn256.gif” and “bear.gif” binary
threshold images.
• To partially reconstruct the original binary threshold images from the skeleton
subsets for structuring element radius levels 2, 3 and 4 for a square, rhombus
and VEC045 structuring elements.
• Isolate the four objects in “match1.gif” and compute their size distributions,
pecstrums, and complexities.
• Isolate the rotated versions of the “match1.gif” objects in “match3.gif” and
use pecstral analysis to find the object in “match3.gif” that most closely
“matches” the spade in “match1.gif”
B. Methods

All of the objectives are dependent on the previously created erosion.m, dilation.m,
closing.m, opening.m, funOr.m, funNot.m and funAnd.m MATLAB functions. These
functions are used for binary threshold images. The erosion of an image by a
structuring element is the pixels in which the structuring element is contained within
the image. The dilation of an image by a structuring element is the pixels in which the
structuring element hits the image. The closing of an image by a structuring element
is an erosion followed by a dilation operation with the same structuring element. The
opening of an image by a structuring element is a dilation followed by an erosion
operation with the same structuring element. The funOr, funNot, and funAnd behave
the same as the logical OR, NOT, and AND operations for binary images.

Part 1
The first objective of the project was to create the skeleton images of both the
“penn256.gif” and “bear.gif” using 3x3 pixel square, rhombus, and VEC045
structuring elements. Before the skeleton can be computed, the “penn256.gif” and
“bear.gif” images must be binary threshold such that black is the background and
white is the foreground. Each image was binary threshold to 8bits so that the results
can be saved to .gif images. The MATLAB function for this is binthreshold.m. The
function’s arguments include the input image and the bit level to set the foreground
to. In this project the bit level was set to 8 so that the foreground has a gray level of
255.
The structuring elements (radius 1) used for the skeleton images are as follows:
Square:
1 1 1
[1 1 1] ∗ 255
1 1 1
Rhombus:
0 1 0
[1 1 1] ∗ 255
0 1 0
VEC045:
0 0 1
[0 1 0] ∗ 255
0 0 0

With the structuring element and binary threshold images, the skeleton can be
computed. The algorithm is shown below.

𝑠𝑘(𝑋) = ⋃ 𝑆𝑛 (𝑋)
0≤𝑛≤𝑁

𝑆𝑛 (𝑋) = (𝑋 ⊖ 𝑛𝐵) − (𝑋 ⊝ 𝑛𝐵)𝐵

The skeleton is the union of all the skeletal subsets. The skeletal subsets are the
collection of points for each radius of the structuring element (nB) that just fits in the
foreground of the binary threshold images. The maximum radius (N) is chosen to be
one less that the radius of the structuring element that erodes the original binary
threshold image to the NULL set. This is implemented using the MATLAB
“skeleton.m” function.
The skeleton.m function’s arguments are the binary threshold image, the radius 1
structuring element (B), bit level of operation, and whether black or white is defined
as the foreground. The output of the function is the skeleton image, the skeleton
subsets for each radius, the maximum radius used to find the skeleton, and the
structuring element that corresponds with the maximum radius.

The first step of the skeleton.m function is the find the largest structuring element that
does not erode the binary threshold image to the NULL set. This function assumes
that the user enters radius 1 for the specified structuring element. The radius of the
structuring element is incremented and decremented by dilated and eroding the
varying structuring element by the radius 1 structuring element, respectively.
The second step of the skeleton.m function is to compute the skeletal subsets for radii
1 to maximum. The skeleton subset for each radius is calculated from the set
difference between the “erosion of the binary image with specified radius structuring
element” and the opening of “erosion of the binary image with specified radius
structuring element” with the radius 1 structuring element. The final skeleton image is
the union of all these subsets. It is important to note that the function is defined such
that the lowest index of the skeletal subset, corresponds to the largest value of the
radius for the structuring element, and vice versa.

The second objective is to partially reconstruct the binary image by specifying the
lower bound (level), k, for the reconstruction. The following equation shows the
algorithm.

𝑋𝑘𝐵 = ⋃ 𝑆𝑛 (𝑋)⨁𝑛𝐵, 𝑘 ≥ 0
𝑘≤𝑛≤𝑁

This algorithm is defined in the skeletonrecon.m function. The arguments for this
function is the skeleton subsets, maximum radius, reconstruction level, maximum
radius structuring element, bit level of operation, and whether white or black is the
foreground for the binary threshold images. As expected, the inputs for this function
is closely tied with the outputs of the skeleton.m function. The output of the
skeletonrecon.m function is partial reconstruction for the level that the user specified.
Due to the skeleton subsets being in decreasing order, the skeletonrecon.m function
iterates from 1 to (maximum radius – level) + 1, to represent the k≤n≤N bound.

The reconstructed image is the union of all the skeleton subsets dilated with the
structuring element of the corresponding radius. More specifically, reconstruction of
maximum radius is the points included in the maximum radius skeleton subset dilated
with the maximum radius structuring element. The union is user specific from the
lower bound (level) to the fixed upper bound of maximum radius.
To execute the skeleton and partial reconstruction, the user should run the “main1.m”
script in the MATLAB directory. Below is the general hierarchy of the flow of part 1.

main1.m

skeletonrecon.m skeletonrecon.m skeletonrecon.m


binthreshold.m skeleton.m
with square with rhombus with vec045

ImPennTh SkelPennS SkelReconPennS2 SkelReconPennR2 SkelReconPennV2

ImBearTh SkelPennR SkelReconPennS3 SkelReconPennR3 SkelReconPennV3

SkelPennV SkelReconPennS4 SkelReconPennR4 SkelReconPennV4

SkelBearS SkelReconBearS2 SkelReconBearR2 SkelReconBearV2

SkelBearR SkelReconBearS3 SkelReconBearR3 SkelReconBearV3

SkelBearV SkelReconBearS4 SkelReconBearR4 SkelReconBearV4


Part 2
The third objective of the project was to first identify the four objects in “match1.gif”
by finding the minimum bounding box around each object and then to compute their
size distributions, pecstrums, and complexities. This objective is completed by
running “main2a.m”. The minimum bounding box is the smallest rectangle (in area)
that contains the entire object to be isolated. This was achieved by using “MBR.m”
after loading in “match1.gif” using “imread”. This function finds the connected
component labels using the built-in MATLAB function “bwlabel”. By filtering
through these labels for the unique labels, “MBR.m” finds the (row,column) indices
of the four corners of the minimum bounding rectangle for each unique object.

With the corner indices of each object in “match1.gif”, the next step is to separate the
objects into their own arrays, which is done using “separateObjects.m”. This function
takes in the input image, the bounding box indices for each object, the amount of
background padding that should be applied to the extracted object, and a filename
label for all exported plots. Using the bounding box corners, the function extracts
each object and pads each side according to its supplied parameter, saves the isolated
images, and returns them to the parent function.

Before the size distributions of the isolated objects can be computed, the structuring
elements need to be generated. This is completed using
“createStructuringElements.m”. This function takes in the array of isolated objects
and a filename label for all exported plots. It then creates a 3x3 white rectangle on a
black background. The structuring element is padded with black to the same size
(rounded to the nearest odd dimensions) as the object image that it will be operated
on. The reason for this padding is so that when the structuring element is dilated with
itself during the size distribution computation, the structuring element image does not
have to be resized on each iteration. After generating the structuring elements for
each object, the function saves and returns them to the parent function.
With the objects isolated and the structuring elements created, the size distribution of
each object can be calculated. Using the equations presented in Lecture 6, the size
distribution (granulometery) of an object X is:
𝑈(𝑛) = 𝑚(𝑋𝑛𝐵 ) , 𝑛 ∈𝑍≥0
where XnB is the opening of X by nB and m(XnB) is the area of XnB. nB is the dilated
version of B by n times. To compute the size distribution, m(XnB) is computed for
each integer n starting at 0. When m(XnB)=0 (the area of XnB is 0), the algorithm stops
as all values of n after this point will result in a black image with area 0. The function
“computeSizeDistribution.m” executes this algorithm. It takes in the objects to be
processed, their respective structuring elements, and a filename label for exported
images. Until the object becomes black (area is 0), the function dilates B to the
appropriate size, finds the opening of the object by the dilated structuring element,
finds the area of the opened image (using “find_area.m”), records the area and the
side length of the structuring element used, and saves the image. It completes these
steps for each object supplied to the function. “find_area.m” takes in an image with
its type (white foreground or black foreground) and counts the number of pixels with
the foreground color. Because the structuring element is a square, the side length is
computed by just taking the square root of its area. After iterating through each
object supplied, “computeSizeDistribution.m” returns the size distribution function,
U(n), and the corresponding structuring element side lengths at each n, for each
object.

With the size distributions calculated, the pecstrum (pattern spectrum) of the objects
can be computed. The pecstrum provides the spectral content of different sized
features in an image. For discrete images, the pecstrum f(n) can be computed by
(adapted from equation 6.11.8 in Pitas):
𝑈(𝑛) − 𝑈(𝑛 + 1)
𝑓(𝑛) = , 𝑛 ∈𝑍>0
𝑈(0)

With the normalizing constant of the original area U(0), the sum of all f(n) values
becomes unity. The pecstrum according to the equation above is computed using
“computePecstrum.m”, which takes U(n), the structuring element side lengths at each
n, and a filename label for exporting plots. The pecstrum is computed, plotted and
saved, and returned back to the parent function. For easy comparison, the plots
generated are all scaled to the same structuring element side length vector size.

After calculating the pecstrum of each object, the complexity can be computed. The
complexity of an object is defined in terms of entropy with the following equation
from eq. 40 in Maragos-Schafer:

𝐻(𝑋|𝐵) = − ∑ 𝑓(𝑖) log 𝑓(𝑖)


𝑖=1

where X is the object, B is the structuring element, and f(i) is the pecstrum. The
following equation is implemented in “computeComplexity.m”. The function simply
takes in the pecstrum of each object and returns the complexity.

With the size distribution, pecstrum, and complexity of each object computed, the
third objective is completed. Continuing in the “main2a.m” code completes the
fourth objective. The fourth objective was to isolate the objects in “match3.gif” and
use pecstral analysis to find the object in “match3.gif” that most closely “matches”
the spade in “match1.gif”. By inspection, the spade is the top-right image in
“match1.gif”. Like for accomplishing the third objective, the objects in “match3.gif”
are isolated, corresponding structuring elements are generated, and the size
distributions and pecstrums are computed (the complexities don’t need to be
computed for this objective).

After the pecstrums are computed for all of objects in “match3.gif”, they are
compared with the pecstrum of the spade in “match1.gif”. A metric of similarity
between two images is finding the square root of the sum of squared errors between
the two object’s pecstrums as shown in Lecture 6:

𝑁−1 1/2

𝑑𝑖 = [∑ 𝐶𝑛 (𝑓(𝑛) − 𝑓𝑅𝑖 (𝑛))2 ]


𝑖=0
where f(n) is the pecstrum of the test object, fRi(n) is the pecstrum of the reference
object, and Cn is a weight. The weight vector Cn can be chosen to emphasize
different components. For example, to weigh all components equally, Cn is set to
unity. The function “computeDistance.m” executes the above equation for each
pecstrum pair and weight vector supplied and returns it to the parent function. If one
pecstrum has more elements than the other, then the shorter one is zero-padded on the
right to the length of the longer pecstrum. To find the object in “match3.gif” that is
closest to the spade in “match1.gif”, the object whose pecstrum resulted in the
minimum distance to the spade’s pecstrum is chosen.

As discussed below in the Results section, if the weight vector Cn is chosen to be


unity for all values, the rotated clover in “match3.gif” results in the minimum
distance from the spade in “match1.gif”. This is because all pattern spectral content
is weighted equally. The weight vector used to correctly match the rotated spade with
the non-rotated spade was an exponentially decreasing weight vector:

𝐶𝑛 = 𝑒 −𝑛 , 𝑛 ∈𝑍≥0

This weight vector emphasized the smaller n components of the pattern spectrum,
which are less susceptible of changing due to rotations.

To execute the code for completing the third and fourth objectives, the user should
run the “main2a.m” script in the MATLAB directory. On the next page is the general
hierarchy of the flow of part 2a.
main2a.m

compute
createStructuring computeSize compute compute
MBR.m with separateObjects.m with Distance.m
Elements.m Distribution.m Pecstrum.m Complexity.m
match{1,3}.gif match{1,3}.gif with match3.gif and
with match{1,3}.gif with match{1,3}.gif with match{1,3}.gif with match{1,3}.gif
spade in match1.gif

img{,1}_1_opened_
objects_found{1,3} SubObj{,3}_1 B_SE{,3}_1 {3,5,7,9,11,13,15,17,19, pec{,3}_1
21,23,25}

img{,1}_2_opened_
SubObj{,3}_2 B_SE{,3}_2 {3,5,7,9,11,13,15,17,19, pec{,3}_2
21,23,25}

img{,1}_3_opened_
SubObj{,3}_3 B_SE{,3}_3 {3,5,7,9,11,13,15,17,19, pec{,3}_3
21,23,25}

img{,1}_4_opened_
SubObj{,3}_4.gif B_SE{,3} {3,5,7,9,11,13,15,17,19, pec{,3}_4
21,23,25}
C. Results

Part 1

Figure 1 – Binary threshold of penn256.gif image

Figure 2 – Binary threshold of bear.gif image

Figures 1 and 2 shows the original images used for the morphological skeletons. The
following figures 3 to 5 shows the skeleton of the penn256 image using the square,
rhombus, and VEC045 structuring elements.
Figure 3 – Morphological skeleton with square structuring element for penn256.gif

Figure 4 – Morphological skeleton with rhombus structuring element for penn256.gif


Figure 5 – Morphological skeleton with VEC045 structuring element for penn256.gif

The VEC045 structuring element has a cleaner morphological skeleton because the
structuring element can have more precision while the radius increases. However, due
to it not being symmetric; the morphological skeleton translates. When the bear
image is analyzed we can see that the translation is problematic. The following
figures 6-8 shows the morphological skeletons for the bear.gif image.

Figure 6 – Morphological skeleton with square structuring element for bear.gif


Figure 7 – Morphological skeleton with rhombus structuring element for bear.gif

Figure 8 – Morphological skeleton with VEC045 structuring element for bear.gif

As hinted before, the translation due to the VEC045 structuring element shifts the
morphological skeleton out of the original image space; although the vector produces
the smoothest morphological skeleton. To further elude on the problem of translation
and non-symmetric structuring elements, the reconstructed image will be translated
from the original image. The rhombus structuring element is preferable over the
square structuring element since it produces more accurate skeletons.
The following figures 9-11 shows the partial reconstruction of the penn256.gif using
the square structuring element. The original skeletons are included in every partial
reconstruction for penn256.gif and bear.gif.

Figure 9 – Morphological reconstruction with square structuring element for


penn256.gif of level 2

Figure 10 – Morphological reconstruction with square structuring element for


penn256.gif of level 3

As the level approaches 0, the morphological reconstruction approaches the original


image as expected because more skeleton subsets are dilated with their respective
structuring elements.
Figure 11 – Morphological reconstruction with square structuring element for
penn256.gif of level 4

Figure 12 – 14 shows the partial reconstructions of the penn256.gif image with the
rhombus structuring element.

Figure 12 – Morphological reconstruction with rhombus structuring element for


penn256.gif of level 2
Figure 13 – Morphological reconstruction with rhombus structuring element for
penn256.gif of level 3

Figure 14 – Morphological reconstruction with rhombus structuring element for


penn256.gif of level 4

The following figures 15-17 shows the partial reconstructions of the penn256.gif
image with the VEC045 structuring element. Due to the small size of the structuring
element, the computational complexity is quite high because the maximum radius is
much higher. We can also see the side effect of the asymmetric structuring element.
In this case, the skeleton is translated and partial reconstructed is translated the same
amount again.
Figure 15 – Morphological reconstruction with VEC045 structuring element for
penn256.gif of level 2

Figure 16 – Morphological reconstruction with VEC045 structuring element for


penn256.gif of level 3
Figure 17 – Morphological reconstruction with VEC045 structuring element for
penn256.gif of level 4.

The next set of figures will show the same partial reconstructions, but with the
bear.gif image instead. Figures 18-20 shows the partial reconstruction with the square
structuring element.

Figure 18 – Morphological reconstruction with square structuring element for


bear.gif of level 2
Figure 19 – Morphological reconstruction with square structuring element for
bear.gif of level 3

Figure 20 – Morphological reconstruction with square structuring element for


bear.gif of level 4

The partial reconstructions of the bear image with the square structuring elements for
levels 2, 3 and 4 are not much difference because the level is too high to reconstruct
the bottom bears but low enough that the upper bears do not change because they
have already been reconstructed by structuring elements with radii larger than the
specified levels.
The following figures 21-23 shows the partial reconstruction with the rhombus
structuring element for the bear.gif image.

Figure 21 – Morphological reconstruction with rhombus structuring element for


bear.gif of level 2

Figure 22 – Morphological reconstruction with rhombus structuring element for


bear.gif of level 2
Figure 23 – Morphological reconstruction with rhombus structuring element for
bear.gif of level 4

The results are similar to the square reconstruction in that the upper bears are not
changed much. However, the lower bears start to be reconstructed at level 2 because
the rhombus structuring element is smaller than the square structuring element at that
level; and subsequently fits in the outline of the lower bears in the original image.

The final set of images for the partial reconstructions are shown in figures 24-26.
These figures show the partial reconstruction with the VEC045 structuring element.
As discussed before, the partial reconstructions will be translated out of the original
image space due to the asymmetric structuring element.
Figure 24 – Morphological reconstruction with VEC045 structuring element for
bear.gif of level 2

Figure 25 – Morphological reconstruction with VEC045 structuring element for


bear.gif of level 3
Figure 26 – Morphological reconstruction with VEC045 structuring element for
bear.gif of level 4

It is apparent that the asymmetry translates the reconstruction out of the original
image space. Since the VEC045 structuring element is only two pixels, it can easily
reconstruct fine details in the lower bears but requires a lot of iterations to reconstruct
the upper bears. The upper bears appear no different because levels 2, 3 and 4 are
very small compared to the radius that the structuring element needs to be for the
reconstruction.
Part 2

Figure 27 – The original “match1.gif” with the four objects in one image – clover,
spade, steer, and plane.

Figure 28 – The “match1.gif” with the points showing the minimum bounding box of
each shape.

Figure 27 shows the original “match1.gif” that was given to the team to isolate the
objects and perform pecstral analysis on. The first step was to find the minimum
bounding box of each shape. The corners of these boxes are shown in Figure 28.
With the bounding box, the next step was to isolate each object into its own array. 10
extra background pixels were padded all sides of each object for because
morphological operations take advantage of “local knowledge”. Figure 29 shows the
four objects successfully isolated.

Figure 29 – The four objects in “match1.gif” after being isolated and padded by 10
pixels all sides.

After isolating the four objects, the 3x3 square structuring element was generated, so
that the size distribution of each object could be calculated. The 3x3 square was
padded by background pixels to match the size of its corresponding object. The
dimensions of the full image of the structuring element were rounded to the nearest
odd integer so that the square would be perfectly in the center of the image. The
generated structuring elements are shown in Figure 30.

Figure 30 – The four 3x3 structuring elements padded to the same size (rounded to
nearest odd indices) as their corresponding objects in “match1.gif” to be operated on.

With the objects isolated and structuring elements generated, the size distribution was
computed and is plotted in Figure 31. We can see that the plane’s size distribution is
most compressed in terms of the side length of the square structuring element. This
means that the plane has mostly long and narrow components. The steer, on the other
hand, is the least compressed in terms of side length of the square structuring element,
which means that it has both long/narrow as well as large/wide components.

Figure 31 – The size distribution of the clover, steer, plane, and spade in
“match1.gif” using a 3x3 square structuring element.

Figures 32, 33, 34, and 35 show the pattern spectrum (pecstrum) of the clover, steer,
plane, and spade, respectively. The pecstrum is the scaled derivative of the size
distribution. We can see the clover and spade have relatively low pecstral content in
the smaller side lengths, but a large amount of pecstral content in the higher side
lengths. This indicates these shapes have a lot of large filled regions. The steer has a
relatively flat pecstrum across all of the side lengths meaning that it has an even
number of smaller features and larger features. The plane has a flat pecstrum across
the first half of the side lengths (and nothing on the second half) indicating it has an
even number of smaller feature, but lacks larger features. This makes sense as a
plane is made up of long and narrow components.
Figure 32 – The pecstrum of the clover in “match1.gif” using a 3x3 square
structuring element.

Figure 33 – The pecstrum of the steer in “match1.gif” using a 3x3 square structuring
element.
Figure 34 – The pecstrum of the plane in “match1.gif” using a 3x3 square structuring
element.

Figure 35 – The pecstrum of the spade in “match1.gif” using a 3x3 square structuring
element.
Table 1 shows the complexity metric computed for each object using entropy metric
described in the Methods section. A higher number means the object is more
complex, so the steer was the most complex object. This makes sense because the
steer has a lot of small details, as well as, larger components. The spade, clover, and
plane were about the same complexity (in comparison to the steer).

Object Complexity
Clover 0.6816
Steer 0.8530
Plane 0.6975
Spade 0.7117

Table 1 – The complexity of the clover, steer, plane, and spade in “match1.gif” using
a 3x3 square structuring element.

To accomplish the fourth objective, the objects in Figure 36 (“match3.gif”) had to be


isolated so that pecstral analysis on the objects could be computed. With this pecstral
analysis, a similarity distance measure was used to compare the pecstral content of
the spade in “match1.gif” and the four objects in “match3.gif”.

The first step was to find the minimum bounding box of each shape. The corners of
these boxes are shown in Figure 37. With the bounding box, the next step was to
isolate each object into its own array. 10 extra background pixels were padded all
sides of each object for because morphological operations take advantage of “local
knowledge”. Figure 38 shows the four objects successfully isolated.

After isolating the four objects, the padded 3x3 square structuring element was
generated in the same manner as with “match1.gif”, so that the size distribution of
each object could be calculated. The generated structuring elements are shown in
Figure 39.
Figure 36 – The original “match3.gif” with the four objects in one image – clover,
spade, steer, and plane.

Figure 37 – The “match3.gif” with the points showing the minimum bounding box of
each shape.
Figure 38 – The four objects in “match1.gif” after being isolated and padded by 10
pixels all sides.

Figure 39 – The four 3x3 structuring elements padded to the same size (rounded to
nearest odd indices) as their corresponding objects in “match1.gif” to be operated on.

With the objects isolated and structuring elements generated, the size distribution was
computed and is plotted in Figure 40. In comparison to Figure 31, the size
distributions using the 3x3 square structuring elements are generally wider. Although
the objects are the same as in “match1.gif”, the rotation causes the structuring
element to fit “better” into the objects. With the rotation, the larger dilated versions
of the square have more points where they can completely fit inside the object.

Seeing that the size distribution of Figures 31 and 40 are not the same, we can
conclude that the size distribution (given the same structuring element) are not
rotation invariant. If the structuring element were rotated along at the same angle as
the object, then we would expect the same size distribution.
Figure 40 – The size distribution of the clover, steer, spade, and plane in
“match3.gif” using a 3x3 square structuring element.

Figure 41 – The pecstrum of the clover in “match3.gif” using a 3x3 square


structuring element.
Figure 42 – The pecstrum of the steer in “match3.gif” using a 3x3 square structuring
element.

Figure 43 – The pecstrum of the spade in “match3.gif” using a 3x3 square structuring
element.
Figure 44 – The pecstrum of the plane in “match3.gif” using a 3x3 square structuring
element.

Figures 41, 42, 43, and 44 show the plots of the pecstrums of the clover, steer, spade,
and plane with respect to the side length of the square structuring element used. In
comparison to Figures 32, 33, 35, and 34, respectively, the pecstrums have the same
shape in terms of content in the smaller components and higher components. The
pecstrums of the “match3.gif” extend longer in terms of side length, but the relative
shape is the same. This makes sense because the objects in “match3.gif” are the same
as “match1.gif”.

After the pecstral content was computed, the similarity distance metric was computed
for the four objects in “match3.gif” and the spade in “match1.gif” with the algorithm
discussed in the Methods section. Table 2 shows the distances computed given the
pecstrums in Figures 41, 42, 43, and 44 (which use the square structuring element)
and a weight vector of
𝐶𝑛 = 𝑒 −𝑛 , 𝑛 ∈𝑍≥0

This exponentially decreasing weight vector was chosen because the pecstral content
in the higher side lengths in “match3.gif” that don’t exist in the objects in
“match1.gif”. Therefore, when a unity weight vector was used, the clover had the
minimum distance metric of the four objects (instead of the spade). With the
exponentially decaying weight vector, the components with smaller side lengths (less
affected by the rotation) are emphasized. With this weight vector, Table 2 shows that
the spade in “match3.gif” was chosen as the most similar image to the spade in
“match1.gif” because it had the minimum distance.

Object in Distance to Spade in


“match3.gif” “match1.gif”
Clover 0.0172
Steer 0.0474
Spade 0.0080
Plane 0.1767

Table 2 – The distance metric between the spade in “match1.gif” and all four objects
in “match3.gif” using a 3x3 square structuring element and a weight vector of
𝐶𝑛 = 𝑒 −𝑛 , 𝑛 ∈𝑍≥0

D. Conclusions

This project provided insight to morphological skeletons and partial reconstruction. It


also provided a great example on computing size distributions, pecstrums, and
complexities and how these metrics change based on rotations of an object. For
image pattern recognition, having rotations of the same pattern is quite frequent.

The first task of morphological skeletons and partial reconstructions showcase the
importance of having symmetric structuring elements so that the translation of the
skeletons and partial reconstructions remain in the original image space. For
asymmetric structuring element to be used, the original image will have to be zero-
padded such that the translated reconstruction is not lost. This is not ideal because it
adds computational complexity and memory space if to be used on a hardware
system. The best structuring element will be a circle because the varying disc best fits
in complex shapes than a varying rhombus and square.

The second task was to isolate objects in an image, find their size distribution,
pecstral content, and complexity, and compare this pecstral content with rotated
versions of the same objects. As the results show, the size distribution and pecstral
content are not rotation invariant (assuming the structuring element is not rotated).
The width of the pecstrums and size distributions may change because of the rotation.
However, the general shape of the pecstrums remains the same for a rotated object.
When finding similar images, the rotation does come into effect when using pecstral
analysis. This can be mitigated by choosing an appropriate weight vector that
emphasizes certain pecstral content.

Você também pode gostar