Permalink
Browse files

working on porting over to processing 2.0 version of app

  • Loading branch information...
1 parent 08fbaa9 commit 3c7e93fb26e7b7ca8cf6a621536c44ff3d1df00b @CorpusCallosum CorpusCallosum committed Dec 21, 2012
View
18 processing/StyleBlasterGrabber/StyleBlasterGrabber.pde
@@ -26,7 +26,7 @@ PImage grabImage;
MotionSensor motionSensor;
//SETUP VARS
-String version = "2";
+String version = "1.5";
int startHour = 7; //am
int endHour = 16; //3:59pm
int endMinute = 25;
@@ -64,10 +64,8 @@ public void setup() {
fill(255, 50, 50);
noFill();
String[] cameras = Capture.list();
- if (version == "2") {
- // cam = new Capture(this, 1280, 960, "Logitech Camera");
- cam = new Capture(this, 1280, 960);
-
+ if (version == "2.0") {
+ cam = new Capture(this, 1280, 960, "Logitech Camera");
}
else {
// cam = new Capture(this, 2592,1944);
@@ -78,13 +76,13 @@ public void setup() {
// cam = new Capture(this, 1280, 720);
}
- if (version == "2") {
- cam.start();
+ if (version == "2.0") {
+ // cam.start();
}
//set global framerate
int f = 25;
frameRate(f);
- //cam.frameRate(f);
+ cam.frameRate(f);
cameraTimer = new Timer(1000);
sensorTimer = new Timer(1000);
@@ -287,7 +285,7 @@ void keyPressed() {
}
else if (key == 'c') {
//open camera settings
- // cam.settings();
+ cam.settings();
ignoreSensor = true;
}
else if (key == '.') {
@@ -307,5 +305,7 @@ void keyPressed() {
else if (key=='f') of.flagflow=!of.flagflow; // show opticalflow on/off
else if (key=='v') production=!production; // send to production endpoint
else if (key=='d') disable=!disable; // disable/enable
+ else if (key=='=') disable=!disable; // zoom in
+
}
View
24 processing/StyleBlasterGrabber2_0/StyleBlasterGrabber2_0.pde
@@ -2,7 +2,7 @@ import processing.opengl.*;
import processing.video.*;
import org.seltar.Bytes2Web.*;
import java.awt.Rectangle;
-import gifAnimation.*;
+//import gifAnimation.*;
OpticalFlow of;
Capture cam;
@@ -16,12 +16,12 @@ boolean uploading = false;
boolean checkRight = false;
boolean grab = false;
boolean disable = false;
-boolean recordGif = false;
-boolean doGifs = false;
+//boolean recordGif = false;
+//boolean doGifs = false;
ImageToWeb img;
byte[] imgBytes;
PImage grabImage;
-GifMaker gifExport;
+//GifMaker gifExport;
MotionSensor leftSensor, rightSensor;
@@ -46,7 +46,7 @@ public void setup() {
int sketchWidth = 666;
float m = .7;
- size(round(sketchWidth*m), round(sketchHeight*m));
+ size(round(sketchWidth*m), round(sketchHeight*m), P2D);
// size(1280, 720);
String[] devices = Capture.list();
@@ -57,7 +57,11 @@ public void setup() {
String[] cameras = Capture.list();
if (version == "2.0") {
//Microsoft Studio
- cam = new Capture(this, 1920, 1080, "Microsoft® LifeCam Studio(TM)");
+ // cam = new Capture(this, 1920, 1080, "Microsoft® LifeCam Studio(TM)");
+ // cam = new Capture(this, 1920, 1080);
+
+ cam = new Capture(this, cameras[0]);
+
}
else {
@@ -112,8 +116,12 @@ void draw() {
if (! uploading) {
cam.read();
+ println("cam.width: "+cam.width);
+
grabImage = cam.get(cam.width/2-width/2, cam.height/2-height/2, width, height);
image(grabImage, 0, 0);
+
+ // image(cam, 0, 0);
of.updateImage(grabImage);
of.draw();
@@ -156,7 +164,7 @@ void draw() {
grab = false;
//update the reference image on the sensors
leftSensor._image = grabImage;
- if (doGifs) {
+ /*if (doGifs) {
if (of.xFlowSum < flowThreshold) {
if (!recordGif) {
gifExport = new GifMaker(this, getTimestamp()+".gif");
@@ -173,7 +181,7 @@ void draw() {
recordGif = false;
// gifExport = new GifMaker(this, "export.gif");
}
- }
+ }*/
hit = leftSensor.checkHitArea();
if (hit) {

0 comments on commit 3c7e93f

Please sign in to comment.