Tuesday, July 3, 2012

4th Activity: Area Estimation for Images with Defined Edges

This activity enables us to learn how to obtain the area of an image using Scilab. However, the image should have edges that are well-defined. There are two ways: pixel counting using logical operators and the other one is pixel counting using the Green's theorem.

Greens theorem gives the relationship between line integral and double integral of a function. It is given by the equation

                                     (1)


where D is the region while C is the curve enclosing the region and the curve is in counterclockwise direction.

The area at the region D can be calculated using the equation given by 

                                                     (2)

 Equation (2) can be represented in summation form

                                                     (3)
where Nis the number of pixels in the bounded region.

Equation 3 can be implemented using Scilab to obtain the area of an image with defined edges. 


Using GIMP, a rectangle was created and is shown in Figure 1.

Figure 1. A rectangle image

The rectangle that was created has dimensions: 350px by 250 px. So the area is analytically known to be 87,500  px2 .

To determine the number of pixels in white, the following code was implemented:

im=imread('/home/venven/Desktop/ap186/rectangle.bmp');
[ii] = find(im);
pixelcount=size(ii);

The obtained pixelcount is 87500. This matched the created image in GIMP.
The pixelcount represents the analytic area of the image.

Now what I did next was to compute for the area using Greens Theorem.

The calculated area is 86735.5 The percent error from the analytically known area is 0.8748471%.


To test again the effectiveness of the Greens Theorem, a place of interest was selected using Google Maps.
I chose the National Institute of Physics. :)


Figure 2. Location of National Institute of Physics using Google Maps

     Using GIMP, I cropped the image and converted it into black and white image.

Figure 3. Black and white image of NIP
pixelcount = 67,808 px2  
computed area = 67,097.50 px2
error = 1.0492707%.


To obtain the actual units, the scaling factor was taken.
 0.943396 ft/px or  0.289855 m/px 

The area of NIP in pixels is then multiplied to the scaling factor to get the approximate area.
The are was approximately 63,299.53 ft2 or 19,448.55 m2. I was not able to find any literature containing the actual land area of the National Institute of Physics. However, to check the validity of the result one can ask an authority of NIP.



Self-evaluation:
I give myself a 10/10 for fully understanding the concept and for being able to produce the desired output.
I was also able to present my thoughts and explanations in an organized manner.

Acknowledgment:
I would like to thank Gilian Uy for lending her laptop with an SIP Toolbox.
SIP toolbox was indeed helpful compared to the SIVP.




2 comments:

  1. Reference
    Soriano, M. A4- Area estimation of images with defined edges 2012

    ReplyDelete
  2. It is close to the actual. I was involved in the planning of the building. Back then we envisioned around 14,000m2 space.

    ReplyDelete