For recitation 9, we were able to extend our learning from the transitions between Arduino and processing. Because we were free to choose what we wanted to do with the media, I decided to build the camera function that would be needed for my project.
In order to make a camera in the phone screen, I took a screenshot of the phone camera screen and covered up the non-camera showing part with the image.
Whenever I was pressing the button connected to Arduino (it would have been cooler if the image could be taken with the actual camera button though- we needed Arduino bit), the processing would make a screenshot of the screen and save in the specific location.
However, there was a shortcoming though.
As you can see from above, because the processing is taking the screenshot of the entire screen, the camera APP part is showing as well, which is different from the usual images inside the gallery.
Below is the code.
Processing:
// IMA NYU Shanghai // Interaction Lab // This code receives one value from Arduino to Processing import processing.serial.*; import processing.video.*; int photoNum = 0; Serial myPort; int valueFromArduino; PImage camera; Capture cam; void setup() { size(335, 690); background(0); printArray(Serial.list()); // this prints out the list of all available serial ports on your computer. myPort = new Serial(this, Serial.list()[5], 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. camera = loadImage("images/camera.png"); setCamera(); } void draw() { // to read the value from the Arduino while ( myPort.available() > 0) { valueFromArduino = myPort.read(); } showCamera(); //println(valueFromArduino); if(valueFromArduino == 1){ save("gallery/"+str(photoNum)+".png"); photoNum++; //println("pressed"); } } void setCamera() { cam = new Capture(this, 640, 480); cam.start(); } void showCamera() { if (cam.available()) { cam.read(); } noStroke(); for (int i=0; i<500; i++) { int size = int( random(10, 30) ); int x = int( random(width) ); int y = int( random(80, 480) ); // get the pixel color color c = cam.get(x, y); // draw a circle with the color fill(c); ellipse(width-x, y+40, size, size); } image(camera, 0, 0); }
Arduino:
// IMA NYU Shanghai
// Interaction Lab
// This code sends one value from Arduino to Processing
void setup() {
Serial.begin(9600);
}
void loop() {
int sensorValue = digitalRead(A0);
Serial.write(sensorValue);
// too fast communication might cause some latency in Processing
// this delay resolves the issue.
delay(10);
}
Below is the demo video.
While I was doing the recitation workshop and was proceeding with my final project, reading through Computer Vision for Artist and Designers inspired and motivated me to work. I grew up in a country which has very serious bullying that approximately 63% of the people have had experienced bullying (including cyber-bullying), and 19% of the people having tried suicidal attempt due to bullying. Reading through this week’s reading, I found two pieces really interesting.
The first was Suicide Box by the Bureau of Inverse Technology. As previously mentioned, the country that I was born and raised is rated as a country with the most suicides amongst OECD countries. Though it is little sad to see this idea having to count people who are jumping off the bridge and is merely counting the numbers when the jumped off person is losing his or her life, I think by knowing the exact statistics, other people may be able to do something about the environment to lessen the number of people doing the suicidal attempt.
The other was Stills from Cheese, an installation by Christian Möller. This was especially interesting because I was thinking to project the user’s face on the trash bin, giving the user the feeling that they were viewed as an (emotional) trash bin. Stills from Cheese, by analyzing the current photo showing up on the screen, is able to tell when the user is smiling or not. If I were to analyze a person’s face, I would be able to only portray the person’s face on the trash bin looking figure. Therefore this piece has gotten me a little sad and motivating at the same time.