Thursday, June 30, 2011

Area Estimation for Images with Defined Edges


Area measurement from scaled images is a very important technique in many fields, from land area measurements to quality checking of electronics. However, although the analytic solutions for the area of regular shapes are known, most real-world samples are irregularly shaped.
For this activity, our algorithm of interest is Green’s theorem. What is Green’s theorem? It is a relation between a double integral to a contour integral…. In layman’s terms it is an equation that somewhat relates the area of a shape to its perimeter. This relation is given by:
Figure 1. Green's Theorem
Using this formula and assigning values for F1 and F2, we can obtain a formula for the area:

Figure 2. Area using contour integral


With its discrete form given by:

Figure 3. Discrete area approximation using contour integral.

At the beginning, I didn’t realize that scilab had a follow command so I tried to come up with my own edge detection algorithm. My plan was to utilize the fact that my images were binary.

Figure 4. Pixel orientation
 
The figure is a layout of adjacent pixels. My theory was that if all the surrounding pixels has a value of 1, it is not an edge, else it is. Using this algorithm I was able to isolate the contour of a rectangle:

Figure 5. Rectangular contour

Now my next problem was following the contour. This I was not able to do. My main problem here is preventing the backtracking of the algorithm. In a 1 dimensional path like the contour there are 2 ways to go my problem was how to keep it moving forward. Because of this I gave up on this feat.

Using the command follow, I obtained the an array of coordinates for the contour of the following shapes to use for the algorithm. And from there I was able to obtain an estimate of the area:
 
Figure 6. Binary Rectangular Image






 Theoretical Area: 60000 pixels
Area obtained through 
Green's Theorem: 60000 pixels


Figure 7. Circular Binary Image













 Theoretical Area: 96211.275 pixels pixels
Area obtained through 
Green's Theorem: 95319 pixels










For the rectangular shape, Green's theorem was able to discern the correct area while there is a 0.927% error for the circular shape. This of course is within the margin of error for the algorithm.


The next part of the activity is a real world application of area estimation. What I did was obtain a map of Colorado from Google Maps:

Figure 8. Map of Colorado

 I chose Colorado because of the simplicity of its shape. Then I transformed it to a binary image containing only the basic shape:

Figure 9. Binary image of the shape of Colorado

Using this I obtained the area of Colorado in pixels. Using the conversion factor of 1.8867924528301886792452830188679 km/pixel, I obtained the actual area of 265,738.7 km2

Comparing it to the actual area of 269,837 km2, the error the algorithm incurred was only 1.52%, which shows that the algorithm was effective in its estimation. I took a detour because of my failure to read the instructions but since I was able to complete the activity, I would give myself a 9/10.

No comments:

Post a Comment