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

rotate an array of webcams

$
0
0

Hi guys, Thanks for having me in this forum. I am a complete beginner in Processing and I hope I'm in the right category to ask this question. I'm working on a sketch where I want to rotate 90° an array of Webcam inputs. At the moment, to keep it simple, I'm using the default webcam from my MacBook Pro (Retina, 15-inch, Mid 2015), running macOS High Sierra 10.13.2.

I guess I don't really understand how rotate(), translate(), pushMatrix() and popMatrix() work. I tried to use them but I always get weird results.

Here is the code:

import processing.video.*;
Capture webcam;
int[] xpos = {100, 300, 500, 700, 900};




void setup() {
  size(1280, 480);
  webcam = new Capture(this, 640, 480);  
  webcam.start();
  background (100, 0, 0);
}

void draw() {
  if (webcam.available()) {
    webcam.read();


    for (int i =0; i<xpos.length; i++) {

      image(webcam, xpos[i], 0, 160, 90);

      //HERE is where the issue starts. Please Uncomment the following code to check the issue.
      //translate(width/2, height/2);
      //rotate(radians(90));
      //image( webcam, 0, 0);
    }
  }
}

Viewing all articles
Browse latest Browse all 2896

Trending Articles