Thursday, June 30, 2011

Activity 4 - Area estimation of images with defined edges

I wished I had realized all my mistakes from last night up to this lunch or early this afternoon. I will have the chance to code the follow command if I did not realized early this morning that I could get the follow function in SIP even without installing Scilab 4.1.2 or any version of this Scilab. I spent my time last night browsing for possibility in coding the function early today. I already downloaded the book that the guy wrote the code as his reference. I had a hard time in doing this for Scilab 5.3.2. But now, I have the follow function. If you are using Scilab 5.3.2, and want to get the follow function, click here!

Now it's time to write about the activity. If I have known that I can get the function even not installing the SIP and without using Scilab 4.1.2, I might have finished this activity since yesterday, 28 June 2011. But no, faith doesn't want me to finish earlier. But now, I am done.

First in the activity is to generate some figures. I have tried images of circles and squares. I want to try to generate a triangle using scilab but I felt lazy doing it. Even my circles and squares are not generated by scilab but I painted it. Anyway, under is an image of my code.

Fig. 1. My code
As you can observe, there is an additional command that I used in order to use the follow function. It's ok but it's kind of weird for me because I am now used to use my own functions placed in a folder in Matlab. But Scilab needs you to call all *.sci files in order to use them. I used the dots per inches of paint since I used paint to edit my images.

Fig. 2. Table of areas

The figure to the left is a table of my the area obtained using the Green's function and another way to compute the area which is the sum of the values of the matrix since its value is 1 per pixel so using the conversion from pixel to inches or cm then the area will simply be the sum of the pixel's values. This idea was a knowledge from high school.
Fig. 3. Circles used from 2 cm to 12 cm
Fig. 5. error plot for Sum and Green's function



The figure on the left is the image I used that increases in radius in order to differentiate the diversion of the area using Green's function and its true theoretical value. As you may observe the figure on the right above, the error decreases as the radius of the circle increases. With this, a circle with higher radius will be accurately calculated using Green's function. I think a good scale between the pixel and its real-world measurement.

Next, I look for something in google maps that interests me a lot and that is an ISLAND. Islands are so great and beautiful and there have facts in the internet that could say what is its land area. I like islands. I want to have my own island and make it a paradise. But first, I need to finish this.

Fig. 6. The feature I preferre
This island is called Cagbalete Island and it has white sands that can be seen during low tide. Most tourists stay south of the island and stay to the three known resorts in the area - the Villa Cleofas, Pansacola Beach Resort and MVT Sto. NiƱo Beach Resort. The islands land area is approx. 1,640 hectares or 16.40 sq. km.

Fig. 7. Binary image of the island
This is the BINARY image of the island. I first create an outline on the edge of the island then converted the new image into a binary image and edit it again until I get the figure to the left.

After that, I then computed the area of this figure using the sum function and the green's function. I found the ratio between the pixel size and the real-world measurement to be 0.019048. This is in pixel per km. I then calculated the Area using the sum method, and Green's function, 19.098088 sq. km with an error of approx. 15%  and 18.911 sq. km with an error of approx. 17%.

I have compared the real-world value and the simulated value. The error is big because I edit the data and may be the area becomes big.

Yes.. I am done. Not completely done but I am happy that I have completed this activity. In gradings, I will be giving myself as 11 with 5 points on both Technical and Qualities part and a 1 point for my initiative to use other programs in order to obtain the most critical error value.

No comments:

Post a Comment