Wednesday, June 30, 2010

Activity 4: Area Estimation of Images with Defined Edges

The function follow in scilab gives tremendous help in giving geometric information from images, such as area of an object of an image with defined boundaries. This object can be of any shape, all the follow function needs is the object's boundary. The follow function returns the pixel coordinates of these boundaries, to make it more accurate it is advised to convert the image to a binary type image, however, proper thresholding must be used to prevent loss of information on the objects boundary. Let us use first basic geometric shapes in testing the follow function capabilities.

Figure 1. (left) Circle with radius 8 a.u. and (right) Rectangle with sides 8 a.u. and 4 a.u.

In figure 1.we have two basic geometric shapes a circle with radius of 8 a.u. and a rectangle with side 8 a.u. and 4 a.u. The area of these figures will be computed by the help of the follow function. Since these images are already in binary type, conversion is not necessary. The follow function gets the pixel coordinates of the boundaries of the images. So now, we are not only able to get the area of the object we are also capable obtaining the object's perimeter.

Figure 2. Perimeter of (left) the circle and (right) rectangle in figure 1.

So now that we have the Boundary locations of the basic geometric shapes, we can use an elegant and powerful equation, the Green's Theorem. The Green's Theorem explains that a contour forming a smooth and close loop can be related to the area enclosed by the contour. It is given by this equation,
The equation above translates a double integral to a single closed integral. Physically it means that it can relate areas (double integral) to boundaries (single closed integral). Solving for the area, we will arrive at the following equation,
In discrete form, the area equation for an object with Nb elements would look like the equation shown below,
We now have the equation for area, all that is left now is to scale the pixel location to real physical values to get the real physical area. This is where we use the knowledge learned from activity 1, the pixel-to-real value ratio. After obtaining the area, the %error of the computed value must then be obtain to know the accuracy of the technique.

Theoretical Area of the Circle = 201.06193 a.u.
Computed Area of the Circle = 199.2072 a.u.
% Error = 0.92 %

Theoretical Area of the Rectangle = 128 a.u.
Computed Area of the Rectangle = 126.7624 a.u.
% Error = 0.97 %

We can see that the error is minimal and thus the method for this case is acceptable. Knowing this, we will try to find applications for this technique, such as land area computations. We will see if the method is still acceptable in large scale distances.

Figure 3. Satellite views of (left) Star City, (right) Enchanted Kingdom, and (bottom) Disneyland California. These photos are obtained from Google maps.

In figure 3, we see satellite images of three theme parks namely; Star City, Enchanted Kingdom, and Disneyland California. The interest from these images is to see how large does the land area of these theme are. (Well, we all know its gonna be Disneyland, its humongous!).

Since the images in figure 3 are true colored images, for accuracy, we should convert it to binary images with proper thresholding. Unfortunately, due to the colors that are present it was hard to get a very defined outline of the theme parks. Thanks to my colleague, Eugenio Leynes, an extra image tweaking was done for easy processing. An overlay was added to the image to roughly define the edges of the theme parks.

Figure 4. Images from figure 3 added with overlay for easier boundary definition.

From the images from figure 4, the binary version of the images can now be easily produced.

Figure 5. Binary version of the images from figure 4. Thresholding was quite easy due to the overlay that was added in figure 4.

The values of the elements of these binary images in figure 5 was then used in the follow function for the calculation of the pixel location of the object's boundary. Returned values from the follow function was then scaled to its real physical value via pixel-to-real value ratio. The last step to compute the land area was using the discrete area calculation via Green's Theorem.
The results obtained follows below,

Theoretical Land Area of Star City = 35,000 square meters
Computed Land Area of Star City = 30,379.163 square meters
% Error = 13.20 %

Theoretical Land Area of Enchanted Kingdom = 170,000 square meters
Computed Land Area of Enchanted Kingdom = 124,150.67 square meters
% Error = 26.97 %

Theoretical Land Area of Disneyland California = 343982.795 square meters
Computed Land Area of Disneyland California = 424,256 square meters
% Error = 23.34 %

We can see that compared to the simple geometric shapes used, the land area has a much higher % error. This high % error is may be due to the overlay added, since it is just a rough estimate where the boundaries of the object is. Also, another source of error is the largeness of the image. This can be justified by the pixel-to-real value ratio of each images.

Circle and Rectangle Pixel-to-Real Value Ratio = 0.04 a.u./pix
Star City Pixel-to-Real Value Ratio = 1.15 m/pix
Enchanted Kingdom Pixel-to-Real Value Ratio = 2.35 m/pix
Disneyland California Pixel-to-Real Value Ratio = 4 m/pix

As we can see from the pixel-to-real value ratio of each images, relatively, the higher the ratio the higher the % error of the computed area. An extra pixel included in the enclosed area would give a significant changes to the computed area if the ratio is significantly high.

Finding how large something is without even doing physical measurements on it is just fascinating. Imagine how long would it take you to measure the land area of the theme parks featured above (imagine measuring 350000 square meters land area of Disneyland! Whew!), while you can do it on your computer with you sitting down on your comfy chair in less than 15-20 mins. (Yey!)

I find this activity very exciting!I was fascinated on getting informations on an object without me even touching it! 10! 10! 10! I grade myself!

*finding the real land area of the theme parks was hard but thanks to these sites I have something to roughly compare with:
  • http://en.wikipilipinas.org/index.php?title=Star_City
  • http://www.philippines-travel-guide.com/star-ciy.html
  • http://en.wikipilipinas.org/index.php?title=Enchanted_Kingdom
  • http://en.wikipedia.org/wiki/Enchanted_Kingdom
  • http://en.wikipedia.org/wiki/Disneyland
  • http://www.ehow.com/facts_5406307_big-disneyland-california_.html
Reference:
Dr. Soriano. Applied Physics 186 activity handouts: A4 - Area Estimation of Images with Defined Edges

No comments:

Post a Comment