akluk-Project-09-portrait

sketch

// Alvin Luk
// akluk@andrew.cmu.edu
// Section A
// Project 9

// variable to store the image
var img;
var cur_x;
var cur_y;
var rand_x;
var rand_y;
var rand_t;
var type_shape;
var pix;
var siz;

function preload(){
  img = loadImage("https://i.imgur.com/z1yTE1v.jpg");
  img.loadPixels();
}

function setup(){
  createCanvas (477,478);
  background(255);
  noStroke();
  //set ellispe mode to center
  ellipseMode(CENTER);
  frameRate(10000);
}

function draw(){
  //Select random point on canvas to draw
  rand_x = random(img.width);
  rand_y = random(img.height);
  cur_x = floor(rand_x);
  cur_y = floor(rand_y);
  //get the value at the position of the image
  pix = img.get(cur_x, cur_y);
  //generate a random size of the shape
  siz = random(3,6);
  //randomize which shape to draw 
  type_shape = random([0,1,2]);
  fill(pix);

  //depending on the random value of type shape: choose triangle circle or square
  if (type_shape == 0){
  	triangle(cur_x, cur_y-(2/3)*siz, cur_x-(1/2)*siz, cur_y+(1/3)*siz, cur_x+(1/2)*siz, cur_y+(1/3)*siz); 	
  }
  else if (type_shape == 1){
  	ellipse(cur_x, cur_y,siz,siz);
  }
  else {
  	rect(cur_x-siz/2,cur_y-siz/2,siz,siz);
  }

}

For this portrait, I asked if my sister if I could use one of her older photos. For the project, I just played around with what variables I could randomize to make it more interesting. I decided to incorporate the three elementary shapes, a square, a triangle, and a circle to reconstruct my image. I also varied the size of the shapes that were used to reconstruct the image. Below are just some screen shots of the program, at it’s initial, intermediate, and “final” reconstruction of the image.

What the canvas looks like initially

Intermediate Stage

Final result

agusman-Project09-Portrait

sketch

//Anna Gusman
//agusman@andrew.cmu.edu
//Section E
//
//Assignment 06 B
var underlyingImage;
var vals = [0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001]; //declare array of pie slice percentages
var nVals = vals.length; //length of array values

var start = 0; //first set the starting point of the first arc = to 0
var end = start + vals[0] * 360;
//Set the ending point of arc relative to its starting point
//the arc + the percentage value (decimal * 360)

function preload() {
    var myImageURL = "https://i.imgur.com/wU90PUnl.jpg";
    underlyingImage = loadImage(myImageURL);
}

function setup() {
    createCanvas(400, 400);
    background(0);
    angleMode(DEGREES);
    underlyingImage.loadPixels();
    frameRate(5000);
}

function draw() {
    for (var i = 0; i < nVals; i++) {
      start = end;
      end = start + vals[i] * 360; //draw a new arc from the "end" of the preceding
      //arc for every i
      noStroke();
      var px = random(width);
      var py = random(height);
      var ix = constrain(floor(px), 0, width-1);
      var iy = constrain(floor(py), 0, height-1);
      var theColorAtLocationXY = underlyingImage.get(ix, iy);
      fill(theColorAtLocationXY);
      arc(px, py, 30, 100, start, end);
    }
}

I had a ton of fun with this project, even though the outcome was not as expected. I was inspired by a few pieces I’d seen by Sergio Albiac with sample pixel colors across the circumference of randomly distributed circles.

I decided to play with the rotational theme myself. Here are some examples of my process.

Photograph of my twin sister, taken by me:

Experimenting with texture parameters: Dreary Downpour

Slightly more defined

Furry Golan

More furry Golan

Most furry Golan

atraylor – Project 09 – Section B

sketch

//atraylor@andrew.cmu.edu
//project 09
//Section B

var face = "https://i.imgur.com/q6OIZVm.jpg";
var imScale = 10;
var offset = [];
var step = [];
function preload(){
    currentImage = loadImage(face);
}
function setup() {
    createCanvas(480, 480);
    background(220);
    currentImage.loadPixels();
    for(var i = 0; i < 2400; i++){
        offset.push(random(-2, 2));
        step.push(random(-100, 100));
    }
}
function draw() {
    pixelDensity(1);
    // currentImage.loadPixels();
    currentImage.loadPixels();
    // Render the current image to the canvas.
    image(currentImage, 0, 0);
    background(230);

    for (var y = 0; y < currentImage.height; y++){ // y location of pixels
        for (var x = 0; x < currentImage.width; x++) { // x location of pixels
            var index = (x + y * currentImage.width) * 4; // to analyze the rgba values in the pixels

            var p = []; // the pixel array
            p[0] = currentImage.pixels[index]; // r
            p[1]= currentImage.pixels[index+1]; // g
            p[2] = currentImage.pixels[index+2]; // b
            p[3] = currentImage.pixels[index+3]; // a

            var brightP = brightness(p);
            //draw "pixels"
            fill(brightP);
            strokeWeight(.09);
            rect(x* imScale + noise(offset[x]), y* imScale + noise(offset[y]), imScale, imScale);
            offset[x] += step[x];
            offset[y] += step[y];
        }
    }
}

 

Here is a digital portrait of me and my sister, or my sister and me? We’re two years apart but people, to our confusion, always think we’re twins. We did a face-swap one day and it was hilarious: we didn’t seem to change at all.

merlebac Project-09-Portrait

Pixel Portrait

// Matthew Erlebacher
// Section B
// merlebac@andrew.cmu.edu
// Project-09

var underlyingImage;

function preload() {
    var myImageURL = "https://i.imgur.com/lcdPSVo.jpg";
    underlyingImage = loadImage(myImageURL);
    // Loads the image and turns it into a variable
}

function setup() {
    createCanvas(500, 480);
    background(0);
    underlyingImage.loadPixels();
    frameRate(60);
    // I increased the frame rate to 60 so it would appear faster
}

function draw() {
    var px1 = random(width);
    var py1 = random(height);
    // Creates random location for small square
    var px2 = random(width);
    var py2 = random(height);
    // Creates random location for large square
    var ix1 = constrain(floor(px1), 0, width-1);
    var iy1 = constrain(floor(py1), 0, height-1);
    // Constrains px1 and py1
    var ix2 = constrain(floor(px2), 0, width-1);
    var iy2 = constrain(floor(py2), 0, height-1);
    // Constrains px1 and py1
    var theColorAtLocationXY = underlyingImage.get(ix1, iy1);
    var theColorAtLocationXY = underlyingImage.get(ix2, iy2);

    noStroke();
    fill(theColorAtLocationXY);
    // Fills the squares with portions of the image
    rect(px1, py1, 6, 6);
    rect(px2, py2, 9, 9);
    // Generates random rectangles

    var theColorAtTheMouse = underlyingImage.get(mouseX, mouseY);
    stroke(theColorAtTheMouse);
    line(pmouseX, pmouseY, mouseX, mouseY);
}

Working on this project was extremely difficult for me. For some reason the image wouldn’t generate a large amount of the time. Some of the edits that I made were increasing the frame rate, and changing the ellipses to rectangles. I did this because I thought the rectangles looked more visually appealing and covered the screen more quickly.

jknip-Project-09-portrait

sketch

/*Jessica Nip
Section A
jknip@andrew.cmu.edu
Project-09
*/


var img;

//--------------------------
function preload() {
    //preload grandma's image
    img = loadImage("https://i.imgur.com/G6dnwgf.jpg");

}
 //-------------------------
function setup() {
    createCanvas(342,480);
    img.loadPixels();
    frameRate(200); //set fast frame rate
}
 
 //-------------------------
function draw() {
    //define X and Y pixels of image, randomize appearance position
    var Xpixel = constrain(floor(random(width)), 0, width-1);
    var Ypixel = constrain(floor(random(height)), 0, height-1);
    //image color = grab pixels from image
    var imgcolor = img.get(Xpixel, Ypixel);
    var randomSize = random(5,15);

    //set ellipse color to image pixel color
    fill(imgcolor);
    noStroke(); //remove border
    //set ellipse X and Y to randomized pixel positions
    ellipse(Xpixel, Ypixel, randomSize, randomSize); 
}



For this project, I wanted to create a fun randomized ellipse-based filter generated based on a photo of my grandmother. Below you will find some screenshots at different points of the rendering process. As the colors in the original image were fairly limited and grouped in simple forms, I wanted to use randomized ellipses to suggest those specific colors across the canvas from the beginning — the overall image also becomes more apparent early on due to the high visibility of these core forms.

jamieh-LookingOutwards-09

I found Hamza’s week 7 post about Santiago Ortiz’s (from Moebio Labs) visualization of Twitter connections. I agree with Hamza and Ortiz’s opinions that “data visualization is most effective not in the form of static charts and graphs, but as fluid, moving pieces of art”. There are certain types of information that should be visualized in a bar chart or pie chart, but when it comes to trying to visualize connections between subjects, it cannot be done in a numerical way. What’s interesting about the web about conversations between people at twitter is the fact that you can kind of imagine the personalities of people and the type of people they converse with. This may be because of common interests. Hovering over the circles with the person’s photo will show a blurb about the person.

relationships between people at Twitter based on data collected on twitter conversations

enwandu-Project-09-Portrait

sketch

// Emmmanuel Nwandu
// enwandu@andrew.cmu.edu
// Section D
// Project-09: Computational Portrait

var underlyingImage;
var angle = 5;
var radius = 1;
var eWidth = 2;

function preload() {
    underlyingImage = loadImage("https://i.imgur.com/fP2WiY5.jpg?1");
}

function setup() {
    createCanvas(400, 360);
    background(0);
    underlyingImage.loadPixels();
    frameRate(5000);
}

function DrawSpiral(){
    // Start spiral in the middle of canvas
    translate(width/2, height/2);
    var x = cos(radians(angle))* radius;
    var y = sin(radians(angle))* radius;
    var centerX = 0;
    var centerY = 0;

    // Gets the color of the pixels in the underlaying image
    var theColorAtLocationXY = underlyingImage.get(width/2 - x, height/2 - y);

    fill(theColorAtLocationXY); // Colors the pixel based on the underlaying image
    noStroke(0);
    ellipse(centerX - x, centerY - y, eWidth, eWidth)

    //pixel dimensions
    angle += 2; //the angle between rays of pixels
    radius += 0.02; //the density of the spiral
    eWidth = eWidth + .0005; //the increase in pixel size
}

function draw(){
    DrawSpiral();
}

This computational portrait in one of myself. It is an image from my 60’s album cover entitled “A Romantic Evening With You”. I used a spiral of ellipses to generated the underlying image in order to give the portrait a nostalgic vinyl record type feel or spinning record.

Original:

Final Computational Portrait:

enwandu_Looking Outwards-09

BikeCycle by Nick Felton

I really enjoyed the topic of computational information visualizations from Week 7, so I found myself scrolling through the Looking Outwards submissions of that week. I was then that I found the work of Ryu “the kangaroo” Kondrup. He wrote about Nick Felton, an info-graphic designer, and an icon for the world of data visualization. Ryu focused on the BikeCycle project, one which plots activity from bike sharing program in New York City. I think that the work done by Nick Felton and other info-graphic designers is extremely important because it adds another layer to information that would usually be monotonous, as well as makingthe information a little easier on the eyes. I also agree with Ryu’s observation that “the advantage of utilizing such a means of visualization over more regular representational methods is that rental bike use can be related to time of day, time of year, and other factors, data which would otherwise be lost in the quagmire of conventionally compiled data sets.”

The BikeCycle project as well as many of Nick Felton’s other projects such as the Annual Report, are remarkable well designed from a graphic standpoint, but are also very intriguing in his ability to map these somewhat static datasets into more dynamic domains. I think Ryu does a great job in understanding the nature of Nick Felton’s project. I’m very interested in where the world of data visualization can take us; it is an exciting concept.

Link to “The Kangaroo’s” Post…

rmanagad-project09-sectione

sketch

//Robert Managad
//Section-E
//rmanagad@andrew.cmu.edu
//

var underlyingImage;

function preload() {
    var myImageURL = "https://i.imgur.com/oZsaEpS.jpg";
    underlyingImage = loadImage(myImageURL);
}

function setup() {
    createCanvas(480, 320);
    background(0);
    underlyingImage.loadPixels();
    frameRate(60);
}

function draw() {
	var randomSize = random(5, 10);
	var randomDetailSize = random(1, 3);
	var pxDetailX = constrain(200, 280);
	var pxDetailY = constrain(40, 100)
    var px = random(width);
    var py = random(height);
    var dx = 5;
    var ix = constrain(floor(px), 0, width-1);
    var iy = constrain(floor(py), 0, height-1);
    var ixM = constrain(floor(mouseX), 0, width-1);
    var iyM =  constrain(floor(mouseY), 0, width-1);
    // creating variations in opacity
    var theColorAtLocationXY =  [red(underlyingImage.get(ix, iy)) + 5,
                                green(underlyingImage.get(ix, iy)) + 10,
                                blue(underlyingImage.get(ix, iy)),
                                + 90]
    var theColorAtLocationXYM =  [red(underlyingImage.get(ixM, iyM)) + 20,
                                green(underlyingImage.get(ixM, iyM)) + 10,
                                blue(underlyingImage.get(ixM, iyM)),
                                + 50]
    rectMode(CENTER);

    //creates stroke, no-fill rectangles for interactivity
    if (mouseIsPressed) {
   	strokeWeight(random(2, 6));
    stroke(theColorAtLocationXYM);
    rect(mouseX, mouseY, randomSize * 2, randomSize * 3);
	}
	noStroke();
	fill(theColorAtLocationXY);
	//larger pixels outside the face area
	if (px < 200 || px > 280 || py < 40 || py > 140) {
	ellipse(px, py, randomSize*3, randomSize*3.5);
	rect(px, py, randomSize*1.5, randomSize*1.5);
	}
	//smaller pixels within the face area
	else if (px > 200 || px < 280 || py > 40 || py < 140) {
	rect(px, py, randomSize*1.5, randomSize*1.5);
	}



}

    

I developed my pixel portrait program with a foggy window idea in mind, hence the changes in opacities and layering of randomly-generated pixels. To somewhat speed up the process of visualizing the background image, I incorporated an if statement involving mousePressed, where as long as the mouse is pressed strokes of rectangles will be drawn.

Below is a full canvas illustrating the background image, a self portrait.

rkondrup-Project-09-Computational-Portrait

sketch

// ryu kondrup
// rkondrup@andrew.cmu.edu
// sectionD
// project-09
var underlyingImage;
var ellipseSizeX;
var ellipseSizeY;


function preload() {
    var myImageURL = "https://i.imgur.com/p5EnT0V.jpg";
    underlyingImage = loadImage(myImageURL);
}

function setup() {
    createCanvas(480, 480);
    background(0);
    underlyingImage.loadPixels();
    frameRate(60);
}


//MAKE THE DOTS LARGER FARTHER FROM THE CENTER
function draw() {

//to draw puzzle pieces spaced on a grid 12 pixels apart
    var px = floor(random(width/12))*12;
    var py = floor(random(height/12))*12;
    //to constrain puzzle pieces to canvas
    var ix = constrain(px, 0, width-1);
    var iy = constrain(py, 0, height-1);
    var theColorAtLocationXY = underlyingImage.get(ix, iy);

    noStroke();
    fill(theColorAtLocationXY);
    //to draw the actual pieces at random locations
    puzzle(px, py);

    var theColorAtTheMouse = underlyingImage.get(mouseX, mouseY);
    // stroke(theColorAtTheMouse);
    // line(pmouseX, pmouseY, mouseX, mouseY);
}
//to draw the puzzle piece
function puzzle(x, y) {
    push();
    translate(x, y);
    //blocks of puzzle piece
    rect(1, 4, 11, 3);
    rect(9, 7, 3, 8);
    rect(4, 7, 5, 5);
    rect(1, 12, 3, 3);
    //pegs of puzzle piece
    rect(5, 1, 3, 1);
    rect(6, 1, 1, 3);
    rect(12, 9, 3, 1);
    rect(14, 8, 1, 3);
    //final fills of puzzle piece
    rect(1, 7, 1, 1);
    rect(3, 7, 1, 1);
    rect(1, 11, 1, 1);
    rect(3, 11, 1, 1);
    rect(4, 12, 1, 1);
    rect(4, 14, 1, 1);
    rect(8, 12, 1, 1);
    rect(8, 14, 1, 1);
    pop();
}

My plan for this project was to create a puzzle that gradually completes itself. Using the marvelous Maggie as a subject wearing her signature origami hat, I made a single puzzle piece that could be repeated infinitely on a square grid. Although I initially had no idea how to draw a good-looking curved puzzle piece, i soon realized that the pieces were so small that I could draw them using only rectangles and end up with a recognizable piece at the end.
In the end I was relatively happy with the result, I only wish the final product could have a higher resolution, perhaps each piece could contain multiple colors.