help i dont arrived to mix a sketch with light painting and mirroring using Jmyron
in
Contributed Library Questions
•
1 year ago
i ve this sketch who make light painting :
- /* 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();
- }
and i want to put inside a mirroring
- 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()];
- }
- }
i don t arrived to have both mirroring and painting
when i put the mirroring code
i get painting or mirroring
i dont get both
thanks for answer
1