We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello: I am a current MFA graduate student at CUNY Hunter. The other night was the opening to my Thesis show and the Processing program I had developed in at the 11th hour, just didn't work. After lots of tries to rectify the situation I came up with nothing. I am in desperate need for someone to come in and get my program running.
It uses openCV, keystone, and the video libraries on Processing.
This will be a paid job $25/hr with additional $100 bonus if you manage to get it running reliably. You will need to be able to physically come to the space.
Attached is the code (though there have been some edits that I sadly don't have on this computer)
If interested please message me.
//and open.cv libraries (Sketch > Import Library > Add Library
import deadpixel.keystone.*;
import gab.opencv.*;
import processing.video.*;
import java.awt.*;
import java.awt.Rectangle;
//KEYSTONE stuff
Keystone ks;
CornerPinSurface surfaceleft;
CornerPinSurface surfacecenter;
CornerPinSurface surfaceright;
PGraphics offscreenleft;
PGraphics offscreencenter;
PGraphics offscreenright;
// movie object to play and pause later
//there will be three videos playing on one screen...
Movie myMovieleft;
Movie myMoviecenter;
Movie myMovieright;
//WEBCAM/FACE DETECTION stuff
OpenCV opencv;
Capture camleft;
Capture camcenter;
Capture camright;
String[] captureDevices;
boolean start=false;
void setup() {
//this will println listing the webcams you need to but the number on the left in the []
//to make them work
printArray(Capture.list());
background(0);
size(2640, 1080, P3D); //this should be large enough to house all the videos
opencv = new OpenCV(this, 160, 120);
//KEYSTONE stuff
ks = new Keystone(this);
//these values can change but must be the same for offscreenleft/center/right
surfaceleft = ks.createCornerPinSurface(400, 300, 20);
surfacecenter = ks.createCornerPinSurface(400, 300, 20);
surfaceright = ks.createCornerPinSurface(400, 300, 20);
// We need an offscreen buffer to draw the surface we
// want projected
// note that we're matching the resolution of the
// CornerPinSurface.
// (The offscreen buffer can be P2D or P3D)
// P3D is telling processing to be in 3D mode
// the number is 400, 300 is related to eachother they must be the same
offscreenleft = createGraphics(400, 300, P3D);
offscreencenter = createGraphics(400, 300, P3D);
offscreenright = createGraphics(400, 300, P3D);
//WEBCAM stuff
//this is turning the webcam on and to run
//the numbers within [ ] correlate to the println list on line 37
camleft = new Capture(this, Capture.list()[3] ); //LEFT CAM IS LOGITECH HD
//WEBCAM C310
camleft.start();
camcenter = new Capture(this, Capture.list()[79] ); //CENTER CAM IS LOGITECH HD
//WEBCAM C310-1
camcenter.start();
camright = new Capture(this, Capture.list()[155] ); //RIGHT CAM IS LOGITECH HD
//WEBCAM C310-2
camright.start();
opencv.loadCascade(OpenCV.CASCADE_FRONTALFACE);
// VIDEO stuff
// load videos
myMovieleft = new Movie(this, "testvideo.mp4"); //load this video
//videos must be placed in a folder titled data within the sketch folder
// need to play, pause, loop
myMovieleft.play();
myMovieleft.pause();
myMovieleft.loop();
myMoviecenter = new Movie(this, "testvideo-1.mp4");
myMoviecenter.play();
myMoviecenter.pause();
myMoviecenter.loop();
myMovieright = new Movie(this, "testvideo-2.mp4");
myMovieright.play();
myMovieright.pause();
myMovieright.loop();
}
void captureEvent(Capture cam) {
cam.read();
}
void draw() {
background(0);
//THIS IS FOR THE LEFT
//this is to delay the start of the video so that the webcams have time to initalize
if (camleft.available()==true && start ==true) {
// open cv detect faces
opencv.loadImage(camleft);
// load in faces as rectangles
Rectangle[] facesleft = opencv.detect();
// are there faces?
if (facesleft.length > 0) {
// sees a face!
myMovieleft.play();
} else {
// no face
myMovieleft.pause();
}
// play video
if (myMovieleft.available()) {
myMovieleft.read();
//offscreen.image
//image(myMovieleft, 0, 540);
offscreenleft.beginDraw();
offscreenleft.image(myMovieleft, 0, 0, 400, 300);
offscreenleft.endDraw();
}
//THIS IS FOR THE CENTER
if (camcenter.available()==true && start ==true) {
opencv.loadImage(camcenter);
Rectangle[] facescenter = opencv.detect();
if (facescenter.length > 0) {
myMoviecenter.play();
} else {
myMoviecenter.pause();
}
if (myMoviecenter.available()) {
myMoviecenter.read();
offscreencenter.beginDraw();
offscreencenter.image(myMoviecenter, 0, 0, 400, 300);
offscreencenter.endDraw();
}
//THIS IS FOR THE RIGHT
if (camright.available()==true && start ==true) {
opencv.loadImage(camright);
Rectangle[] facesright = opencv.detect();
if (facesright.length > 0) {
myMovieright.play();
} else {
myMovieright.pause();
}
if (myMovieright.available()) {
myMovieright.read();
offscreenright.beginDraw();
offscreenright.image(myMovieright, 0, 0, 400, 300);
offscreenright.endDraw();
}
}
//KEYSTONE stuff
surfaceleft.render(offscreenleft);
surfacecenter.render(offscreencenter);
surfaceright.render(offscreenright);
}
}
}
//the save and load function for KEYSTONE stuff
void keyPressed() {
switch(key) {
case 'c':
// enter/leave calibration mode, where surfaces can be warped
// and moved
ks.toggleCalibration();
break;
case 'l':
// loads the saved layout
ks.load();
break;
case 's':
// saves the layout
ks.save();
break;
//WEBCAM/VIDEO stuff
case ' ':
//spacebar will start videos/webcam thing
//this is so Processing doesn't have to do so much work at once
start=true;
println("starting");
break;
}
}