Technological advancements of today has wide applications on
a lot of aspects of our life. One of them is through area estimation using only
image processing. This would be helpful is estimating land areas where it only
requires an image and a conversion factor of the pixel size to actual length
scales. One example would be area estimation of regions in the Mars taken by
Curiosity. In this activity, we were tasked to use Green’s Theorem as a method
of area estimation. I also used morphological operation by getting the sum of
the pixels inside a known shape and compared it with the result of Green’s
Theorem and the known area of the shape based on its radius or side.
Green’s Theorem obtains the area A of the regions R using
the contour of the edges of the area obtained in a clockwise direction.
In discrete form,
For obtaining the contour of each shape,
I used the edge function in Matlab with Canny as the method. I compared the
result of the Green’s Theorem to the sum of the white pixels in the image and
to the result of using the formula for the area of each shape. I obtained the
center of the image from the mean of the x axis and mean of the y axis of the
edged of the shape. Then, I used the function sort to sort the theta in increasing
order. This function returns the old indices arranged now in the way it was
sorted. The indices was used to rearrange the x and y coordinates.
In figure 1, increasing the pixel size increases
the accuracy of the Green’s Theorem method. This is affected by the edge
detection done since looking at the circle in the 50x50 px image, the circle is
not completely round looking at the sides. At the extreme case, in figure 1 a)
for the 10x10 px image, the image is now a square, which opens a lot of
inaccuracy at the corners considering that the radius of the circle remained constant.
The table below summarizes the percent difference of the area obtained using
the Green’s Theorem, compared with the area obtained using an empirical formula
(formula) and the area obtained from the sum of the white pixels (sum). Same thing was done for the square in figure 2, triangle in figure 3, and parallelogram in figure 4.
Resolution of Circle (px)
|
Formula (%)
|
Sum (%)
|
10x10
|
9.9237
|
31.25
|
50x50
|
1.4975
|
1.2821
|
100x100
|
0.5524
|
0.8558
|
500x500
|
0.1269
|
0.1277
|
Figure 1. The circles used with varying pixel size. a) 10x10
px image. b) 50x50 px image. c) 100x100 px image. d) 500x500 px image. The
radius of the circle used was 0.25 the length of the whole square image.
The summary of the area estimation done using a sqaure is shown in the table below.
Resolution of Square (px)
|
Formula (%)
|
Sum (%)
|
10x10
|
31.25
|
31.25
|
50x50
|
1.7361
|
1.7361
|
100x100
|
0.66
|
0.66
|
500x500
|
0.1064
|
0.1064
|
Figure 2. The squares used with varying pixel size. a) 10x10
px image. b) 50x50 px image. c) 100x100 px image. d) 500x500 px image. The size
of the square used was 0.5 of the length of the whole image.
The summary of the area estimation done using a triangle is shown in the table below.
Resolution of
Triangle (px)
|
Formula (%)
|
Sum (%)
|
10x10
|
12.5
|
12.5
|
50x50
|
14.876
|
3.4722
|
100x100
|
7.2917
|
1.12
|
500x500
|
1.4723
|
0.1448
|
Figure 3. The triangles used with varying pixel size. a)
10x10 px image. b) 50x50 px image. c) 100x100 px image. d) 500x500 px image.
The base and height of the triangle was 0.5 of the length of the image.
The summary of the area estimation done using a parallelogram is shown in the table below.
Resolution of
Parallelogram (px)
|
Formula (%)
|
Sum (%)
|
10x10
|
30.314
|
30.314
|
50x50
|
10.2941
|
1.3158
|
100x100
|
4.8423
|
0.5342
|
500x500
|
0.9264
|
0.0879
|
Figure 4. The parallelogram used with varying pixel size. a)
10x10 px image. b) 50x50 px image. c) 100x100 px image. d) 500x500 px image.
Overall, the accuracy of the area estimation increases as the resolution increase for all the shapes. The least accurate for high resolutions in the triangle. which could be due to the angle of inclination of the sides. The formula also has a comparable difference in accuracy with the sum. This could be due to the rendering done in the images.
I used the Green's theorem for estimating the area of the QMC
circle. From google maps, the screen shot of the QMC circle in figure 5 has a lot of
colors, which would give errors in the edge detection technique used. So,
before running the image to the code, I created a mask using GIMP to show only
the region of the QMC. The mask is depicted by the black pixels as shown in
figure 6. Further processing shown in figure 7 converts the image to binary,
with the region of interest shown in white pixels.
Figure 5. The screenshot of the QMC circle. The conversion
factor for the area was 8826 pixels per 10000 square meters. The area of the
QMC circle is 0.27 square km based on Wikipedia.
Figure 6. The screenshot of the QMC with a mask to highlight
only the region of interest.
Figure 7. The screenshot of the QMC in binary, with the
region of interest depicted in white pixels.
Green’s Theorem gives an area of 0.2932 square km which
deviates by 8.5926% from the result from Wikipedia. Comparing with the sum of
the white pixels, the deviation of the method is 0.0587%. From these number, I
say that the method is pretty good as long as the resolution is high enough to yield
good results.
Overall, this activity is okay for me. I didn’t enjoy
repeating the same method with different shapes. However, the part where I have
to manipulate the screen shot of Google maps bothers me most since I feel like
it required a lot of human intervention while I thought this method would be
for automation of area estimation. I don’t like the part where I have to trace
the perimeter of the desired object and color and recolor them into a binary
image since I feel like there is an image processing method to do that.
For the next part, I tried doing a different method by
isolating a part of the image with a certain color instead of binarizing the
image. The problem here is to find a pixels values which is at the middle of
the range of values in the image. Compared to thresholding, the binarization
should be done with a range of pixel values be assigned to white and the rest
to be black. I tried searching on matlab examples, and I found about about
k-means segmentation. This method segments the image based on its color using the
function kmeans, which separates groups into clusters. In this case, the rgb
image is converted into L*a*b* color space which identifies the colors into its
luminosity layer L, chromaticity-layer a* or the red-green axis, and the
chromaticity-layer b* or the location of the color along the blue-yellow axis
(this was also our lesson in 187!!). For the k-means clustering, the object
locations was obtained from the a*b* space and clusters using the Euclidean
distance matrix.
I used a screenshot of the top view of Mayon Volcano. In
Google maps, the considered range of the area of Mayon was depicted in a
certain shade of green which could be located in figure 8. I tried to obtain the area of this region, first by
isolating it using k-means clustering.
The region was successfully separated from the other elements of the image.
This results makes me super happy as the segmentation done by the program was
so clean, I can even use one of the clusters indicating water ways if ever I want
to. I feel energized to do more. The cluster which obtained the region of
interest, ROI, which is the Mayon Volcano, was however not that good. It can be seen
from figure 9 c) that there are small green regions outside of the ROI and cracks
inside the ROI. I thought that repairing this region is okay since I acquired enough energy from the
successful segmentation, to search even more. I’m also particularly grateful since while searching
for this method, I learned about another method of segmentation, which is
the watershed segmentation, that could probably be useful for my research. For more info, you may check on
my research blog.
Figure 8. Screenshot of the top view of Mayon Volcano. The
region of interest is the big circular region in a greenish hue.
Figure 9. The image successfully segmented into different
components using k-means clustering along the a*b* space. The region of
interest in in the third cluster in c).
Separating and reparing the region of interest is harder
than I thought since the shape is not a regular circle. I tried using the imfindcircles function but it can’t detect the irregular shape. I also thought of using the function
regionprops, but the cracks would still be detected as edges. This is when I thought
of comparing the area option in regionprops to the Green’s Theorem method done.
Anyway, after further searching, I decided to ignore the cracks or the
waterways in the image and separate first the biggest area in Figure 9 c), which is the largest connected component in figure 11 b). The theoretical area used was obtained from the area feature in Google maps, figure 10, which shows the area of a selected region. I slightly cleaned the results obtained from the edge detection technique as shown in figure 11 c), by removing the points where the radius is less than 400 pixels, to remove the lines inside. This critical radius was obtained from the shortest among half the difference of opposite points along the edge. The summary of the results comparing the area obtained from Google Pro, Green's theorem, morphological operation and region props is shown in the table below.
Google Pro (sq km)
|
Green’s Theorem
|
Sum of White Pixels
|
RegionProps Area
|
|||
Area (sq km)
|
Difference (%)
|
Area (sq km)
|
Difference (%)
|
Area
|
Difference (%)
|
|
221.54
|
214.58
|
3.14
|
210.52
|
4.97
|
213.65
|
3.56
|
Figure 10. Area of a selected region in Google Maps can be obtained my right clicking, selecting measure distance, and selecting a closed area by selecting points around the curve.
Looking at the summary of the results of different methods, the Green's Theorem method is pretty good. Though, a lot of modification was done in
the image before the method, we still successfully did everything using image processing without
human intervention using GIMP. For the whole activity, I give myself 11/10
since I completed the whole activity and added an additional process which is
the image segmentation. Though the image segmentation still needs a lot of
improvements, I think it is enough since the accuracy of the area estimation technique is high.
Figure 11. The Region of Interest. a) The cluster 3 obtained from figure 7 as shown in figure 8. b) The grayscale image to be used to isolate the biggest connected component which is the region of interest. c) The edges of the region of interests shows edges inside of the larger circle.
The hand is the cutting edge of the mind -Jacob Bronowski