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.
Page Index Toggle Pages: 1
Much slower in p87 than p68 (Read 1204 times)
Much slower in p87 than p68
May 7th, 2005, 9:42pm
 
Hello all,

I'm new to Processing, so please excuse my ignorance...  I can't figure out why the following code runs at a decent framerate in p68:

********************

void setup() {
 size(640, 560);  
 beginVideo(320, 240, 30);
 background(0);
}

void loop() {
 image(video, 320, 320);
 replicate(1, 0, 321, 560, 0, 0, 320, 560);  
 replicate(0, 1, 640, 321, 0, 0, 640, 320);      
}

********************

But editing the code to work in p87 as follows runs at about 1 fps:

********************

import processing.video.*;
Capture myCamera;

void setup() {
 size(640, 560);
 println(Capture.list());
 String captureDevice = "IIDC FireWire Video";
 myCamera = new Capture(this, captureDevice, 320, 240, 30);
}

void captureEvent(Capture myCamera) {
 myCamera.read();
}

void draw() {
 image(myCamera, 320, 320);
 copy (1, 0, 321, 560, 0, 0, 320, 560);  
 copy (0, 1, 640, 321, 0, 0, 640, 320);
}

********************

On a related note, I'd like to store each frame of video into a 3D box with the current frame projected on the front. Then, I want to be able to look at the box from an orthographic projection and see the resulting top and side views.  Eventually, I'd like to be able to view slices through the box at different angles to see interesting changes of the video through time.  

I'm thinking something along the lines of a very stripped down version of this: http://www.k2.t.u-tokyo.ac.jp/members/alvaro/Khronos/Khronos_Projector.htm

In the meantime, I'm so new to processing and programming in general that I can't figure out how to store the video in the first place.  :\

Any suggestions are greatly appreciated.
Re: Much slower in p87 than p68
Reply #1 - May 7th, 2005, 11:17pm
 
try size(640, 560, P3D) instead at the beginning of your app and see if that helps. the new default renderer is really slow with heavy pixel operations like moving video around and lots of copy() calls.
Re: Much slower in p87 than p68
Reply #2 - May 8th, 2005, 12:56am
 
Thanks, Fry.

That helped quite a bit.  Any suggestions as to how to go about storing the data from the individual frames?

Page Index Toggle Pages: 1