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 & HelpSyntax Questions › if i can change the image to movie
Page Index Toggle Pages: 1
if i can change the image to movie? (Read 454 times)
if i can change the image to movie?
Dec 22nd, 2005, 6:41pm
 
hello all, i like the example of "brightness-Adjusts the brightness of part of the image Pixels closer to the mouse will appear brighter" by D.Shiffman. i'm thinking about a video installation basiclly on this example. so if i can replace the img to myMovie? thank you for any advise...
Re: if i can change the image to movie?
Reply #1 - Dec 23rd, 2005, 12:57pm
 
both Movie and PImage (img and myMovie) has an array of pixels which you can manually change

so this does it.. just change 35 (both places) to whatever radius you'd like..
Code:

import processing.video.*;
Movie myMovie;
PImage main;

void setup()
{
myMovie = new Movie(this, "station.mov");
myMovie.loop();
myMovie.read(); // read once so width and height != 1
main = new PImage(myMovie.width,myMovie.height);
size(myMovie.width,myMovie.height);
}

void movieEvent(Movie myMovie) {
myMovie.read();
}

void draw()
{
background(0);
myMovie.loadPixels();
for(int x = 0; x < myMovie.width; x++)
{
for(int y = 0; y < myMovie.height; y++)
{
int cur = y*myMovie.width+x;
float d = dist(mouseX,mouseY,x,y);
main.pixels[cur] = changeBrightness(myMovie.pixels[cur],(d<35)?(35-d)*10:0);
}
}
main.updatePixels();
image(main,0,0);
}

color changeBrightness(color c, float val)
{
// note, positive val gives brighter, negative gives darker
return color(red(c)+val,green(c)+val,blue(c)+val);
}


-seltar
Re: if i can change the image to movie?
Reply #2 - Dec 23rd, 2005, 1:19pm
 
thank you so much seltar, but i think this sample maybe not fit of my installation, the black cover lost in every frame, its easy in the image mode, but i guess difficult to do same thing in myMovie.
anyway thanks and merry christmas
Page Index Toggle Pages: 1