icm final - fall 2007
December 19th, 2007 admin
they are watching.
this project makes use of the growing number of cameras that monitor the traffic infrastructure of nyc. although the presence of such a large network of surveillance cameras presents serious issues of privacy, there is beauty to be found in the rhythmic patterns resonating through new york city.
this project relies on two separate applets. the first of these two runs subtly in the background constantly refreshing the bank of images used by the visualization aspect of the project. the visualization aspect treats each individual feed as an independant obejct. each feed can be described by a matrix of parameters allowing numerous visual alterations to be made to each individual feed. these parameters include blob detection thresholds, image opacity, tint, colour modifications etc. the end result is a self-updating visualization of the flow of traffic pulsing through new york city.
currently the feed and effect selections are defined in the code, however the completed iteration of this project will run autonomously. Each selected feed and the effects applied to it will be decided by the algorithm allowing the visualization to run in real time 24 hours a day, reflecting the actual traffic patterns of nyc at any given moment.
the image set below represents a few select screen shots.






code:
image grabber:
import java.io.*;
Process p;
String[] url = new String[50];
String path;
int counter = 0;
//String cmd = “curl -o /Users/ameya/Documents/itp/ICM/final/testSet/imgP1.jpg http://207.251.86.248/cctv13.jpg”;
//String fileName1 = “/Users/ameya/Documents/itp/ICM/final/testSet2/imgP1″;
//String fileName2 = “.jpg”;
//String url = “http://207.251.86.248/cctv11.jpg”;
//String url = “http://207.251.86.248/cctv26.jpg”;
String fileName1 = “/Users/ameya/Documents/itp/ICM/final/final1/images/url”;
String fileName2 = “/img”;
String fileName3 = “.jpg”;
void getIMG(String path) {
try{
p = Runtime.getRuntime().exec(path);
//System.out.println(p);
}
catch(IOException e){
e.printStackTrace();
}
}
void setup() {
//size(640, 480);
url[0] = “test”;
url[0] = “battery haziz”;
url[1] = “http://207.251.86.248/cctv29.jpg”;
url[2] = “http://207.251.86.248/cctv65.jpg”;
url[3] = “http://207.251.86.248/cctv74.jpg”;
url[4] = “http://207.251.86.248/cctv27.jpg”;
url[5] = “http://207.251.86.248/cctv28.jpg”;
url[6] = “http://207.251.86.250/images/cams/govt_property/cctv1.jpg”;
url[7] = “http://207.251.86.248/cctv68.jpg”;
url[8] = “http://207.251.86.248/cctv66.jpg”;
url[9] = “http://207.251.86.248/cctv69.jpg”;
url[10] = “http://207.251.86.248/cctv8.jpg”;
url[11] = “http://207.251.86.248/cctv10.jpg”;
url[12] = “http://207.251.86.248/cctv5.jpg”;
url[13] = “http://207.251.86.248/cctv18.jpg”;
url[14] = “http://207.251.86.248/cctv26.jpg”;
url[15] = “http://207.251.86.250/images/cams/govt_property/cctv90.jpg”;
url[16] = “http://207.251.86.248/cctv20.jpg”;
url[17] = “http://207.251.86.248/cctv31.jpg”;
url[18] = “http://207.251.86.248/cctv9.jpg”;
url[19] = “http://207.251.86.248/cctv17.jpg”;
url[20] = “http://207.251.86.248/cctv12.jpg”;
url[21] = “http://207.251.86.248/cctv19.jpg”;
url[22] = “http://207.251.86.248/cctv7.jpg”;
url[23] = “http://207.251.86.248/cctv11.jpg”;
url[24] = “http://207.251.86.250/images/cams/govt_property/cctv2.jpg”;
url[25] = “http://207.251.86.248/cctv71.jpg”;
url[26] = “http://207.251.86.248/cctv50.jpg”;
url[27] = “http://207.251.86.250/images/cams/govt_property/cctv92.jpg”;
url[28] = “http://207.251.86.250/images/cams/govt_property/cctv90.jpg”;
url[29] = “http://207.251.86.248/cctv63.jpg”;
url[30] = “http://207.251.86.248/cctv64.jpg”;
url[31] = “http://207.251.86.248/cctv22.jpg”;
url[32] = “http://207.251.86.248/cctv14.jpg”;
url[33] = “http://207.251.86.248/cctv13.jpg”;
url[34] = “http://207.251.86.248/cctv23.jpg”;
url[35] = “http://207.251.86.248/cctv4.jpg”;
url[36] = “http://207.251.86.248/cctv6.jpg”;
url[37] = “http://207.251.86.250/images/cams/govt_property/cctv15.jpg”;
url[38] = “http://207.251.86.248/cctv3.jpg”;
url[39] = “http://207.251.86.250/images/cams/govt_property/cctv16.jpg”;
url[40] = “http://207.251.86.248/cctv24.jpg”;
url[41] = “http://207.251.86.248/cctv25.jpg”;
}
void draw() {
println (counter);
counter ++;
for (int i = 1; i < 35; i ++) {
for (int j = 1; j < 42; j ++) {
//String cmd1 = “curl -o ” + fileName1 + “_” + i + fileName2 + ” ” + url;
String cmd1 = “curl -o ” + fileName1 + j + fileName2 + i + fileName3 + ” ” + url[j];
//println(cmd1);
getIMG (cmd1);
}
delay(1200);
}
}
visualize:
import blobDetection.*;
class videoFeed {
BlobDetection theBlobDetection;
String id;
int numFrames;
float opacity;
float tval;
int size;
int frame;
//boolean detBlob;
PImage[] images;
boolean blobBound;
boolean blobFill;
boolean invert;
videoFeed (String id_, int numFrames_) {
id = id_;
numFrames = numFrames_;
images = new PImage[numFrames];
} // end videoFeed
void initialize(float tval)
{
//String thold = tval + “f”;
for (int i=0; i< numFrames; i ++)
{
String imgPath = “/Users/ameya/Documents/itp/ICM/final/final1/images/” + id +”/img” + (i+1) + “.jpg”;
images[i] = loadImage(imgPath);
// println(imgPath);
}
theBlobDetection = new BlobDetection(images[1].width, images[1].height);
theBlobDetection.setPosDiscrimination(false);
theBlobDetection.setThreshold(tval);
}
void display(int tint1, int tint2,boolean invert, boolean detBlob, boolean blobFill, boolean blobBound, int eStrkWt, int eStrk1, int eStrk2, int eStrk3, int bStrkWt, int bStrk1, int bStrk2, int bStrk3)
{
frame = (frame+1)%numFrames; // Use % to cycle through frames
String imgPath = “/Users/ameya/Documents/itp/ICM/final/final1/images/” + id +”/img” + (frame+1) + “.jpg”;
//images[frame] = loadImage(imgPath);
tint(tint1, tint2);
//println(invert);
if (invert == true) {
filter(INVERT);
}
//image(images[frame],0,0,width, height);
//theBlobDetection.computeBlobs(images[frame].pixels);
if (detBlob == true) {
//drawBlobsAndEdges(blobFill, blobBound, images, frame,eStrkWt,eStrk1, eStrk2, eStrk3, bStrkWt, bStrk1, bStrk2, bStrk3);
drawBlobsAndEdges(blobFill, blobBound, eStrkWt, eStrk1, eStrk2, eStrk3, bStrkWt, bStrk1, bStrk2, bStrk3);
}
}
void display1(int tint1, int tint2,boolean invert, boolean detBlob, boolean blobFill, boolean blobBound, int eStrkWt, int eStrk1, int eStrk2, int eStrk3, int bStrkWt, int bStrk1, int bStrk2, int bStrk3)
{
frame = (frame+1)%numFrames; // Use % to cycle through frames
tint(tint1, tint2);
//println(invert);
if (invert == true) {
filter(INVERT);
}
image(images[frame],0,0,width, height);
theBlobDetection.computeBlobs(images[frame].pixels);
if (detBlob == true) {
//drawBlobsAndEdges(blobFill, blobBound, images, frame,eStrkWt,eStrk1, eStrk2, eStrk3, bStrkWt, bStrk1, bStrk2, bStrk3);
drawBlobsAndEdges(blobFill, blobBound, eStrkWt, eStrk1, eStrk2, eStrk3, bStrkWt, bStrk1, bStrk2, bStrk3);
}
}
void display2(int tint1, int tint2,boolean invert, boolean detBlob, boolean blobFill, boolean blobBound, int eStrkWt, int eStrk1, int eStrk2, int eStrk3, int bStrkWt, int bStrk1, int bStrk2, int bStrk3)
{
frame = (frame+1)%numFrames; // Use % to cycle through frames
tint(tint1, tint2);
if (invert == true) {
filter(INVERT);
}
//image(images[frame],0,0,width, height);
theBlobDetection.computeBlobs(images[frame].pixels);
if (detBlob == true) {
//drawBlobsAndEdges(blobFill, blobBound, images, frame,eStrkWt,eStrk1, eStrk2, eStrk3, bStrkWt, bStrk1, bStrk2, bStrk3);
drawBlobsAndEdges(blobFill, blobBound, eStrkWt, eStrk1, eStrk2, eStrk3, bStrkWt, bStrk1, bStrk2, bStrk3);
}
}
//void drawBlobsAndEdges(boolean drawBlobs, boolean drawEdges)
void drawBlobsAndEdges(boolean drawBlobs, boolean drawEdges,int eStrkWt, int eStrk1, int eStrk2, int eStrk3, int bStrkWt,int bStrk1,int bStrk2,int bStrk3)
{
noFill();
Blob b;
EdgeVertex eA,eB;
for (int n=0 ; n
b=theBlobDetection.getBlob(n);
if (b!=null)
{
// Edges
if (drawEdges)
{
strokeWeight(eStrkWt);
stroke(eStrk1,eStrk2,eStrk3);
for (int m=0;m
{
eA = b.getEdgeVertexA(m);
eB = b.getEdgeVertexB(m);
if (eA !=null && eB !=null)
line(
eA.x*width, eA.y*height,
eB.x*width, eB.y*height
);
}
}
if (drawBlobs)
{
strokeWeight(bStrkWt);
stroke(bStrk1,bStrk2,bStrk3);
rect(
b.xMin*width,b.yMin*height,
b.w*width,b.h*height
);
}
}
}
}
main class:
import blobDetection.*;
boolean detBlob;
videoFeed url1 = new videoFeed(”url1″,30);
videoFeed url2 = new videoFeed(”url2″,30);
videoFeed url3 = new videoFeed(”url3″,30);
videoFeed url4 = new videoFeed(”url4″,30);
videoFeed url5 = new videoFeed(”url5″,30);
videoFeed url6 = new videoFeed(”url6″,30);
videoFeed url7 = new videoFeed(”url7″,30);
videoFeed url8 = new videoFeed(”url8″,30);
videoFeed url9 = new videoFeed(”url9″,30);
videoFeed url10 = new videoFeed(”url10″,30);
videoFeed url11 = new videoFeed(”url11″,30);
videoFeed url12 = new videoFeed(”url12″,30);
videoFeed url13 = new videoFeed(”url13″,30);
videoFeed url14 = new videoFeed(”url14″,30);
videoFeed url15 = new videoFeed(”url15″,30);
videoFeed url16 = new videoFeed(”url16″,30);
videoFeed url17 = new videoFeed(”url17″,30);
videoFeed url1s8 = new videoFeed(”url18″,30);
videoFeed url19 = new videoFeed(”url19″,30);
videoFeed url20 = new videoFeed(”url20″,30);
videoFeed url21 = new videoFeed(”url21″,30);
videoFeed url22 = new videoFeed(”url22″,30);
videoFeed url23 = new videoFeed(”url23″,30);
videoFeed url24 = new videoFeed(”url24″,30);
videoFeed url25 = new videoFeed(”url25″,30);
videoFeed url26 = new videoFeed(”url26″,30);
videoFeed url27 = new videoFeed(”url27″,30);
videoFeed url28 = new videoFeed(”url28″,30);
videoFeed url29 = new videoFeed(”url29″,30);
videoFeed url30 = new videoFeed(”url30″,30);
videoFeed url31 = new videoFeed(”url31″,30);
videoFeed url32 = new videoFeed(”url32″,30);
videoFeed url33 = new videoFeed(”url33″,30);
videoFeed url34 = new videoFeed(”url34″,30);
videoFeed url35 = new videoFeed(”url35″,30);
videoFeed url36 = new videoFeed(”url36″,30);
videoFeed url37 = new videoFeed(”url37″,30);
videoFeed url38 = new videoFeed(”url38″,30);
videoFeed url39 = new videoFeed(”url39″,30);
videoFeed url40 = new videoFeed(”url40″,30);
void setup()
{
noStroke();
size(640,480);
frameRate(30);
url1.initialize(.75);
url2.initialize(.75);
url3.initialize(.75);
url4.initialize(.75);
url5.initialize(.75);
url6.initialize(.55);
url7.initialize(.75);
url14.initialize(.75);
url15.initialize(.90);
url22.initialize(.80);
url26.initialize(.80);
url27.initialize(.79);
url25.initialize(.15);
}
void draw()
{
if(millis() < 15000)
{
url1.display1(180,64,false, true, false, false, 2,255,0,0,1,178,48,96);
url2.display1(90,64,false, true, true, false, 2,65,105,225,1,205,38,38);
println(millis());
}
if (millis() > 15000 && millis() < 30000) {
url2.display1(255,128,false, true, true, true, 3,122,200,139,1,24,116,205);
//background(0,20);
//url1 = new videoFeed(”url29″,15);
//url1.initialize(.75);
println(millis());
}
if (millis() > 30000 && millis() < 45000) {
url2.display1(255,128,false, true, true, true, 4,255,127,0,1,200,0,90);
//background(0,20);
//url1 = new videoFeed(”url29″,15);
//url1.initialize(.75);
println(millis());
}
if (millis() > 45000 && millis() < 60000) {
url2.display1(255,64,false, false, false, true, 1,255,126,205,1,255,116,205);
url4.display1(255,64,false, false, false, true, 1,255,126,205,1,255,116,205);
//background(0,20);
//url1 = new videoFeed(”url29″,15);
//url1.initialize(.75);
println(millis());
}
if (millis() > 60000 && millis() < 75000) {
url4.display1(255,128,false, true,true , false, 1,24,126,205,1,24,116,205);
//background(0,20);
//url1 = new videoFeed(”url29″,15);
//url1.initialize(.75);
println(millis());
println(millis());
}
if (millis() > 75000 && millis() < 90000) {
url4.display1(255,128,false, true, true, true, 3,188,210,238,1,178,48,96);
url5.display1(255,128,false, false, true, false, 1,65,105,225,1,65,105,225);
println(millis());
}
if (millis() > 90000 && millis() < 105000) {
url15.display1(255,128,false, true, true, true, 3,188,210,238,1,178,48,96);
//url5.display1(255,128,false, true, true, false, 1,65,105,225,1,65,105,225);
println(millis());
}
if (millis() > 105000 && millis() < 120000) {
url15.display1(255,70,false, false, true, true, 3,188,210,238,1,178,48,96);
url14.display1(255,70,false, true, true, true, 3,188,210,238,1,178,48,96);
//url5.display1(255,128,false, true, true, false, 1,65,105,225,1,65,105,225);
println(millis());
}
if (millis() > 120000 && millis() < 140000) {
url22.display1(255,155,false, true, true, false, 3,188,210,238,1,178,48,96);
println(millis());
}
if (millis() > 140000 && millis() < 170000) {
url22.display1(190,65,false, false, true, false, 3,188,210,238,1,178,48,96);
url26.display1(170,70,false, true, true, false, 3,205,92,92,3,205,92,92);
println(millis());
}
if (millis() > 170000 && millis() < 190000) {
url26.display1(180,64,false, true, true, true, 3,205,92,92,3,95,158,160);
url27.display1(180,64,false, true, true, false, 3,80,140,48,2,58,95,105);
println(millis());
}
/*
if (millis() > 190000 && millis() < 210000) {
url27.display1(155,64,false, false, true, false, 3,176,48,96,3,176,48,96);
url25.display1(155,64,false, false, true, false, 3,147,112,219,3,205,92,92);
println(millis());
}
*/
if (millis() > 190000 && millis() < 200000) {
url25.display1(155,64,false, true, false, true, 1,100,140,56,1,100,140,56);
println(millis());
}
if (millis() > 200000 && millis() < 220000) {
url25.display1(155,64,false, false, true, false, 3,205,92,92,3,205,92,92);
println(millis());
}
}
} // end video feed class
Posted in icm, home | No Comments »





