[blobs drumming PIC] Chapter VBI-5.   Blobs Drumming

 

This chapter does not appear in the book.

 

A particularly simple technique for detecting shapes (or blobs) in an image is to look for regions consisting of the same color. My BlobsDrumming application, shown in the screenshot above, looks for light blue and red blobs, and highlights them as rectangles.

The screen area is divided into nine 'drumming' areas (shown as translucent labeled circles in the screenshot). If the center of a blob rectangle falls within one of these areas, then a sequence of percussion beats is generated. In the screenshot, my PC's speakers are emitting a mix of whistles and vibraslap beats.

A rectangle's orientation affects tempo, with a faster beat assigned to a rectangle whose long edge is rotated away from the vertical. Since the red card shown in the screenshot is almost horizontal, the vibraslaps occur with great rapidity.

The noise produced can hardly be called music, although moving the cards around the screen produces some amusing percussion effects (amusing for me, but perhaps not so much for my cubicle neighbors).

I'll start this chapter with a brief introduction to MIDI sound synthesis, which is how the percussion sounds are generated. Then I'll describe blob detection using contour finding in the OpenCV computer vision library. OpenCV, and its Java interface (called JavaCV), were introduced back in Chapter VBI-2.

Detection success greatly depends on the quality of the camera and the lighting conditions. For instance, the difference between indoor and natural lighting are enough to confuse a detector. For that reason, blob detection must be preceded by a "color calculation" phase where color attributes for the cards are obtained under the same camera and environmental conditions that are used later by the BlobsDrumming application. I obtain these color calculations using a separate application, called HSVSelector. It represents colors in the HSV format (hue/color, saturation, and value/brightness), which makes it easier for the detector to ignore variations in brightness.

 

Downloads


Navigation:


Dr. Andrew Davison
E-mail: ad@coe.psu.ac.th
Back to my home page