Activity 2: Measuring Areas Using Green’s theorm

June 19, 2008 at 10:53 am (Uncategorized) (, )

We use Green’s theorem in finding the area of a given regular polygon. Green’s theorems states that we can get the area of a region R bounded by a closed counter C using the formula

In Scilab, the closed counter can be traced using the ‘follow’ command from the SIP toolbox. The syntax of the command is:

[x,y]=follow(g);

which results to the lists x and y containing the x and y coordinates of the contour (or simply the edge) respectively. It should be noted, however, that follow uses a black (0) background and white (1) object. The coordinates x and y gives the coordinates of the white object nearest to the edge.

The theoretical value of the area is measured by counting the number of white pixels (valued 1). Since binary images are converted to ones and zeros by scilab, the theoretical value of the area is simply sum(g).

//Jeric Tugaff
//Activity 2
//compute for areas using green’s theorem

g=imread(‘C:\Documents and Settings\AP186user04\Desktop\AP186\Activity 2\square.bmp’);
[x,y]=follow(g);
ta=sum(g) // theoretical area
x1(1)=x(length(x));
x1(2:length(x))=x(1:length(x)-1);
y1(1)=y(length(y));
y1(2:length(y))=y(1:length(y)-1);
a=0.5*sum( x1.*y – y1.*x)

square

results yield an ares of 24964 pixel when using green’s theorem, while the theoretical value is 25281 with error of 1.2539061% for the square. For circle, theoretical is 30937 and actual is 30656. Finally, for triangle, theoretical is 20000 and actual is 19701.

Colloborators: Julie Mae Dado (for help in some scilab commands, and conversion of .jpg images to binary format), Benjamin Palmares (for the help in configuring the scilab), Mark Leo Bejemino (for the invalueble discussion), and to Lei Uy (for helping out which bmp format is suitable, which, by the way, is the 24-bit bmp format)

Rating: 10. Because the computed area is well within the accepted value of the error. 😀

2 Comments

  1. Jing said,

    Yep. That’s a 10 alright. Have you found the source of disparity in the areas of the circle and triangle?

  2. jptugaff said,

    Hi ma’am. 🙂
    The disparity occurs because of the “follow” command. It gets the position of the black pixel nearest the white pixel. It’s similar to getting the area by counting the but the dimensions are 1 pixel larger. But green’s theorem would work perfectly if the the curve is continuous and not discrete, as was the case of pixels.

Leave a comment