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

Fullframe Video Capture

$
0
0

Does anyone know how to get this video capture code working at fullScreen( )? When I change it to full screen it does not work at all and I know it is based on the fact this code was written for a specific size and a lot is based on that size.

This is a modification of Daniel Shiffman's Video - Software Mirrors code. https://processing.org/tutorials/video/

Thanks!

import processing.video.*;

// Size of each cell in the grid, ratio of window size to video size
int videoScale = 20;

// Number of columns and rows in the system
int cols, rows;

// Variable to hold onto Capture object
Capture video;

// used for the noise randomness
float xoff = 0.0;
float yoff = 0.0;
float coff = 0.0;


void setup() {
  size(1280, 720);
  //fullScreen( );

  // Initialize columns and rows
  cols = width/videoScale;
  rows = height/videoScale;
  background(0);
  video = new Capture(this, cols, rows);
  video.start();
}

// Read image from the camera
void captureEvent(Capture video) {
  video.read();
}

void draw() {
  video.loadPixels();

  // Begin loop for columns
  for (int i = 0; i < cols; i++) {
    // Begin loop for rows
    for (int j = 0; j < rows; j++) {
      int x = i*videoScale;
      int y = j*videoScale;
      color c = video.pixels[i + j*video.width];

      fill(c);
      stroke(0);

      //rotate the rect
      xoff = xoff + .01;
      float n = noise(xoff) * width;
      pushMatrix( );
      translate(x + videoScale/2, y + videoScale/2);
      rotate(radians(45 + n));
      translate(-(x + videoScale/2), -(y + videoScale/2));

      // draw the rect with the video color
      rect(x, y, videoScale/1.9, videoScale/1.9);
      popMatrix( );
    }
  }
}

Viewing all articles
Browse latest Browse all 2896

Trending Articles