Generative Sculpture ›shine on you crazy diamond‹

Generative Skulptur ›shine on you crazy diamond‹

›shine on you crazy diamond‹ verwendet lo-fi Elektronik, Mechanik und stochastische Operationen. Ein Foto von Syd Barret wird auf seine Rot, Grün und Blau Bestandteile analysiert und diese in Daten-Arrays abgelegt. Diese werden verwendet, um eine als „Lichtdrucker“ bezeichnete mechatronische Konstruktion anzusteuern. Eine Farb-LED leuchtet, während sie in einer  Ebene in einem zweidimensionalen Random Walk geführt wird. Diese Bewegung wird von einer Fotokamera mit langzeitbelichtung aufgenommen. So entstehen, indem die LED scheint, in jeder Instanz der Bewegung nach stochastischen Regeln generierte Bilder, die Varianten Syd Barrets visualisieren.

SydSquare
Flussdiagramm

// --------------------------------------------------
// shine on you crazy diamond
// Extracting RGB Values
// Language: Arduino/Processing
// Author: Andreas Pirchner
// --------------------------------------------------

void setup () {
  size (500, 500);
   int loc;
  PImage img = loadImage ("SydSquare50.jpg");  
 image (img, 0, 0);
 float [] [] redArray;
 float [] [] greenArray;
 float [] [] blueArray;
 redArray = new float [img.width] [img.height];
 greenArray = new float [img.width] [img.height];
 blueArray = new float [img.width] [img.height];

 for (int px = 0; px < img.width; px+=1) {
    for (int py = 0; py < img.height; py+=1) {
      /*loc = i + j * img.width;    */

      /*color c = img.pixels[loc]; */// Get a pixel  
      color c = img.get (px, py);  
      redArray [px] [py] = red(c);
      greenArray [px] [py] = green(c);
      blueArray [px] [py] = blue(c);
      //println (int(redArray [px] [py]),greenArray [px] [py],blueArray [px] [py]);
    }
 }

   PrintWriter outputRed;
   PrintWriter outputGreen;
   PrintWriter outputBlue;
   outputRed = createWriter("output/red.txt"); 
   outputGreen = createWriter("output/green.txt"); 
   outputBlue = createWriter("output/blue.txt"); 

   for (int px = 0; px < img.width; px+=1) {
    for (int py = 0; py < img.height; py+=1) {

      outputRed.print(int(redArray [px] [py]));
      outputGreen.print(int(greenArray [px] [py]));
      outputBlue.print(int(blueArray [px] [py]));

      outputRed.print(",");
      outputGreen.print(",");
      outputBlue.print(",");

      color rPrint = color(int (redArray [px] [py]),0,0); 
      color gPrint = color(0, int (greenArray [px] [py]),0);
      color bPrint = color(0,0, int (blueArray [px] [py]));
      color allPrint = color(int (redArray [px] [py]), int (greenArray [px] [py]), int (blueArray [px] [py]));
      set (px, py, rPrint+bPrint+gPrint);
    }
   }

   outputRed.close(); 
   outputGreen.close(); 
   outputBlue.close(); 
  }

void draw () {

}

// --------------------------------------------------
// shine on you crazy diamond
// Read RGB from SD-Card an Display it though LED
// Language: Arduino/Processing
// Author: Andreas Pirchner
// --------------------------------------------------

#include 

File redFile;
File greenFile;
File blueFile;

int redPin = 6;
int greenPin = 5;
int bluePin = 3;

void setup()
{
 // Open serial communications and wait for port to open:
  Serial.begin(9600);

  Serial.print("Initializing SD card...");
   pinMode(10, OUTPUT);

  if (!SD.begin(4)) {
    Serial.println("initialization failed!");
    return;
  }
  Serial.println("initialization done.");

  redFile = SD.open("red.txt");
  greenFile = SD.open("green.txt");
  blueFile = SD.open("blue.txt");
  //if (redFile) {
      int counter = 0;  
      while (counter < 2500) {
            int redNumber = redFile.read();
            int greenNumber = greenFile.read();
            int blueNumber = blueFile.read();
            setColor(100, 0, 50);	
            delay(100);
            counter = counter + 1;

      }   

        redFile.close();
        greenFile.close();
        blueFile.close();
 // }
}

void loop()
{
	// nothing happens after setup
}

void setColor(int red, int green, int blue)
{
  #ifdef COMMON_ANODE
  red = 255 - red;
  green = 255 - green;
  blue = 255 - blue;
  #endif
  analogWrite(redPin, red);
  analogWrite(greenPin, green);
  analogWrite(bluePin, blue);
}