To start, the task is to estimate the area of a certain figure in an image. As a start, we were asked to create black and white pictures of regular polygons. I created five - rectangle, square, circle, equilateral triangle and right triangle - using Paint, as it was the easiest method for me. The background was black, and the shapes were white. Also, the area of the shapes should be analytically known. For my case, I measured the pixel dimensions to obtain the area.
Next, I loaded the image in Scilab and obtained the edge image as asked in the activity. Before running the script I made, however, I typed in help edge on the console to know more about the command. I found out that there are five ways that Scilab calculates for the edges. I used all five methods and compared the results.
So here are my results. First I used the rectangle. I measured the length and width of the figure to be 119 and 449 pixels, respectively, and so the area of the rectangle is 53,431 square pixels (sq. px.).
Figure 1. A rectangle, with an area of
53,341 sq. px.
Then I used all five methods to obtain the edges, and ultimately the area, of the rectangle. First, I used the Sobel gradient estimation method, which uses a pair of 3x3 convolution masks to estimate the gradient along the rows and the columns of a 2x2 matrix (in our case an image) [1]. The result is shown below.
Figure 2. Obtaining the edges of the
rectangle using the Sobel method.
e = edge(im, 'sobel');