FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Topics & Contributions
   Video, Camera
(Moderator: REAS)
   timeblind - camera works
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: timeblind - camera works  (Read 993 times)
elout

12747371274737 WWW
timeblind - camera works
« on: Dec 21st, 2003, 6:35pm »

I started to work on this (web)cam VJ tool tool, so in the future I can add a lot of different camera effects.
http://www.xs4all.nl/~elout/proce55ing/camstuff/diaapp003.pde
 
Although this version is still alpha and I`m still working and thinking about a better interaction model and different effects.
 
 
One thing I like the most till now, is this timeblind - timeblur thing.
 
Code:

// elout de kok - www.xs4all.nl/~elout/
// timeblind - timeblur
// p5 - v.067
 
boolean imgUpdate=false;
int fps_camera=12;
BImage videobuffer;
int r1,g1,b1;
int timeblurstep=24; // set the speed of the fade
int pstepper=timeblurstep-1;
 
void setup()
{
  size(352, 288);
  beginVideo(width, height, fps_camera);
  videobuffer = new BImage(width, height);
}
 
public void videoEvent()
{
  imgUpdate=true;
}
 
void loop()
{
  if (imgUpdate==true)
  {
    for(int i=0; i<width*height; i++)
    {
 r1=((((videobuffer.pixels[i] >> 16) & 0xff)* pstepper) + ((video.pixels[i] >> 16) & 0xff))/timeblurstep;
 g1=((((videobuffer.pixels[i] >>  8) & 0xff)*pstepper)+ ((video.pixels[i] >>  8) & 0xff))/timeblurstep;
 b1=(((videobuffer.pixels[i] & 0xff)* pstepper)+ (video.pixels[i] & 0xff))/timeblurstep;
 videobuffer.pixels[i] =  ( (0xff<<24) | ( r1 << 16) | ( g1 << 8) | b1);
    }
    image(videobuffer, 0, 0, width, height);
    imgUpdate=false;
  }
  //just add a little delay so the system can handle other stuff as well
  delay(20);
}

 
I realy would like to; setting up a camera and screen in a busy street-window, were loads of people walking by and traffic is rushing, people that who stand still to watch this piece, suddenly will slowly show up in this 'frozen' enviroment.
 
arielm

WWW
Re: timeblind - camera works
« Reply #1 on: Dec 22nd, 2003, 4:26pm »

hey elout,
 
i started today with a webcam, and enjoyed to play with your ready-made piece of code!
 
one interesting finding: within loop(), if you remove
Code:
image(videobuffer, 0, 0, width, height)

and replace it with
Code:
pixels = videobuffer.pixels

it does the job, and you save one full-screen "blit"!
 

Ariel Malka | www.chronotext.org
whiteflea


Re: timeblind - camera works
« Reply #2 on: Jan 9th, 2004, 4:32pm »

i played around with REAS example:
http://www.proce55ing.net/learning/examples/camera.html
 
it takes mouseX for the alpha value. Looks like I did the same effect.....
 
Code:

int xpos = 0;
int ypos = 0;
boolean newFrame = false;
 
 
void setup()  
{  
  size(400, 300);  
  beginVideo(400, 300, 30);  
  colorMode(RGB,width);
}  
 
 
void videoEvent()
{
  newFrame = true;
}
 
void loop()  
{  
  if(newFrame) {
    xpos = 0;
    ypos = 0;
    tint(400,mouseX);
    image(video, xpos, ypos);
    newFrame = false;
  }  
}  

 
cu
whiteflea
 
I LOVE PROCESSING!
 



==================================
Software is mindcontrol - get some
==================================
Shut up or I will replace you with
a very small processing script


Pages: 1 

« Previous topic | Next topic »