Monday, July 27, 2009

違う。違うよ。(Activity # 9)

Activity # 9 is entitled Binary Operations. It is very important in image-based measurements where a Region of Interest (ROI) is segmented from the background by means of edge detection or blob labelling. Some common problems in image processing where these operations are used include cell counting, tracking of fingerprint ridges and pattern recognition.

In this activity, we've been given the task of estimating the area (in pixels) of a typical puncher hole, using a reference image that looks like this:

In order to make life easier for both scilab and me, I divided the image into nine parts..

For the first subimage, the next step is thresholding. Using Photoshop (I'm working at home since I had to do this activity again.. why? Coz i lost my flash disk!!), I obtained the suitable threshold value of 230/255.

Once the threshold was found, I made use of the erosion and dilation operations from the previous activity, to perform the closing and opening operations. I used the closing operation (dilate then erode) to clean up my image, after which I used bwlabel() to label the blobs.

Finally, I used my routine for counting the pixels of the same label, tallied them into an array, and repeated the procedure for the rest of the subimages.

I tallied the areas for all the holes in the large image by appending the tallies for each of the sub-images, and I got this histogram:

I realize that as it is, there's still a lot of noise in the image. However, we are only after the area for each punch hole, thus we can also just trim our histogram by setting a tolerance level. I decided to set my tolerance between 300 and 700, the location at which the second peak is centered.

We can see that the peak is located between 512.5 and 525--but the mean value however tells us that it's 507.5. The histogram tells us that the size of the hole should be about 517 pixels, giving the mean an error estimate of around 3%.

I managed to finish the activity in a few minutes (when I had to do it again), so I definitely get a 10. hahaha.

No comments:

Post a Comment