Mga Pahina

Martes, Hunyo 25, 2013

Area Estimation and Edge Detection

The next task in our 186 lab class is area estimation and edge detection of a given image. Suppose we have an image of a regular shaped object and we wish to obtain its area using pixel values, we can implore the following techniques called the Green's function.

First, we start by generating synthetic images of a regular shaped polygon using Scilab or paint. It is important that we know the dimensions of these synthetic images so that we will have a basis in computing the actual area of the image. I used Scilab to generate these images. The first thing that made me wonder is the question of how big or how small should the be the dimension of the image to produce a more accurate estimation of the area? Or would it be independent of the dimension of the image to be estimated? Would a bigger image dimension give us a more accurate result or would the error be multiplied as well? The formula of the Green's function is shown below:
where Nb is the number of neighboring pixels.
But before we do this, let's discuss first the syntax edge
To be able to track the edge of a figure, we use the function edge which uses different algorithm depending on the choice of the user. An example result for each type of edge detection is shown below:

Synthetic circle generated using Scilab together with the different edges available
Choosing the right algorithm in detecting the edge is very important in area estimation. The sobel and the prewitt use a gradient estimator. From the term gradient itself, we know that the it concerns "rate of change". Thus, this method uses the derivative approximation to find edges. The points where there is a high gradient in an image pixel would be detected.



I tried using all these algorithms in area estimation with the following code:


I was able to write this code after the meeting the activity was given, but it took me so long to debug it. I was so frustrated when I realized my mistakes. Instead of implementing arctan as atan(y,x), I used atan(y./x). Thanks joshua for ranting on me about his mistake! He told me that he made used atan the wrong way. That was when I realized I did the same. Norman also offered help and he pointed out that I got the formula for the Green's function wrong. Funny how all my mistakes are careless ones. I should have my mind more focused on the little matters. When I program something, I tend to focus more on the flow of the commands and execution. I oversee the little ones like wrong index used and/or syntax. I should be more careful now to save time and energy!

Eventually, I was able to estimate the area of the images I have generated using Scilab (circle, square) and Paint (rectangle, triangle). The following table presents the summary of the percent deviations of the estimated area using Green's function with respect to the actual area (pixel count) of the image.


The error in area estimation using sobel is relatively large (~23%). As can be observed from the figure (square) above, only four points are present in representing the square.

To apply this technique, I obtained an image of the QC circle out of the Quezon City map using google maps. The following image is my test image:

area: 52137.393 sq px

It's very interesting that we could actually estimate the area of an image. Indeed, there are a lot of things that can be done using image processing techniques and I'm looking forward to learning more in the next activities. I'm quite sure that these lessons will be very useful in my current research as well as my works in the future. I give myself a grade of 10/10 since I was able to accomplish everything that has to be done, and was able to compare the different edge detecting methods. :)


Walang komento:

Mag-post ng isang Komento