Computer Vision Response

This reading was interesting in the sense that it helped me tackle the complicated concept of computer vision. It separated the idea into comprehensible parts that explained the varying ways in which algorithms are able to interpret external movement. I liked the fact that it was a relatively simple read. This definitely influenced my ability to understand it.

I also really enjoyed the example that it gave of the limbo game. It was interesting to see an application and a fun one that was developed so quickly. I makes me think about how projects don’t necessarily have to be extremely extravagant, just effective.

Final Project Idea

Aya and I will be working on the final project together.

Materials needed:

  1. LED’s
  2. 360 degree Motors (7)
  3. Cotton or Pillow filling
  4. Lanters and foam
  5. Computer
  6. Arduino
  7. Beads and string

This is the idea:

The project will be an artificial cloud that will show how the weather is in a certain city. If in said city the weather is raining, rain like beads will drop out of the cloud (like kinetic rain). The same will occur with snowflakes if it’s snowing in said city. If it is sunny, LED’s will display a bright light or a warm orange etc. The data will come from a computer which will update every 10-24 hours (once we figure out how to do it).

What computing means to me-

Though I tend to believe that the modern world is complex, by learning the absolute basics of computing I am closer to understanding the ways in which technologies influence the current society. It has added a lot of stress to my life as I tend to not be great at learning languages, nor practicing them. The learning that I currently have access to is through practice and readings. I think that the practice aspect is helping me understand the concept and the hard work that goes into it. The reading aspect is helping me be more contemplative of the activities that I participate in eg. facebook or instagram. It has also made me more critical of the debates that occur today, eg. the Mark Zuckerberg trail (hearing?).

I don’t know if it’s making me a better person, but it is making me more aware of my surroundings and allowing me to understand how some applications such as Waze utilize my information. I think that computing so far has pushed me to work towards understanding and manipulating a language to do what I need it to. So far, it’s been a learning experience to say the least, but it was worth the struggle to know what I know now.

My Controller – Red Pill or Blue Pill?

My controller is a further development on the matrix project that I did last week. I decided to implement the iconic scene of the matrix that asked the protagonist to choose between a red pill and a blue one. If he chose the red pill, the ‘matrix’ would be revealed and he would see the ‘unmasked’ world. If he chose the blue pill, he would be able to believe the farce of the world and go back to his normal life.

I decided to give the user the same choice. In my controller there are two buttons, one red and one blue. These buttons determine what is going to be on the screen. I decided that for the blue button, 1/3 positive quotes would momentarily display on the screen. This was to represent the farce that is present. To communicate that good things happen and thus mask us from the nonsensical nature of society. The blue pill quotes show only momentarily so that this ‘return to normalcy’ is also represented. While the red pill shows a quote that was said by the creators “There is something wrong with the world. You don’t know what it is, but it’s there like a splinter in your mind, driving you mad”.

Here is the code for the Arduino:

int redButton = 10;
int blueButton = 9;
int b = 0;
int r = 0;

int running = 2;

void setup() {
  // put your setup code here, to run once:
  pinMode(redButton, INPUT);
  pinMode(blueButton, INPUT);
  Serial.begin(9600);
}

void loop() {

  if (digitalRead(blueButton) == HIGH && digitalRead(redButton) == LOW) {
    b = 1;
  } else if(digitalRead(blueButton == LOW)){
    b = 0;
  }

  if (digitalRead(redButton) == HIGH && digitalRead(blueButton) == LOW) {
    r = 1;
  } else if(digitalRead(redButton == LOW)){
    r = 0;
  }
  Serial.print(b);
  Serial.print(',');
  Serial.println(r);
}

Here is the code for processing:

int max_num_col = 98; 
//int buttport=2;
int prevb = 0;
int prevr = 0;
String[] z;
int r=0;
int b=0;
String s;
int num_col = floor(random(1, max_num_col)); // randomize total num of columns to be created for each loop
int[] xPosi;   // array to store random initial x positions 
int[] yOffset; // array to store random initial y position offset
//String name = "vitoria"; 
char[] poo = {'v', 'i', 't', 'o', 'r', 'i', 'a', 'v', 'i', 't', 'o', 'r', 'i', 'a', 'v', 'i', 't', 'o', 'r', 'i', 'a', 'v', 'i', 't', 'o', 'r', 'i', 'a', 'v', 'i', 't', 'o', 'r', 'i', 'a', 'v', 'i', 't', 'o', 'r', 'i', 'a', 'v', 'i', 't', 'o', 'r', 'i', 'a', 'v', 'i', 't', 'o', 'r', 'i', 'a', 'v', 'i', 't', 'o', 'r', 'i', 'a', 'v', 'i', 't', 'o', 'r', 'i', 'a', 'v', 'i', 't', 'o', 'r', 'i', 'a', 'v', 'i', 't', 'o', 'r', 'i', 'a', 'v', 'i', 't', 'o', 'r', 'i', 'a', 'v', 'i', 't', 'o', 'r', 'i', 'a'};
String a ="There is something wrong with the world. You don’t know what it is, but it’s there like a splinter in your mind, driving you mad.";
String[] bla = {"Australia became the 25th country to achieve marriage equality", "Women in Saudi Arabia were granted permission to drive starting in June.", "There’s a cat in New Zealand who has been sneaking out and stealing men’s underwear and socks."};



import processing.serial.*;
Serial myPort;


void setup() {
  size(1000, 500); 
  frameRate(60); 
  colorMode(HSB, 360, 100, 100);

  printArray(Serial.list());
  String portname=Serial.list()[2];
  println(portname);
  myPort = new Serial(this, portname, 9600);


  PFont font; 
  font = createFont("Arial Black", 10); 
  textFont(font);

  xPosi   = new int[num_col]; 
  yOffset = new int[num_col];  

  for (int i=0; i<num_col; i=i+1) {
    xPosi[i]   = floor(random(size_x/text_size))*text_size;
    yOffset[i] = floor(random(-size_y, size_y));
  }
}

void draw() {
  println(r, b);
  fill(0, 10); // the smaller the alpha, the longer the tail
  noStroke(); 
  rect(0, 0, size_x, size_y);   

  //  fill(random(360),100,100); // char with color
  fill(120, 100, 100); // green char
  textSize(text_size);

  for (int i=0; i<num_col; i++) {
    //int i_char = floor(random(255));
    //char T = char(i_char);
    char T = poo[i];
    text(T, xPosi[i], y+yOffset[i]);
  }

  y = y + floor(text_size/1.1); // spacing btw char  
  if (y>size_y*1.2) {
    y = -400;
    num_col = floor(random(1, max_num_col));
    xPosi   = new int[num_col]; 
    yOffset = new int[num_col];
    for (int i=0; i<num_col; i=i+1) {
      xPosi[i]   = floor(random(size_x/text_size))*text_size;
      yOffset[i] = floor(random(-size_y, size_y));
    }
  }
  if (b == 1 && prevb == 0) {
    s = bla[round(random(1, 2))];
    textSize(20);
    fill(#3E5AE3);
    text(s, 30, 250, 7000, 1000);// Text wraps within text box
  }

  if (r == 1) {      
    textSize(14);
    fill(#F21414);
    text(a, 10, 250, 7000, 1000);
  }
  prevb = b ;
  prevr = r;
}
void serialEvent(Serial myPort) {
  String x=myPort.readStringUntil('\n');
  if (x!=null) {
    x=trim(x);
    z = x.split(",");
    b = int(z[0]);
    r = int(z[1]);
  }
}

Here is how it looks:

https://youtu.be/AQ5IdcDVlpc

 

Week 10 project

This week I was inspired by the movie ‘The Matrix’. There is the iconic ‘matrix’ coding that can fill a screen with random falling code and it looks… awesome. This is a picture of what I’m talking about:

I searched online for anyone who had done the coding for this and I found someone who had. I used their code as a backbone for what I wanted to do. My idea was to alter the lettering and make it so that it spells my name. I didn’t want the coding to be too obvious that it was my name so I altered it so that each letter would come down randomly. I got some help from Alex to figure out how to do this.  We made some mistakes which made the falling code stop after 7 letters had fallen. Therefore, we hardcoded the letters to have 98 characters in total.

I altered the original code as well as some of the numbers didn’t make sense due to the fact that the original author had put non numeric code inside of a size().

This is the final code:

int y = -400; // initial baseline y position
int size_x = 1000; 
int size_y = 500;
int text_size = 10;
int max_num_col = 98; 
int num_col = floor(random(1,max_num_col)); // randomize total num of columns to be created for each loop
int[] xPosi;   // array to store random initial x positions 
int[] yOffset; // array to store random initial y position offset
//String name = "vitoria"; 
char[] poo = {'v', 'i', 't', 'o', 'r', 'i', 'a','v', 'i', 't', 'o', 'r', 'i', 'a','v', 'i', 't', 'o', 'r', 'i', 'a','v', 'i', 't', 'o', 'r', 'i', 'a','v', 'i', 't', 'o', 'r', 'i', 'a','v', 'i', 't', 'o', 'r', 'i', 'a','v', 'i', 't', 'o', 'r', 'i', 'a','v', 'i', 't', 'o', 'r', 'i', 'a','v', 'i', 't', 'o', 'r', 'i', 'a','v', 'i', 't', 'o', 'r', 'i', 'a','v', 'i', 't', 'o', 'r', 'i', 'a','v', 'i', 't', 'o', 'r', 'i', 'a','v', 'i', 't', 'o', 'r', 'i', 'a','v', 'i', 't', 'o', 'r', 'i', 'a'};
 
void setup(){
  size(1000, 500); 
  frameRate(60); 
  colorMode(HSB,360,100,100);
  
  PFont font; 
  font = createFont("Arial Black", 10); 
  textFont(font);
  
  xPosi   = new int[num_col]; 
  yOffset = new int[num_col];  
  
  for (int i=0; i<num_col; i=i+1) {
    xPosi[i]   = floor(random(size_x/text_size))*text_size;
    yOffset[i] = floor(random(-size_y,size_y));
  }
}

void draw(){
  fill(0,10); // the smaller the alpha, the longer the tail
  noStroke(); 
  rect(0,0,size_x,size_y);   
  
//  fill(random(360),100,100); // char with color
  fill(120,100,100); // green char
  textSize(text_size);
  
  for (int i=0; i<num_col; i++) {
    //int i_char = floor(random(255));
    //char T = char(i_char);
    char T = poo[i];
    text(T, xPosi[i], y+yOffset[i]);
  }
  
  y = y + floor(text_size/1.1); // spacing btw char  
  if (y>size_y*1.2) {
    y = -400;
    num_col = floor(random(1,max_num_col));
    xPosi   = new int[num_col]; 
    yOffset = new int[num_col];
    for (int i=0; i<num_col; i=i+1) {
      xPosi[i]   = floor(random(size_x/text_size))*text_size;
      yOffset[i] = floor(random(-size_y,size_y));
    }
  }
}

The product looks like this:

It’s a bit empty, but I’m happy with the results.

Digitize Everything – Response

I really enjoyed this reading, not only because it was simple to understand but also because the main example used hit close to home. Waze improved the safety of my family a lot. Back in Brazil, there are some shady neighborhoods where people just should not drive through. Actually, many of the streets shouldn’t be driven through at night anyways. Google maps always gives the quickest way to get from point A to B. Waze on the other hand takes into account the favelas and the intense traffic that is inevitable in Brazil. It allows my family members to be safe and also to avoid being stuck in the same spot for 4 hours.

Not to sound more like an advertisement, but it I think that the concept of the language being built upon itself is extremely interesting. Regardless of human interaction with the application, the language is still being expanded upon which maximizes efficiency and the quality of Waze.

These types of computing languages are extremely ‘smart’ which will definitely advance in this ever more connected world.

Object Orientated Game Documentation

This week I decided to make a game as per recommendation of some peers. Mid-way through I realized I had a horrible mistake. However, I got a lot of help from Ross and the following is the process and final product.

First I brainstormed out loud and understood the logic of making a game. The initial idea was to make a clock like structure, much like a wheel of fortune, that would contain a spinning dial. Once the player mouse clicked the screen, the dial would stop. If the dial stopped between an area, the player would win, otherwise they would lose.

I used a class for the dial and the code is as follows:

class Dial {
  float locX, locY;
  float angle;
  

  //constructor
  Dial(float x, float y) {
    locX = x;
    locY = y;
  }

  void draw () {
    if (!clicked) {
      strokeWeight(5);
      stroke(#E50C0C);
      float t = millis()/1000.0f;
      locX = (locX+100*cos(t));
      locY = (locY+100*sin(t));
      line(300, 300, locX, locY);
    }
    else{
      if(clicked){
        image(img,17,25);
    
    }
  }
  }
}

The spinning was found online and it created a sort of 3D rotation of what looked like a cone shape. The line wouldn’t rotate exactly around the diameter of the circle. Therefore, to fix this I made the background have the same color as the dial. It was a slight ratchet solution, but it works.

I don’t really understand why, but near the designated ‘win’ area, the dial seems to move faster. I didn’t do it on purpose but it works so I kept it.

As for the ‘win’ and ‘lose’ results, I decided to implement a sadistic ending and added a jigsaw photo. No matter whether the player won or not, the results would just show the photo of jigsaw from the movie Saw. Recently I watched ‘Ready Player One’ and in the movie they talked a lot about Easter eggs. I was inspired to put an Easter egg of the combination of Saw and Rick & Morty. (side tracking: the new episode of my favorite series ‘Rick & Morty’  is maybe coming out today, so I was thinking about it a lot). The little Easter egg is at the top right hand corner of the screen.

Here is the code of the game sketch:

Dial dial1;
boolean clicked = false;
float stopX;
float stopY;
PImage img;

void setup() {
  size (600, 600);
  dial1 = new Dial(300, 100);
img = loadImage("jigsaw.jpg");
}

void draw() {
  background (#E50C0C);
  fill(255);
  ellipse(300, 300, 400, 400);
  fill(0, 0, 0);
  arc(300, 300, 400, 400, 0, QUARTER_PI, PIE); 
  dial1.draw();

  textSize(8);
  text("Rick is...is this a 'Saw' thing? Are you Sawing the Vindicators -Morty", 8, 10); 
  fill(0, 102, 153);
  

}

Here is a photo of what the game screen looks like:

Casey Reas’ Eyeo Talk – Response

The projects that Casey Reas presents in his talk are interesting and beautiful to look at. If one is to judge him on the aesthetics of his work, it would be a 10/10. The kaleidoscope looking project he worked on included a hybrid of creative pioneering but also the skilled use of his programming skills. What surprised me most about that project was the fact that his process included a year of not even touching a computer. The idea of being an artist really shone through when he mentioned that. His creative process wasn’t limited by the constraints of technology.

On the more critical side, his presentation was quite frankly boring. Though he has had experience with presenting his work before, the monotone and lecture like speech was detrimental to the audience’s reception. I think that having a good presentation is able to elevate the idea and make people more responsive to it, so his dull presentation was bit…hm.

Lev Manovich – Response

This reading was well organized and it should’ve made a lot of sense. However, I think because of the complex vocabulary I was often lost. I believe that this reading does build off of each point and make sense in terms of what it set out to do. I wish that I was able to follow it more. The concepts were explained in a manner that was tailored to suit someone who was familiar with the technological terms that are common, but even those I had to think about when reading which interfered with the fluidity with which I could understand the concepts.

One point that I did find interesting was the one about the advertisements and how computers seem to analyze the data that we give them. We know that this is happening but it was interesting to read about. Also the point where everything is built off each other, how programs and new media always use things from the last generation. I don’t know what else to say about this as I was unable to fully grasp each concept.

Computer Graphics

I really struggled with this project, mainly because I chose many designs which I did not know how to replicate exactly. However, after many failures, I found a relatively simple one that I could replicate.

I found it on the website and decided to use loop and filled rectangles to make this design. Here is the code:

Here is my final product:

I struggled a lot with other attempts that required more skills such as dotted lines with assigned coordinates.

But, I’m pretty happy with what I’ve got as of right now.