Moving image with a varied tint.
Processing:
import processing.serial.*;
import processing.video.*;
Movie myMovie;
Serial myPort;
int valueFromArduino;
void setup() {
size(500, 500);
background(0);
myMovie = new Movie(this, “dancing.mp4”);
myMovie.play();
printArray(Serial.list());
// this prints out the list of all available serial ports on your computer.
myPort = new Serial(this, Serial.list()[ 12 ], 9600);
// WARNING!
// You will definitely get an error here.
// Change the PORT_INDEX to 0 and try running it again.
// And then, check the list of the ports,
// find the port “/dev/cu.usbmodem—-” or “/dev/tty.usbmodem—-”
// and replace PORT_INDEX above with the index number of the port.
}
void draw() {
// to read the value from the Arduino
while ( myPort.available() > 0) {
valueFromArduino = myPort.read();
// fill (250);
//ellipse(200,200,valueFromArduino,valueFromArduino);
}
if (myMovie.available()) {
myMovie.read();
}
tint(valueFromArduino, 0, 0);
image(myMovie, 0, 0);
println(valueFromArduino);//This prints out the values from Arduino
}
Arduino:
// IMA NYU Shanghai
// Interaction Lab
// This code sends one value from Arduino to Processing
void setup() {
Serial.begin(9600);
}
void loop() {
int sensorValue = analogRead(A0) / 4;
Serial.write(sensorValue);
// too fast communication might cause some latency in Processing
// this delay resolves the issue.
delay(10);
}
Reflection:
In the reading Computer Vision for Artists and Designers, there is a quote that reads, “Processing is one such environment, which, through an abundance of graphical capabilities, is extremely wellsuited to the electronic arts and visual
design communities. Used worldwide by students, artists, designers, architects, and researchers for learning, prototyping, and production, Processing obtains live video through a QuickTimebased interface, and allows for fast manipulations of pixel buffers with a Javabased scripting language.” Levin, Raes, and Fry are articulating the potential processing has in the visual media arts which is exactly what we took part in during the recitation exercise. Although I was only able to complete the task using one sensor to manipulate one aspect of the video, I feel that this could be further utilized in more advanced software technology such as automizing color grading in film or photography.