Assignment 10_Sensor Display: RandomPointillism

800px-A_Sunday_on_La_Grande_Jatte,_Georges_Seurat,_1884

Pointillism is a way of painting where every dot that is painted is calculated through scientific rules that Seurat had created. It uses pure colour and is carefully placed. Since I wanted to go against this scientific method I created a machine where people can play with the pointillism. Not 100 percent can be controlled by the interacting person but some parts can be.

20141029_155739

In my project, the person first uses the button to capture the screen. Then the screen is turned into a canvas where it starts placing dots according to the original photo colours. However, when the person pushes the button down, randomness is added to the dots. The colours and sizes and density is changed to random scale which was my way of interacting with the painting that processing was making.

IMG_20141029_154855

Sensor_Display

 

 

Code for the Arduino

int buttonState = 0;         // variable for reading the pushbutton status

void setup() {       
 Serial.begin(9600); 
}

void loop(){
  // read the state of the pushbutton value:
  buttonState = digitalRead(13);
  // check if the pushbutton is pressed.
  // if it is, the buttonState is HIGH:
  Serial.println(buttonState);
  delay(100);
}

Code for the Processing

import processing.video.*; 
import processing.serial.*;

Serial myPort;
char val;
float sizeR;
float randomC; 
float lightness;

PImage img;

Capture myCapture; 

String filename = "portrait.jpg"; 

void setup () { 
  size (640, 480); 
  myCapture = new Capture(this, width, height, 30); 
  myCapture.start();
  
  String portName = Serial.list()[2]; 
  myPort = new Serial(this, portName, 9600);
  
  background(255);
  smooth();
} 

void captureEvent (Capture myCapture) { 
  myCapture.read (); 
} 

void draw() { 
  File f = new File(dataPath(filename));
  println(dataPath(filename), f.exists());
  if(f.exists()){
  img = loadImage("portrait.jpg");
  
  if (myPort.available() > 0){
    val = (char) myPort.read();
  }
  
  if (val == 48){
    sizeR = random(10,40);
    randomC = 100;
    lightness = random(50,150);
  }else{
    sizeR = 15;
    randomC = 0;
    lightness = 100;
  }
  
  pointilism();
  }else{
    image (myCapture, 0, 0); 
    
    if (myPort.available() > 0){
      val = (char) myPort.read();
    }
  
    if (val == 48){
      myCapture.stop();    
      save("data/portrait.jpg");
      background(255);
    }
  }
} 

void pointilism(){
  
  int x = int(random(img.width));
  int y = int(random(img.height));
  int loc = x + y*img.width;

  loadPixels();
  float r = red(img.pixels[loc]);
  float g = green(img.pixels[loc]);
  float b = blue(img.pixels[loc]);
  
  noStroke();
  fill(random(r-randomC,r+randomC),random(g-randomC,g+randomC),
  random(b-randomC,b+randomC),lightness);
  ellipse(x,y,sizeR,sizeR); 
}

Comments are closed.