Wednesday, June 24, 2009

Activity 2: Area estimation for images with defined edges

In this activity we set out to determine the area of an ROI in a binary image by first tracing its contour then using Green's theorem to calculate the area enclosed. To prepare the image for processing, I first had to convert the image to a binary matrix using the im2bw function. I then used the follow function to trace the ROI's contour. I then implemented the discrete form of green's theorem to finally come up with the area.

After preliminary results Ifound that the area we would calculate was always lacking by half of the contours length. I speculated that the follow function traced the inner contour of the ROI, thus decreasing the area enclosed by some value. M. Sison proposed that to correct the calculated area, we simply add half the length of the contour. After testing the method over various shapes, both regular and irregular, we found the the proposed correction was indeed valid.

Sample Results

Shape 1: 200 x 200 Square

Analytical: 40000 pixels
Pixel count: 40000 pixels
Program: Analytical: 40000 pixels

Shape 2: Robot

Analytical: 32071 pixels
Pixel count: 32701 pixels
Program: 32071 pixels

Shape 3: Irregular

Analytical: N/A
Pixel count: 26526 pixels
Program: 26526 pixels

For this experiment, I give myself a score of 10/10 because I was able to implement the method properly and the results attest to the accuracy of the program.


Monday, June 22, 2009

Activity 3: Histogram and Thresholding

Shape

256x256 robot saved as JPEG

Histogram

The histogram shows that the image's values are concentrated towards the 0 and 255 areas corresponding to black and white respectively. We may say the ROI and background are well separated since each corresponds to one of the narrow peaks of the histogram.

Activity 3: ImageTypes

Indexed / Graphics Interchange Format (GIF)

SRC: http://www.hobby-hour.com/guitar/fender_telecaster1.gif

GIF's are indexed.

BINARY / BITMAP (BMP)

SRC :http://www.rainbarrel.com/monochrm.bmp

Checking the image properties will reveal that the image has a 1-bit bit depth (0 and 1).

True Color / Joint Photographic Experts Group (JPG)

SRC: http://www.penmachine.com/musicpages/musicimages/fender_strat_hardtail.jpg

Checking the image properties will reveal that the image has a 24-bit bit depth (256 values for each of the 3 colors).

Grayscale / Joint Photographic Experts Group (JPG)

SRC: http://press.roncarter.net/RonCarter2_300grayscale.jpg

Checking the image properties will reveal that the image has an 8-bit bit depth (256 values from white to black).

Wednesday, June 17, 2009

Activity 1: DIgital Scanning

For this activity we "digitized" a hand-drawn plot by scanning it and then tabulating the corresponding xy values of the pixels of the points of the plot. To replicate the actual data, we had to figure out the relationship between the actual physical values and the pixel data we've gathered. To do this I measured the pixel distances between grid lines and divided them by their corresponding physical values. I found that the ratio was unconsistent and I ended up with varying ratios per area of the chart. Upon replotting the data, I dealt with this simply by using the different ratios for different points depending on their locations. I came up with the following plot:



The reconstruction was accurate for the first three points, but as the plot progressed, the digitized points (in red) start to deviate from the actual plot. Furthermore, the x=-50 and x=50 grid lines don't seem to match up. While the y deviation simply increses (the digitized points deviate downward) as the plot moves forward, the x deviation increases at the middle of the plot but recovers towards the end. The most probable reason for the error I obtained is that I failed to rotate the image before obtaining the pixel data and so when I was forced to rotate the image later on when overlaying the original, The points matched up only at certain points (probably those that were near the axis of rotation).

For this reason I can only give myself a grade of 7. I was able to follow the procedure for the most part, but a crucial error at the start of my data gathering doomed the final result.