Quantcast
Channel: Library Questions - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 2896

ArrayList of captured images + display them in a split screen on same sketch - How To Do It?

$
0
0

Hi Good Folks;

I'm pretty principiant with processing and I need some hints for this project, please.

I'm using a PS3 Eye and with a "key pressed" function I wanted to save the frame. (this works) Then:

I need to visualize the last 4 images saved which are located in a folder: from the most recent to the oldest.

The screen should be split like this: 4 images: 160x160 (in the top of the screen);

The rest of the screen (640x320) should display the live view of the webcam.

Each time a new capture has been taken it should be displayed in the first image up left and the others decrease position.

I hope is clear, Thank you for any supports

Here the code:

import java.util.ArrayList;

import com.thomasdiewald.ps3eye.PS3Eye;
import com.thomasdiewald.ps3eye.PS3EyeP5;

PS3EyeP5 ps3eye;

int counter = 0;

boolean Flash;
int startTime;
final int FLASH_DURATION = 70;

void setup() {
  size(640, 480);
  smooth(0);
  ps3eye = PS3EyeP5.getDevice(this);
  ps3eye.init(60, PS3Eye.Resolution.VGA);
  ps3eye.start();
  frameRate(1000);
}

void draw() {
  if (ps3eye !=null) {
    ps3eye.start();
    image(ps3eye.getFrame(), 0, 0, width, height);
  }

  if (Flash) {
    image(loadImage("white.jpg"), -5, 0);
    ps3eye.stop();
  }
  if (millis() - startTime > FLASH_DURATION) {
    Flash = false;
  } else {
    ps3eye.start();
  }
}

void keyPressed() {
  if ( key == 's' ) {
    String s = "print/" + "microbe" + nf(counter, 4) +".jpg";
    save(s);
    counter++;
    Flash = true;
    startTime = millis();
  }
}

Viewing all articles
Browse latest Browse all 2896

Trending Articles