We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › 30 Webcam Feeds = Very Slow
Pages: 1 2 
30 Webcam Feeds = Very Slow (Read 3346 times)
Re: 30 Webcam Feeds = Very Slow
Reply #15 - Dec 11th, 2009, 8:14am
 
your draw method needs {}s
Re: 30 Webcam Feeds = Very Slow
Reply #16 - Dec 11th, 2009, 8:16am
 
You should put braces {} around the code of draw()...

Also you can write:
Code:
String[] feeds =
{
"http://www.adelaidecitycouncil.com/netcatapps/webcam/images/centralMkt.jpg",
"http://www.adelaidecitycouncil.com//NetcatApps/webcam/images/bellnth.jpg",
// etc.
};

before setup, thus no need to count the number of feeds, no more manual incrementation of indices, etc. Cleaner.

And no need for two loadImage loops in setup().
Re: 30 Webcam Feeds = Very Slow
Reply #17 - Dec 11th, 2009, 8:59am
 
Righty ho, I've put the brackets in (schoolboy error!) & changed the array to make it cleaner but now it's saying "Syntax error, maybe missing a semicolon?" 'at the String[] feeds' = part. What's going on?

String[] feeds =
{  "http://www.adelaidecitycouncil.com/netcatapps/webcam/images/centralMkt.jpg",
  "http://www.adelaidecitycouncil.com//NetcatApps/webcam/images/bellnth.jpg",

...

  "http://www.outercam.co.uk/ssc/camera2.jpg?1260455145216";};
PImage[] imgfeeds = new PImage[30];

void setup(){
 size(1280, 800);
 
for (int i = 0 ; i < 29 ; i++) {
imgfeeds[i] = loadimage(imgfeeds[i]);
 }
}
 
void draw(){
int i = (int)random(29);
feeds[i]  = loadimage(imgfeeds[i]);
delay(1000);
}
Re: 30 Webcam Feeds = Very Slow
Reply #18 - Dec 11th, 2009, 9:18am
 
this:

String[] oneDimArray = { "abc","def","xyz" };

suggests you don't need that last semicolon inside the {}s in your string[] definition
Re: 30 Webcam Feeds = Very Slow
Reply #19 - Dec 11th, 2009, 9:25am
 
Thanks, that worked, but this thing just doesn't want to live!
It's now saying "The function loadImage(PImage) does not exist"(?!)

this is happening in the

imgfeeds[i] = loadimage(imgfeeds[i]);

part of the code.

What is going wrong?
Re: 30 Webcam Feeds = Very Slow
Reply #20 - Dec 11th, 2009, 9:30am
 
capital I in loadImage...
Re: 30 Webcam Feeds = Very Slow
Reply #21 - Dec 11th, 2009, 9:39am
 
It's slowly coming together! I think there's just one more thing (touch wood) - It says "The methodloadImage(String) in the type PApplet is not applicable for the arguments (PImage)".

I have figured out what this means, but I don't know how to change the format of the feeds in the array...

I'm so close!!!

String[] feeds =
{  "http://www.adelaidecitycouncil.com/netcatapps/webcam/images/centralMkt.jpg",

...

  "http://www.outercam.co.uk/ssc/camera2.jpg?1260455145216"};
PImage[] imgfeeds = new PImage[30];

void setup(){
 size(1280, 800);
 
for (int i = 0 ; i < 29 ; i++) {
imgfeeds[i] = loadImage(imgfeeds[i]);
 }
}
 
void draw(){
int i = (int)random(29);
feeds[i]  = loadImage(imgfeeds[i]);
delay(1000);
Re: 30 Webcam Feeds = Very Slow
Reply #22 - Dec 11th, 2009, 10:31am
 
loadImage is expecting the name, ie feeds[i], rather then the image
Re: 30 Webcam Feeds = Very Slow
Reply #23 - Dec 11th, 2009, 1:22pm
 
Yay, the code is now displaying feeds, but it is all of the same image. I'm wanting each of the 30 feeds to display different images. How do I do that?

String[] feeds = new String[30];

PImage[] imgfeeds = new PImage[30];

void setup(){
 
  feeds[0] = ("http://www.adelaidecitycouncil.com/netcatapps/webcam/images/centralMkt.jpg");
  feeds[1] = ("http://www.adelaidecitycouncil.com//NetcatApps/webcam/images/bellnth.jpg");
  feeds[2] = ("http://www.adelaidecitycouncil.com/netcatapps/webcam/images/rundleEast.jpg");
  feeds[3] = ("http://www.adelaidecitycouncil.com/netcatapps/webcam/images/sk8cam.jpg");
  feeds[4] = ("http://www.adelaidecitycouncil.com//NetcatApps/webcam/images/bellsth.jpg");
  feeds[5] = ("http://www.abbeyroad.com/webcam/crossing.jpg?cacheKiller=362683");
  feeds[6] = ("http://server.fishycam.com/fishycam.jpg?time=1260184950863");
  feeds[7] = ("http://www.cph.dk/CPHdata/webcam/CPH_spot1.jpg?1260188477647");
  feeds[8] = ("http://www.adelaidecitycouncil.com/netcatapps/webcam/images/rundle.jpg");
  feeds[9] = ("http://images.ibsys.com/sea/images/weather/auto/queenannecam_640x480.jpg?");
  feeds[10] = ("http://www.pani.com/webcam/airport_tower.jpg?");
  feeds[11] = ("http://www.cph.dk/CPHdata/webcam/CPH_spot3.jpg?1260369631305");
  feeds[12] = ("http://www.camchickens.com/webcam.jpg");
  feeds[13] = ("http://www.terrapin-gardens.net/images/webcam.jpg");
  feeds[14] = ("http://stream.fisheyeview.com/FVCam.jpg");
  feeds[15] = ("http://www.cs.ualberta.ca/~lake/cam/jpg/large/201.jpg");
  feeds[16] = ("http://webcams.pancanal.com/webcam/miraflores.jpg");
  feeds[17] = ("http://www.oceanvillageholidays.co.uk/webcam/ov1.jpg");
  feeds[18] = ("http://brooklyn-bridge.mobotixcam.de/record/current.jpg?rand=380424");
  feeds[19] = ("http://www.outercam.co.uk/ssc/camera3.jpg?1260446915311");
  feeds[20] = ("http://www.xs4all.nl/~twocats/cam/Cam-A.jpg");
  feeds[21] = ("http://www.sat.dundee.ac.uk/webcam/cam0.jpg");
  feeds[22] = ("http://facweb.furman.edu/~rbryson/dramadept/TheatreCamPic.jpg");
  feeds[23] = ("http://www.cbc.ca/bc/webcam/images/webcam.jpg");
  feeds[24] = ("http://www.outercam.co.uk/ssc/camera2.jpg?1260455145216");
  feeds[25] = ("http://www.jb.man.ac.uk/common/camera30sec.jpg?dummy=1260456117729");
  feeds[26] = ("http://ecoast.vs.oiccam.com:443/ftp/capcom/jackalope/image.jpg?rand=14:52:10");
  feeds[27] = ("http://www.outercam.co.uk/ssc/camera2.jpg?1260455145216");
  feeds[28] = ("http://www.outercam.co.uk/ssc/camera2.jpg?1260455145216");
  feeds[29] = ("http://www.outercam.co.uk/ssc/camera2.jpg?1260455145216");
 
  imgfeeds[0] = loadImage("http://www.adelaidecitycouncil.com/netcatapps/webcam/images/centralMkt.jpg");
  imgfeeds[1] = loadImage("http://www.adelaidecitycouncil.com//NetcatApps/webcam/images/bellnth.jpg");
  imgfeeds[2] = loadImage("http://www.adelaidecitycouncil.com/netcatapps/webcam/images/rundleEast.jpg");
  imgfeeds[3] = loadImage("http://www.adelaidecitycouncil.com/netcatapps/webcam/images/sk8cam.jpg");
  imgfeeds[4] = loadImage("http://www.adelaidecitycouncil.com//NetcatApps/webcam/images/bellsth.jpg");
  imgfeeds[5] = loadImage("http://www.abbeyroad.com/webcam/crossing.jpg?cacheKiller=362683");
  imgfeeds[6] = loadImage("http://server.fishycam.com/fishycam.jpg?time=1260184950863");
  imgfeeds[7] = loadImage("http://www.cph.dk/CPHdata/webcam/CPH_spot1.jpg?1260188477647");
  imgfeeds[8] = loadImage("http://www.adelaidecitycouncil.com/netcatapps/webcam/images/rundle.jpg");
  imgfeeds[9] = loadImage("http://images.ibsys.com/sea/images/weather/auto/queenannecam_640x480.jpg?");
  imgfeeds[10] = loadImage("http://www.pani.com/webcam/airport_tower.jpg?");
  imgfeeds[11] = loadImage("http://www.cph.dk/CPHdata/webcam/CPH_spot3.jpg?1260369631305");
  imgfeeds[12] = loadImage("http://www.camchickens.com/webcam.jpg");
  imgfeeds[13] = loadImage("http://www.terrapin-gardens.net/images/webcam.jpg");
  imgfeeds[14] = loadImage("http://stream.fisheyeview.com/FVCam.jpg");
  imgfeeds[15] = loadImage("http://www.cs.ualberta.ca/~lake/cam/jpg/large/201.jpg");
  imgfeeds[16] = loadImage("http://webcams.pancanal.com/webcam/miraflores.jpg");
  imgfeeds[17] = loadImage("http://www.oceanvillageholidays.co.uk/webcam/ov1.jpg");
  imgfeeds[18] = loadImage("http://brooklyn-bridge.mobotixcam.de/record/current.jpg?rand=380424");
  imgfeeds[19] = loadImage("http://www.outercam.co.uk/ssc/camera3.jpg?1260446915311");
  imgfeeds[20] = loadImage("http://www.xs4all.nl/~twocats/cam/Cam-A.jpg");
  imgfeeds[21] = loadImage("http://www.sat.dundee.ac.uk/webcam/cam0.jpg");
  imgfeeds[22] = loadImage("http://facweb.furman.edu/~rbryson/dramadept/TheatreCamPic.jpg");
  imgfeeds[23] = loadImage("http://www.cbc.ca/bc/webcam/images/webcam.jpg");
  imgfeeds[24] = loadImage("http://www.outercam.co.uk/ssc/camera2.jpg?1260455145216");
  imgfeeds[25] = loadImage("http://www.jb.man.ac.uk/common/camera30sec.jpg?dummy=1260456117729");
  imgfeeds[26] = loadImage("http://ecoast.vs.oiccam.com:443/ftp/capcom/jackalope/image.jpg?rand=14:52:10");
  imgfeeds[27] = loadImage("http://www.outercam.co.uk/ssc/camera2.jpg?1260455145216");
  imgfeeds[28] = loadImage("http://www.outercam.co.uk/ssc/camera2.jpg?1260455145216");
  imgfeeds[29] = loadImage("http://www.outercam.co.uk/ssc/camera2.jpg?1260455145216");
 
 size(1280, 800);
 
for (int i = 0 ; i < 30 ; i++) {
imgfeeds[i] = loadImage(feeds[i]);
 }
}
 
void draw(){
int i = (int)random(30);
imgfeeds[i]  = loadImage(feeds[i]);
delay(1000);

image(imgfeeds[i], 0, 0, (width/6), (height/5));
image(imgfeeds[i], (width/6), 0, (width/6), (height/5));
image(imgfeeds[i], (width/6)*2, 0, (width/6), (height/5));
image(imgfeeds[i], (width/6)*3, 0, (width/6), (height/5));
image(imgfeeds[i], (width/6)*4, 0, (width/6), (height/5));
image(imgfeeds[i], (width/6)*5, 0, (width/6), (height/5));

}
Re: 30 Webcam Feeds = Very Slow
Reply #24 - Dec 11th, 2009, 1:50pm
 
When you post some code, please use [ code ] and [ /code ] tags (without spaces) to make your code look like... code! Cool

Why don't you try with 4 feeds? That would be much easier to read for us.

Your 30 lines in setup() starting with
Code:
imgfeeds[...] = loadImage("..."); 


are useless since you fill the array later in a simple loop with
Code:
for (int i = 0 ; i < 30 ; i++) {
imgfeeds[i] = loadImage(feeds[i]);
}

which is the proper way to do this.

The last image(...) statements in your draw() loop print the same image. If you want to display other images, you have to change i between each statement.
Re: 30 Webcam Feeds = Very Slow
Reply #25 - Dec 11th, 2009, 2:15pm
 
Thanks antiplastik, I'm new & don't really know how to work this! OK I'll play around with the i bit & I'll get back to you.

Sorry again!
Re: 30 Webcam Feeds = Very Slow
Reply #26 - Dec 11th, 2009, 2:27pm
 
is late here and i'm slightly fed up...

change NROWS and NCOLS to number of rows and columns. these should multiply up to the number of feeds.

add feeds to the feeds array.

Code:

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

// list of cameras
String[] feeds = {
 "http://www.adelaidecitycouncil.com/netcatapps/webcam/images/centralMkt.jpg",
 "http://www.adelaidecitycouncil.com//NetcatApps/webcam/images/bellnth.jpg",
 "http://www.adelaidecitycouncil.com/netcatapps/webcam/images/rundleEast.jpg",
 "http://www.adelaidecitycouncil.com/netcatapps/webcam/images/sk8cam.jpg",
 "http://www.adelaidecitycouncil.com//NetcatApps/webcam/images/bellsth.jpg",
 "http://www.abbeyroad.com/webcam/crossing.jpg?cacheKiller=362683"
 // more here...
};
PImage[] images;

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

void draw(){
 // draw grid
 int index = 0;
 for (int y = 0 ; y < NROWS ; y++) {
   for (int x = 0 ; x < NCOLS ; 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(1000);
}
Re: 30 Webcam Feeds = Very Slow
Reply #27 - Dec 12th, 2009, 6:42am
 
Thanks, one day I will become a Processing God & help other people out!
Pages: 1 2