Adding captures to array
in
Core Library Questions
•
2 months ago
Hi guys,
I'm trying to collect captures from the webcam to an array of PImages, but it seems like all images in the array are the same one. This is the relevant code. Any ideas on how to I get around this?
- Capture cam;
- boolean activate = false;
- ArrayList<PImage> imagesSoFar;
- int currentIndex = 0;
- int framesNumber = 50;
- PImage imageToAdd;
- public void setup(){
- size(900,600);
- String[] cameras = Capture.list();
- cam = new Capture(this, cameras[0]);
- cam.start();
- imagesSoFar = new ArrayList < PImage >();
- }
- public void draw(){
- if (cam.available()) {
- cam.read();
- }
- image(cam,0, 0,width, height);
- if(activate){
- if (currentIndex == 0){
- }
- if(currentIndex<framesNumber){
- imagesSoFar.add(cam);
- currentIndex ++;
- }
1