Lina Maria Giraldo's Blog

Multimedia Artist and ITP Student

ICM Midterm Project

without comments

 

For my midterm, I wanted to combine live video feed from a US/Mexico border camera with live text feeds from the stock exchange. Unfortunately, the site I found “American Border Patrol” only has PC software and even then, they had restrictions on membership. I then decided to use recorded footage they had available.

 

This is the video from American border Patrol

This is the video from American border Patrol

The video is black and white and is 1 min 10 sec long. First of all, it didn’t want to work because it was a window media player so I had to open it on the pc and exported it as a quick time.  After, I exported to FCP and changed the size to 640 by 480.   After this, the video is working and in the size I want. I decided to load it. It is having a lot of trouble sometimes. It locks up processing once in a while and I have to close and reopen again. The size of the video is 195 megabytes. I’ve been recommended to lower its resolution. I’ve been reluctant to do it, because I don’t want to loose quality. So far it’s been a problem, so I have to take a decision soon or at least have two versions of it .

 

The next problem was the Data text files from the stock. I was able to pull some values and get some static quotes, but found it very difficult to obtain live feeds. I used a static TXT file for development. Here, I was able to load the information from yahoo stock exchange but I wasn’t able to display the text on top of the video so I decide it to use my example of a string that use with the Gutenberg text using it with an array of strings.

 

 

int[] data;

void setup() {

  size(200,200);

 // The text from the file is loaded into an array.

 String[] lines = loadStrings (“quotes-1.txt”);

 println(“there are “+ lines.length+” lines”);

 for(int i=0; i<lines.length; i++){

   println(lines[i]);

 }

 //String[] stuff = loadStrings(“data.txt”);

  // This array has one element because the file only has one line.

  // Convert String into an array of integers using ‘,’ as a delimiter

  //data = int(split(stuff[0], ‘,’ ));

}

void draw() {

  background(255);

  stroke(0);

    /*

  for (int i = 0; i < data.length; i ++ ) {

    // The array of ints is used to set the color and height of each rectangle.

    //fill(data[i]);

    //rect(i*20,0,20,data[i]);

  }

  */

}

 

 

I already combined the video with the text. So far, it’s working smooth and I like the result of the grid combine with the video and the text. I started with the example of video text mirror and made it work with the existing video and data. This is running and working so far but I need to create more interactivity in my project , so I decide it to move the text to the right Then came the big challenge: How to move the letters  too! After many, many, many tries I finally figured the way was to move the variable that controlled the text up every time the draw cycle passed. I made another counter and it worked, except that it moved so fast, it blurred all the letters…

 

First try to move the letters....

First try to move the letters....

The solution was to create a micro counter that increased very little every time the draw cycle ran. This worked fine! Except when it crashed after it grew larger than the string… So I put an “if” to control this.  

 

All was well, except the data. I didn’t like the static data and I thought it looked too disorganized. I changed the idea a bit and used the Bill of Rights.  this is my code for this:

 

 String url = “http://itp.nyu.edu/proxy/proxy.php?url=http://www.gutenberg.org/dirs/etext90/bill11h.htm”;

  String[] rawtext = loadStrings(url);

  // Join the big array together as one long string

 String chars = join(rawtext, “” );

 

 

And finally, the moment we have all been waiting for! Without further delays, the code that worked:

 

 

// 10/19/08

// Midterm

// www.linamariagiraldo.com

 

import processing.video.*;

 

// Size of each cell in the grid, ratio of window size to video size

int videoScale =8;

 

// Number of columns and rows in our system

int cols, rows;

int start = 0;

 

// Variable to hold onto capture object

Movie movie;

 

//Determine initial value of micro counter

 float micro = start;

 

 

// The source text used in the mosaic pattern.

// String chars = “123456789” ;

 

// Load text into an array of strings

  //String url = “http://www.gutenberg.org/dirs/etext90/bill11.txt”;

    //String url = “http://itp.nyu.edu/proxy/proxy.php?url=http://www.gutenberg.org/dirs/etext90/bill11.txt”;

    String url = “http://itp.nyu.edu/proxy/proxy.php?url=http://www.linamariagiraldo.com/itp/bor.txt”;

    //String url = “http://www.linamariagiraldo.com/itp/bor.txt”;

  String[] rawtext = loadStrings(url);

  // Join the big array together as one long string

 String chars = join(rawtext, “” );

 

PFont f;

 

void setup() {

  size(640,480);

  // Set up columns and rows

  cols = width/videoScale;

  rows = height/videoScale;

  movie = new Movie(this, “border5.mov”);

  movie.loop();

  // Load the font

 f = loadFont(“myfont.vlw”);

}

 

// Read new frames from movie

void movieEvent(Movie movie) {

  movie.read();

}

 

void draw() {

    background(0);

 

   if (mousePressed) {

image(movie,0,0);  

      }

 

    else{

  movie.loadPixels();

 

  // Use a variable to count through chars in String

 

 int charcount = int (micro);

  //int charcount = 0;

  // Begin loop for rows

  for (int j = 0; j < rows; j ++ ) {

    // Begin loop for columns

    for (int i = 0; i < cols; i ++ ) {

     

      // Where are we, pixel-wise?

      int x = i*videoScale;

      int y = j*videoScale;

      

      // Looking up the appropriate color in the pixel array

      color c = movie.get(x,y);

      // Displaying an individual character from the String instead of a rectangle

      textFont(f);

      fill(c);

     

      // One character from the source text is displayed colored accordingly to the pixel location.

      // A counter variable charcount is used to walk through the source String one character at a time.

 // this is affected by the microcounter so it is constantly increasing

      text(chars.charAt(charcount),x,y);

     

      // Go on to the next character

      charcount = (charcount + 1) % chars.length();

      

    }

  }

}

// procedure to increase the micro counter

println (micro + ” of”);

println (chars.length() + ” total”);

if (micro < chars.length() – 1) {

micro=micro+0.05;

}

else {

  micro = start;

}

}

 

 

 

Written by admin

October 20th, 2008 at 11:40 pm

Posted in ICM

Tagged with

Leave a Reply

You must be logged in to post a comment.