Testing Webcam and Wekinator for interactive machine learning. This is a simple application that detects whether I am a normal person, wearing sunglasses, or a celebrity in disguise.
argmax
over 3 dimensions---I'm a normal person, wearing sunglasses, or a celebrity in disguiseUsing the color blue to control a synthesizer in ChucK. Wekinator allows for a really diverse mapping and linear interpolation of inputs. Here, I explore color, in both the visual and sonic sense of the word. Tracked with my webcam in Python, blue becomes a wand for gresture control. Gestures map to sliders controlling polyphony, frequency modulation paramters, inversions, and the blending of voices. This allows Locke's Two Treatises of Government to be "read" in a new way, as a gestural instrument.
cv2
library. RBG values are extracted and we create an image mask for the color blue.
Using Image Processing techniques in Python and interactive machine learning with Wekinator for musical control in ChucK. Image contour detection is similar to edge detection
but also connects edges into closed paths. In this Webcam + Wekinator application, I'm finding image contours for object detection, and getting the centroid of the contour as well
as the arc length of all the contours. As the centroid leans to the right, the music speeds up, and vice versa. With the presence of more contours, aka more edges in the picture, the music
becomes more distorted. This comes together for a unique and interactive mapping between image contours and music. This works best on a clean background but can
be easily retrained with Wekinator's interactive machine learning approach on the fly.
Music is Candyland by Tobu
cv2
library. Input is grayscaled, and contours are extracted using threshold analysis cv2.threshold()
and cv2.findContours()
SndBuf2
for music file playback, and continually updates playback rate with output 1 (rate between .5x and 1.5x) (reverbed when slowed)Gen17
UGen for Chebyshev polynomials. Distortion is modified from Colin Sullivan 2009.
For this Wekinator Etude, it was a lot of fun only using Webcam as the input device. Python and the cv2
library make this really easy to do. It's admirable in a way how I've
put all my image processing knowledge traditionally for medical imaging techniques to use to make funny sounds. Wekinator is pretty easy to use and nice to be able to leverage
it's interactive machine learning approach for training on the fly. I was able to get a lot of success and control using extremly low dimensional input data.
The biggest hurdle that I had to overcome in this assignment was noise. Especially because I'm using webcam input, the location that I'm in is super important. The blue synthesizer works best indoors but even then
there can be a lot of blue leakage from lights or digital noise. The image contour one works best on a clean background and color doesn't matter. If I move to a new location, I need to train the entire system again.
Thankfully Wekinator makes this easy. Sometimes, that noise is part of the charm. But despite all this, webcam is a really fun input device to use, especially in all the ways that the webcam wasn't designed to be used.
The precision is really good and overall super responsive.
Download all the source code: here
Learn more about this programming etude with Wekinator: here