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_
   Programming Questions & Help
   Programs
(Moderators: fry, REAS)
   copy video onto memory?
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: copy video onto memory?  (Read 424 times)
reinout wallis de vries
Guest
Email
copy video onto memory?
« on: Jun 14th, 2004, 8:17pm »

right now i use the follwing line to put a live videoimage on the canvas.  

image(video, 10, 10);  

from here i copy it to a canvas-memory where i do my thing.  
i would like to copy it directly to this canvas-memory. is there a way to copy live-video to a memory?  

greetz,  
nout
 
fjen

WWW
Re: copy video onto memory?
« Reply #1 on: Jul 16th, 2004, 9:26pm »

you can copy the pixels (colors) like this:
 
for (int px=0; px < video.pixels.length; px++)
{
    canvas_memory.pixels[px] = video.pixels[px];
}
 
just make sure video.pixels.length == canMem.pixels.length.
 
narain


Re: copy video onto memory?
« Reply #2 on: Jul 17th, 2004, 7:18am »

Of course, you want both width and height to match, otherwise the image will get garbled data.
 
However, as long as it's larger than the video, you can do this:
Code:
for (int x = 0; x < video.width; x++) {
  for (int y = 0; y < video.height; y++) {
    canvas[x + y*canvas.width] = video[x + y*video.width];
  }
}
 
Pages: 1 

« Previous topic | Next topic »