ericbarch / processing-light-painting

Paint images with a flashlight - built on Processing
1 stars 1 forks source link

mirroring #1

Open techno94 opened 11 years ago

techno94 commented 11 years ago

hello is it possible to have mirroring in you re sketch and register a movie of the painting ?

thanks

ericbarch commented 11 years ago

Just saw your post on my blog...is this what you were looking to see changed?

int[] imgNormal = videoSrc.cameraImage();

for(int i=1; i<width;i++){ for(int j=1;j<height;j++){ this.pixels[(videoSrc.width() - i - 1) + j * videoSrc.width()] = imgNormal[(i) + j * videoSrc.width()]; } }

ericbarch commented 11 years ago

Don't have a way of recording a movie at the moment =/ It's actually been quite some time since I've looked at this...it was just put together quickly one night. Are you interested in help develop it?

techno94 commented 11 years ago

hi hello sorry i don t pass on the web site since a moment. yes i put int[] imgNormal = videoSrc.cameraImage();

for(int i=1; i<width;i++){ for(int j=1;j<height;j++){ this.pixels[(videoSrc.width() - i - 1) + j * videoSrc.width()] = imgNormal[(i) + j * videoSrc.width()]; } } on you re web site. i ve found a sketch of mirroring, but i don t arrived to mix you re sketch and this sketch. i just arrived to have mirroring, or light painting not both.

for recording, i ve take a look, i arrived to record but the sketch become very slow. here what i do with you re sketch thanks

/* Light Painting Assist App v0.1 by Eric Barch (ttjcrew.com) */

//Sets the minimum value to be counted as intense (Max of 255) int INTENSITY_MIN = 175; import processing.video.*; MovieMaker mm;

/* Begin Main Code / import JMyron.; JMyron videoSrc; int[] currFrame; int[] lastFrame;

void setup() { size(640, 480); videoSrc = new JMyron(); videoSrc.start(width, height); videoSrc.findGlobs(0);

videoSrc.update(); lastFrame = videoSrc.image(); mm = new MovieMaker(this, width, height, "painting.mov" , 15, MovieMaker.H263, MovieMaker.HIGH); }

void draw() { videoSrc.update(); currFrame = videoSrc.image();

loadPixels();
for (int i = 0; i < width*height; i++) { float r = red(currFrame[i]); float g = green(currFrame[i]); float b = blue(currFrame[i]); float rl = red(lastFrame[i]); float gl = green(lastFrame[i]); float bl = blue(lastFrame[i]);

//if it's bright we need to save it
if (((r + g + b)/3) > INTENSITY_MIN) {
  lastFrame[i] = color(r, g, b);
} //dark...overwrite with current cam frame
else if (((rl + gl + bl)/3) <= INTENSITY_MIN) {
  lastFrame[i] = color(r, g, b);
}

pixels[i] = lastFrame[i];

}

updatePixels(); mm.addFrame();

}

void mousePressed() { videoSrc.update(); lastFrame = videoSrc.image(); }

public void stop() { videoSrc.stop(); super.stop(); } void keyPressed() { // Finish the movie if space bar is pressed! if (key == ' ' ) { println( "finishing movie" ); // Do not forget to finish the movie! Otherwise, it will not play properly. mm.finish(); } }