Thursday, August 18, 2011

Activity 11 – Playing Notes by Image Processing

Its been a week since my last post in here. I think I better do this quickly. In this activity, we were asked to look for music sheet. This music sheet is played with the use of image processing. We need to capture the notes and then convert them into their equivalent tones according to their position in the music sheet. I have chosen the song, London Bridge Is Falling Down shown in figure 1. This was the first image that is short and maybe easy to use.

London Bridge
Figure 1. Original Musical Sheet from www.8notes.com

This image has been cropped and the notes below a quarter/half note were removed also. The cropped version is shown in figure 2.

cropped
Figure 2. Cropped image

When imported in scilab, the black part was converted into white and vice versa. After doing this, a template is produced similar to the notes in the image. A (a) half note and a (b) quarter note was used to capture its position in the image as shown in figure 3.

image
Figure 3. (a) Half-note and (b) quarter note templates

Convolution between the template and the music sheet were done and the resulting image is seen in top row of figure 4 (a and b for half-note and quarter-note templates, respectively). These images were converted into binary images and were added to one another to complete the whole song seen in figure 4(bottom row). The notes were decreased into single point in order to easily distinguish what part of the music line it is seen.

image
Figure 4. (top row) Correlation between the music sheet and (a)half-note template and (b)quarter-note template.(bottom row)Binary image of the images above.

The frequencies for the notes were collected from http://www.phy.mtu.edu/~suits/notefreqs.html. The notes used were G3,A3,B3,C4,D4, and E4. These notes came from the music sheet and the final song can be downloaded in London Bridge.wav.

I will rate myself with 8 points because I passed the required task and uploaded the song that I have created. Thank you for browsing my blog. =)

Saturday, August 6, 2011

Activity 10 - Binary Operations


In this activity, we were taught to use opening and closing operations in binary. These operations are simple. Closing operation is simply taking erosion of the dilation of the image. In this case, the object of interest becomes the dark part while the white part is the background. Opposite of closing operation is the opening operation wherein the object becomes the white and the background is the dark part. Figure 1 shows this difference between the two.
Figure 1. Closing and Opening operation
That was not the only activity that was given to us. It is to estimate the area of the circles in figure 2(a). Figure 2(b) is the cropped version of figure 2(a). The cropped version coincide in the 2nd & 3rd, 5th & 6th, 8th & 9th, and 11th & 12th image. In this part, the use of closing or opening operation were used to isolate the circles seen in the image.
Figure 2. (a)Original image and (b) cropped image using paint.

Figure 3 shows the cropped images that were cleaned with the use of opening operation. It can be observed that some circles are not of the same size as the others. This is due to the conversion used in im2bw function.
Figure 3. Cleaned cropped image with the use of opening operator
Table 1 shows the estimate area of the circles. In counting the number of pixels of the circles, the function bwlabel was used. This function simply tag the objects with increasing numbers. If the objects have similar sizes, they have the same tag.

Table 1.Estimated area of a circle
Area (in pixel)        445      
Finally, the last part of the activity is to detect the enlarged circles seen in figure 4(a). The processed image with the use of opening operator is seen in figure 4(b). In detecting the enlarged circle, the same method were used as above and the area were obtained in pixel. It can be observed that the area of the enlarged circles are smaller than that of the overlapping circles and larger than that of a single circle. Then the final image as shown by figure 5(b) is the five enlarged circles that are seen in the original image.
Figure 4. (a) Original image and (b) processed image with the use of opening operator

Figure 5. (a) Original image and (b) extraction of the enlarged circles


I guess this is all. This is due last Thursday, 4 August 2011. I am late, I know. This is due to my laptop who is slowly dying. I can't work with it anymore. Anyway, I will give myself a score of 8 because of my late submission and my mistake in making the other sub-images a clean image. There are images that did not locate any circles. The mistake I made was the threshold used for subimage 1 was carried out to the rest of the subimages, which is wrong.

Thank you for your time.