We are about to switch to a new forum software. Until then we have removed the registration on this forum.
/** * FX Program
*BY Matthew Corones
*Utalizing Andrew's frame blending technique
*/
import processing.video.*;
int frame1 = 1920; int frame2 = 1080; PImage renderedRed = createImage( frame1, frame2, RGB); PImage renderedGreen = createImage( frame1, frame2, RGB); PImage renderedBlue = createImage( frame1, frame2, RGB); PImage renderedYellow = createImage( frame1, frame2, RGB); PImage renderedOrange = createImage( frame1, frame2, RGB); PImage color777 = createImage( frame1, frame2, ALPHA);
Capture cam2, cam; int a ; int s1; int ht; int wd; int m;
int q;
int h;
int q1 = 30; int h1 = 30;
int game = 1;
int QQQ = 30; int RRR = 30;
int inc = 1;
int time;
void setup() {
fullScreen(P2D, 1);
//size(1920,1080,P2D);
String[] cameras = Capture.list();
if (cameras == null) { println("Failed to retrieve the list of available cameras, will try the default..."); cam = new Capture(this, 640, 480); } if (cameras.length == 0) { println("There are no cameras available for capture."); exit(); } else { println("Available cameras:"); for (int i = 0; i < cameras.length; i++) { println(cameras[i]); } frameRate(60); // The camera can be initialized directly using an element // from the array returned by list(): cam = new Capture(this, cameras[0]); // Or, the settings can be defined based on the text in the list //cam = new Capture(this, 640, 480, "Built-in iSight", 30);
// Start capturing the images from the camera
cam.start();
cam2 = new Capture(this, cameras[0]);
// Or, the settings can be defined based on the text in the list
//cam = new Capture(this, 640, 480, "Built-in iSight", 30);
// Start capturing the images from the camera
cam2.start();
} }
void draw() { if (cam.available() == true) { cam.read(); } if (cam2.available() == true) { cam2.read(); }
background(0);
inc++;
if (inc < 100) {
image(cam, 0, 0, 1920, 1080);
clr();
}
if (inc > 100 && inc < 200) {
image(cam2, 0, 0, 1920, 1080);
cam2.filter(GRAY);
clr();
}
if (inc > 200 && inc < 300) {
image(cam, 0, 0, 1920, 1080);
cam.filter(INVERT);
//cam2.filter(GRAY);
clr();
}
if (inc > 300 && inc < 400) {
image(cam2, 0, 0, 1920, 1080);
cam2.filter(GRAY);
for (int q = 0; q < width; q = q +20 ) {
for (int h = 0; h < height; h = h +20 ) {
blend(q, h, 60, 60, q, h, 20, 20, NORMAL);
}
}
clr();
}
if (inc > 400 && inc < 500) {
image(cam, 0, 0, 1920, 1080);
cam.filter(INVERT);
for (int q = 0; q < width; q = q +20 ) {
for (int h = 0; h < height; h = h +20 ) {
blend(q, h, 60, 60, q, h, 20, 20, NORMAL);
}
}
clr();
}
if (inc > 500 && inc < 600) {
image(cam, 0, 0, 1920, 1080);
for (int q = 0; q < width; q = q +20 ) {
for (int h = 0; h < height; h = h +20 ) {
blend(q, h, 60, 60, q, h, 20, 20, NORMAL);
}
}
clr();
} if (inc > 600) {
inc = 1;
} }
void clr() {
s1 = s1 + 1;
if (s1 == 6) {
s1 = 0;
}
ht = ht + 10; wd = wd + 10;
if ( s1 == 1 ) {
tint(255, 0, 102);
loadPixels();
for (int i = 0; i < frame1*frame2; i++) {
renderedBlue.pixels[i] = pixels[i];
}
updatePixels();
}
if ( s1 == 2 ) { tint(0, 255, 0);
loadPixels();
for (int i = 0; i < frame1*frame2; i++) {
renderedGreen.pixels[i] = pixels[i];
}
updatePixels();
}
if ( s1 == 3 ) {
tint(0, 204, 255);
loadPixels();
for (int i = 0; i < frame1*frame2; i++) {
renderedRed.pixels[i] = pixels[i];
}
updatePixels();
if ( s1 == 4 ) {
tint(255, 255, 0);
loadPixels();
for (int i = 0; i < frame1*frame2; i++) {
renderedYellow.pixels[i] = pixels[i];
}
updatePixels();
}
}
if ( s1 == 5 ) {
tint(255, 128, 0);
loadPixels();
for (int i = 0; i < frame1*frame2; i++) {
renderedOrange.pixels[i] = pixels[i];
}
updatePixels();
}
blend(renderedOrange, 0, 0, frame1, frame2, 0, 0, frame1, frame2, LIGHTEST);
blend(renderedGreen, 0, 0, frame1, frame2, 0, 0, frame1, frame2, LIGHTEST);
blend(renderedBlue, 0, 0, frame1, frame2, 0, 0, frame1, frame2, LIGHTEST);
blend(renderedRed, 0, 0, frame1, frame2, 0, 0, frame1, frame2, LIGHTEST);
blend(renderedYellow, 0, 0, frame1, frame2, 0, 0, frame1, frame2, LIGHTEST); }
Comments
http://forum.Processing.org/two/discussion/8045/how-to-format-code-and-text