<< Chapter < Page | Chapter >> Page > |
Given the acquired frames, the first step is to locate the LEDs. The color of the LEDs can be described by the intensity of red, green and blue. These are represented by values between 0 and 255 (going from null intensity to full intensity) in the RGB matrices for each image. We can detect the LEDs by setting threshold values for Red, Green and Blue. For example, to find the Red LED, you are looking for the part of the frame with high Red values and low Blue and Green values. We would recommend using the data cursor to analyze RGB values of the LED in the colormap. Play around with threshold values until you get the right thresholds, i.e., only the LED you are trying to detect shows up.
In our project, we used the find function to look at the red, green and blue matrices separately and set ones wherever the conditions were satisfied. We multiply the three matrices of ones and zeros to produce one final matrix with ones where all three color thresholds are satisfied and the LED is detected.
If the LEDs are not detected for 75% of the frames, it means that the LEDs are either turned off or not in the frame at all, and the program stops running. However, if the LEDs have been found, you can move on to detecting when the drums are hit.
Notification Switch
Would you like to follow the 'Tap that: a virtual drum kit' conversation and receive update notifications?