Vor 1 Jahr
9th
Januar
Anmerkungen
Reblog
Vor 1 Jahr

Meine Optimierte Version des ersten Versuchs.
Statt 250 verschiedener Bilder generiere ich nur
noch eines, dieses aber immer und ewig. In der Version
davor konnte ich nach mehr Kriterien Das Bild durch
suchen, aber es hat enorm viel Speicher gekostet ein
normal großes Bild 250x Jedes Pixel einzeln im
Arbeitsspeicher zu haben und dazu auch noch alle
Farbinformationen seperat auch noch.

Code: 

import ddf.minim.*;
import ddf.minim.effects.*;

Minim minim;
AudioPlayer groove;
LowPassSP lpf;
int sndVolume;

PImage img;
PGraphics pg;	

int xpos, ypos;
int imgWidth, imgHeight;
int runden = 250;
Boolean control = true;

int pxlStep = 2300;        /*how many pixels should be steped */
String quelle = "avatar";  /* filename */
String prefix = ".jpg";    /* file prefix */
String mp3File = "test.mp3";



/* ARRAYs for all Pixel Data needed*/

  int[] pxlX;
  int[] pxlY;
  int[] pxlR;
  int[] pxlG;
  int[] pxlB; 

void setup() {

  /* not important */
  background(255);
  smooth();
  colorMode(RGB);

  

  /*init Sound stuff*/
  minim = new Minim(this);
  groove = minim.loadFile(mp3File);
  groove.loop();

  /* load that image and setup */
  img = loadImage(quelle+prefix);
  imgWidth = img.width;
  imgHeight = img.height;
  println("width: " + imgWidth + "px, height: " + imgHeight + "px");

  

  /* Grafic Layer needed, don't wannt to manipulate
     loaded original image */

  pg = createGraphics(imgWidth, imgHeight, P2D);
  size(imgWidth, imgHeight);
  /*noFill();*/
  noStroke();
  int i = 0;
  int j = 0;
  int counter = 0;

  

  /* GET ALL DATE YOU NEED */

  image(img,0,0);
  img.loadPixels();
  int pxlLen = img.pixels.length;

  

  /* the Pixel Array need to be as long as
     much pixels are in the image */

  pxlX = new int[pxlLen+1];
  pxlY = new int[pxlLen+1];
  pxlR = new int[pxlLen+1];
  pxlG = new int[pxlLen+1];
  pxlB = new int[pxlLen+1]; 

  

  /* now get them data */

  while(i
Vor 1 Jahr 3 Anmerkungen

Hab den Code jetzt so umgeschrieben, das er Bilder zu Musik verändert. PURE AWESOMENESS.

coole Standbilder gibt es hier: http://jfxdump.tumblr.com/post/2602951613/processing-versuch2

Vor 1 Jahr 1 Anmerkung

yeah, wieder bisschen Bildmanipulation mit Processing betrieben.
Des macht langsam echt Laune. Sind natürlich alles noch kleine
Anfänger Sachen, aber jeder wächst erstmal (:

Der Code merkt sich Pixel und die dazugehörige Farbe, danach 
wertet er aus, wie häufig eine Farbe vorkommt. Je öfter eine Farbe
auftritt desto größer ist ihr Punkt. Die Bilder variieren nach Steps
dich eingebaut habe. Es wird nicht jeder Pixel berücksichtigt.
Je mehr Pixel übersprungen werden, desto größer ist die Auswirkung
wie oft ihre Farbe vorkommt. 

Hier ein Video, wie das Bild auch über Musik manipuliert wird: http://jfxdump.tumblr.com/post/2603781353/processing-versuch3

Hier der Code:

PImage img;

PGraphics pg;

int xpos, ypos;

int imgWidth, imgHeight;

String quelle = “avatar”;  

String prefix = “.jpg”;

void setup() {

  background(255);

  smooth();

  colorMode(RGB);

  img = loadImage(quelle+prefix);

  imgWidth = img.width;

  imgHeight = img.height;

  println(“width: ” + imgWidth + “px, height: ” + imgHeight + “px”);

  pg = createGraphics(imgWidth, imgHeight, P2D);

  pg.smooth();

  pg.colorMode(RGB);

  size(imgWidth, imgHeight);

  /*noFill();*/

  noStroke();

  noLoop();

}

void draw() {

  /*image(img,0,0);*/

  loadPixels();

  println(pixels.length);

  int i = 0;

  int j = 0;

  int counter = 0;

  int pxlStep = 75;

  int pxlLen = pixels.length;

  int[] pxlX = new int[pixels.length+1];

  int[] pxlY = new int[pixels.length+1];

  int[] pxlR = new int[pixels.length+1];

  int[] pxlG = new int[pixels.length+1];

  int[] pxlB = new int[pixels.length+1]; 

  /* GET ALL DATE YOU NEED */

  while(i<pxlLen) {

      pxlR[i] = int(red(img.pixels[i]));

      pxlG[i] = int(green(img.pixels[i]));

      pxlB[i] = int(blue(img.pixels[i]));

      pxlY[i] = int(i/imgWidth);

      pxlX[i] = int(i-(pxlY[i]*imgWidth));

      i = i + pxlStep;  

  }

  /* BUILD IMAGE */ 

  pg.beginDraw();

  pg.background(255);

  i = 0;

  while(i<pxlLen) {

      pxlR[i] = int(red(img.pixels[i]));

      pxlG[i] = int(green(img.pixels[i]));

      pxlB[i] = int(blue(img.pixels[i]));

      /*stroke(pxlR[i],pxlG[i],pxlB[i]);

      point(pxlX[i],pxlY[i]);*/

      j =0;

      counter = 1;

      while(j<pxlLen) {

        if(pxlR[i]==pxlR[j] && pxlR[i]==pxlR[j] && pxlR[i]==pxlR[j]){

            counter = counter + 1; 

        }

        j = j + pxlStep;

      }

      pg.noStroke();

      pg.fill(pxlR[i],pxlG[i],pxlB[i]);

      counter = int(pxlStep/counter);

      pg.ellipse(pxlX[i],pxlY[i],counter,counter); 

            /*fill(r,g,b);*/

            rectMode(CENTER);

            pxlY[i] = int(i/imgWidth);

            pxlX[i] = int(i-(pxlY[i]*imgWidth));

            /*println(“x:” + xpos + ” y:” + ypos);

            rect(xpos,ypos,50,50);

            float dim = 1 * 15 * int(random(1,40));

            ellipse(xpos,ypos,25,25);

            point(xpos,ypos);*/  

      i = i + pxlStep;  

  }

  pg.endDraw();

  image(pg, 0, 0);

  if(pxlStep<10) {pg.save(      quelle + “00” + pxlStep +”.tif”);}

  if(pxlStep>9 && pxlStep<99) {pg.save(quelle + “0” + pxlStep +”.tif”);}

  if(pxlStep>99) {              pg.save(quelle  + pxlStep +”.tif”);}

  println(“ENDE”);

Vor 1 Jahr

Ein Standbild aus meinem ersten Processing Gehversuch. 

> Code und Video gibt es hier <

> Debug Screens hier <

Vor 1 Jahr

Die einzelnen Schritte die mein Processing Programm ‘sieht’. Hab Screenshots davon was gemacht als ich am debuggen und feinjustieren war. 

> Code und Video gibt es hier <

Vor 1 Jahr

Mein erster Gehversuch in Processing. Nach ein paar
kleinen Einstiegsproblemen heute Mittag hab ich nach
weniger Zeit schon schön was zusammen basteln
können. Hier sieht man ein Bild, welches ich vom Balkon
aus geschossen habe. Es werden Lautstärke Kreise 
generiert um die orangenen Baufahrzeuge.

> Debug Screens gibt es hier <

> Standbild gibt es hier <

CODE:

import ddf.minim.*;

PImage img;

int xpos;

int ypos;

Minim minim;

AudioInput input;

void setup() {

  size(1280,720);

  background(0);

  smooth();

  img = loadImage(“baustelle.jpg”);

  noFill();

  minim = new Minim (this);

  input = minim.getLineIn (Minim.STEREO, 512);

}

void draw() {

  image(img,0,0);

  println(img.width);

  println(img.height);

  loadPixels();

  println(pixels.length);

  int i = 0;  

  while(i<pixels.length) {

      int r = int(red(img.pixels[i]));

      int g = int(green(img.pixels[i]));

      int b = int(blue(img.pixels[i]));

      if((r>g)) {

        if (g>b) {

          if (r<180) {

            if (g<100) {

              if (b<50) {

                if (r>100) {

            stroke(r,g,b);

            /*fill(r,g,b);*/

            rectMode(CENTER);

            ypos = int(i/1280);

            xpos = int(i-(ypos*1280));

            /*println(“x:” + xpos + ” y:” + ypos);*/

            /*rect(xpos,ypos,50,50);*/

            float dim = input.mix.level () * 250;

            ellipse(xpos,ypos,dim,dim);

            /*point(xpos,ypos);*/

                }

              }

            }

          }

        }

      }

      i = i + 50;

  }

Vor 1 Jahr