Sunday 3 January 2010

The Extreme Limits!

For the past couple of weeks I have been continuously working on the code & hassling people on the Processing website to allow the number of webcam feeds & the speed of refreshing increases.
Behold! 30 different feeds with a refresh rate of one random feed every two seconds. This modified code allows more efficient loading of feeds without frying the program:

public static final int NROWS = 5;
public static final int NCOLS = 6;

// list of cameras
String[] feeds = {
"http://www.adelaidecitycouncil.com/netcatapps/webcam/images/centralMkt.jpg", //Adelaide Market
"http://www.cbc.ca/bc/webcam/images/webcam.jpg", // Vancouver Building Site
"http://www.adelaidecitycouncil.com/netcatapps/webcam/images/rundleEast.jpg", //Rundle Mall East & Lantern
"http://www.draperbee.com/webcam/pic/image.jpg?1262444320177", //beehive
//"http://www.aad.gov.au/asset/webcams/casey/small/C0912121710s.jpg", //Antarctica Davis Station
"http://www.adelaidecitycouncil.com//NetcatApps/webcam/images/bellsth.jpg", //Adelaide Bell Street South
"http://www.abbeyroad.com/webcam/crossing.jpg?cacheKiller=362683", //Abbey Road
"http://server.fishycam.com/fishycam.jpg?time=1260184950863", //Fish Tank Goldfish
"http://www.cph.dk/CPHdata/webcam/CPH_spot1.jpg?1260188477647", //Copenhagen Airport
"http://www.adelaidecitycouncil.com/netcatapps/webcam/images/rundle.jpg", //Rundle Mall Balls
"http://images.ibsys.com/sea/images/weather/auto/queenannecam_640x480.jpg?", //Seattle Skyline
"http://www.pani.com/webcam/airport_tower.jpg?", //German Airport Tower
"http://www.rrtearoom.com/live.jpg",// Psychic Tearoom Massachusetts
"http://www.camchickens.com/webcam.jpg", // Amsterdam Chickens
"http://www.terrapin-gardens.net/images/webcam.jpg",// House Vermont
"http://stream.fisheyeview.com/FVCam.jpg",// Coral Reef
"http://www.cs.ualberta.ca/~lake/cam/jpg/large/201.jpg",//Alberta University
"http://webcams.pancanal.com/webcam/miraflores.jpg", // Panama Canal
"http://www.oceanvillageholidays.co.uk/webcam/ov1.jpg", //Ferry
"http://brooklyn-bridge.mobotixcam.de/record/current.jpg?rand=380424",//Brooklyn Bridge
"http://www.outercam.co.uk/ssc/camera3.jpg?1260446915311",//Bass Rock
"http://www.xs4all.nl/~twocats/cam/Cam-A.jpg",// Cats
"http://www.sat.dundee.ac.uk/webcam/cam0.jpg",//Dundee Uni Tower Building
"http://facweb.furman.edu/~rbryson/dramadept/TheatreCamPic.jpg", // Student Theatre
"http://www.adelaidecitycouncil.com//NetcatApps/webcam/images/bellnth.jpg",// Adelaide King William Street
"http://www.outercam.co.uk/ssc/camera2.jpg?1260455145216",// North Berwick Bird Feeder
"http://www.jb.man.ac.uk/common/camera30sec.jpg?dummy=1260456117729",//Lovell Telescope
"http://ecoast.vs.oiccam.com:443/ftp/capcom/jackalope/image.jpg?rand=14:52:10",//Jackalope Jacks Bar North Carolina
"http://www.yosemite.org/DSN/wwwyosemiteassociationorg/Content/Webcam/turtleback.jpg",//Yosemite Turtle Dome
"http://www.ek.fi/kamera/tn_palace00.jpg", //Helsinki Market Place
"http://www.electricearl.com/LAcam-2009c.jpg" // Downtown LA
// more here...
};
PImage[] images;

void setup(){
size(1280, 800);
// need as many images as we have feeds
images = new PImage[feeds.length];
// initial load of images (slow)
for (int i = 0 ; i <>
images[i] = loadImage(feeds[i]);
}
}

void draw(){
// draw grid
int index = 0;
for (int y = 0 ; y <>
for (int x = 0 ; x <>
image(images[index], x * (width / NCOLS), y * (height / NROWS), (width / NCOLS), (height / NROWS));
index++;
}
}

// update a random image
int i = (int)random(feeds.length);
images[i] = loadImage(feeds[i]);

// sleep
delay(2000);
}

No comments:

Post a Comment