Figure 1. Truecolor Image
Figure 4. Binary Image
http://en.wikipedia.org/wiki/File:Neighborhood_watch_bw.png
Figure 5. Grayscale image
http://en.wikipedia.org/wiki/File:Neighborhood_watch_bw.png
Shown below in Figure 5 is a grayscale image and we want to determine the area of the apple in the image. Looking at the histogram in Figure 6, we can say that our region of interest (ROI) is well separated from its background. Therefore, we can use the programming code generated in activity 2 to calculate the area of the apple. The detailed description of the method can be found in the previous blog. Recall that it uses discrete Green's theorem for computing the area of any enclosed region. Before proceeding, we have to convert first the grayscale image into a binary image (in terms of 1's and 0's only) using the function im2bw(). The threshold value to be used in the conversion must be properly chosen to ensure that only the ROI will be in 1's (white). Looking again at the histogram of the image, we see that or ROI has pixel values ranging from ~150 to ~256. The ratio of this is 0.68, so we used 0.65 as our threshold value. Figure 7 shows the contour traced in the image, which was used in implementing Green's theorem. The area calculated by the program is 2871. We validated it by summing the 1s in the binary image and we got the same result. Therefore, we are successful in calculating the area of the apple. We have also shown in the previous blog that the method we used is accurate to about 1%. And for this, I would give myself a grade of 9. Just 9 because I was super late already in finishing this activity.
Figure 5. Grayscale image
I would like to thank Mr. Luis Buno III and Mr. Miguel Sison for their help..
No comments:
Post a Comment