Permalink
Browse files

- reducing optical flow grid

- normalizing flow sum with grid size
- other stuff
  • Loading branch information...
1 parent 3a5d69d commit e51a5b6963c4e6bff3c7488b4f612ebd594bad27 @CorpusCallosum CorpusCallosum committed Jan 25, 2013
View
10 processing/StyleBlasterGrabber/OpticalFlow.pde
@@ -60,7 +60,9 @@ class OpticalFlow {
float ballpx, ballpy, ballvx, ballvy, ballgy, ballsz, ballsz2, ballfv, ballhv, ballvmax;
- OpticalFlow(Capture v) {
+ OpticalFlow(Capture v, int stps) {
+ gs=stps; // grid step (pixels)
+
wscreen=width;
hscreen=height;
@@ -275,6 +277,9 @@ class OpticalFlow {
xFlowSum += sflowx[ig];
}
}
+
+ //normalize with number of grid steps
+ xFlowSum = xFlowSum*gs;
// 4th sweep : draw the flow
if (flagseg) {
@@ -312,9 +317,6 @@ class OpticalFlow {
float u=df*sflowx[ig];
float v=df*sflowy[ig];
- // xFlowSum += u;
- // yFlow += v;
-
// draw the line segments for optical flow
float a=sqrt(u*u+v*v);
if (a>=2.0) { // draw only if the length >=2.0
View
13 processing/StyleBlasterGrabber/StyleBlasterGrabber.pde
@@ -28,14 +28,9 @@ MotionSensor motionSensor;
//SETUP VARS
String version = "1.5";
int startHour = 8; //am
-int endHour = 15; //3pm
+int endHour = 12+4; //4pm
int endMinute = 25;
-<<<<<<< HEAD
boolean production = true;
-=======
-
-boolean production = false;
->>>>>>> bd59ede9b8ae62f2b4a6f3564609c63ea5eb8f1f
String nycUploadURL = "http://styleblaster.herokuapp.com/upload/nyc";
String gdlUploadURL = "http://styleblaster.herokuapp.com/upload/gdl";
@@ -89,11 +84,11 @@ cam.settings();
//initialize sensor position
motionSensor._r.width = 20;
motionSensor._r.height = 20;
- motionSensor._r.x = width/2 - motionSensor._r.width/2;
- motionSensor._r.y = height * 3/5;
+ motionSensor._r.x = (width/2 - motionSensor._r.width/2);
+ motionSensor._r.y = height/2+50;
motionSensor.update();
- of = new OpticalFlow(cam);
+ of = new OpticalFlow(cam, 50);
}
View
BIN ...pplication.macosx/StyleBlasterGrabber.app/Contents/Resources/Java/StyleBlasterGrabber.jar
Binary file not shown.
View
14 processing/StyleBlasterGrabber/application.macosx/source/OpticalFlow.pde
@@ -20,7 +20,7 @@ class OpticalFlow {
PFont font;
color[] vline;
- MovieMaker movie;
+ // MovieMaker movie;
// capture parameters
int fps=30;
@@ -60,7 +60,9 @@ class OpticalFlow {
float ballpx, ballpy, ballvx, ballvy, ballgy, ballsz, ballsz2, ballfv, ballhv, ballvmax;
- OpticalFlow(Capture v) {
+ OpticalFlow(Capture v, int stps) {
+ gs=stps; // grid step (pixels)
+
wscreen=width;
hscreen=height;
@@ -275,6 +277,9 @@ class OpticalFlow {
xFlowSum += sflowx[ig];
}
}
+
+ //normalize with number of grid steps
+ xFlowSum = xFlowSum*gs;
// 4th sweep : draw the flow
if (flagseg) {
@@ -312,9 +317,6 @@ class OpticalFlow {
float u=df*sflowx[ig];
float v=df*sflowy[ig];
- // xFlowSum += u;
- // yFlow += v;
-
// draw the line segments for optical flow
float a=sqrt(u*u+v*v);
if (a>=2.0) { // draw only if the length >=2.0
@@ -389,7 +391,7 @@ class OpticalFlow {
///////////////////////////////////////////////////
// recording movie
- if (flagmovie) movie.addFrame();
+ // if (flagmovie) movie.addFrame();
// print information (not shown in the movie)
fill(255, 0, 0);
View
24 processing/StyleBlasterGrabber/application.macosx/source/StyleBlasterGrabber.java
@@ -55,7 +55,7 @@
//SETUP VARS
String version = "1.5";
int startHour = 8; //am
-int endHour = 15; //3pm
+int endHour = 12+4; //4pm
int endMinute = 25;
boolean production = true;
@@ -111,11 +111,11 @@ public void setup() {
//initialize sensor position
motionSensor._r.width = 20;
motionSensor._r.height = 20;
- motionSensor._r.x = width/2 - motionSensor._r.width/2;
- motionSensor._r.y = height * 3/5;
+ motionSensor._r.x = (width/2 - motionSensor._r.width/2);
+ motionSensor._r.y = height/2+50;
motionSensor.update();
- of = new OpticalFlow(cam);
+ of = new OpticalFlow(cam, 50);
}
@@ -325,6 +325,8 @@ else if (key == ',') {
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
+
}
@@ -438,7 +440,7 @@ public void setY(int n) {
PFont font;
int[] vline;
- MovieMaker movie;
+ // MovieMaker movie;
// capture parameters
int fps=30;
@@ -478,7 +480,9 @@ public void setY(int n) {
float ballpx, ballpy, ballvx, ballvy, ballgy, ballsz, ballsz2, ballfv, ballhv, ballvmax;
- OpticalFlow(Capture v) {
+ OpticalFlow(Capture v, int stps) {
+ gs=stps; // grid step (pixels)
+
wscreen=width;
hscreen=height;
@@ -693,6 +697,9 @@ public void draw() {
xFlowSum += sflowx[ig];
}
}
+
+ //normalize with number of grid steps
+ xFlowSum = xFlowSum*gs;
// 4th sweep : draw the flow
if (flagseg) {
@@ -730,9 +737,6 @@ public void draw() {
float u=df*sflowx[ig];
float v=df*sflowy[ig];
- // xFlowSum += u;
- // yFlow += v;
-
// draw the line segments for optical flow
float a=sqrt(u*u+v*v);
if (a>=2.0f) { // draw only if the length >=2.0
@@ -807,7 +811,7 @@ else if (ballpy>hscreen-ballsz2) {
///////////////////////////////////////////////////
// recording movie
- if (flagmovie) movie.addFrame();
+ // if (flagmovie) movie.addFrame();
// print information (not shown in the movie)
fill(255, 0, 0);
View
10 processing/StyleBlasterGrabber/application.macosx/source/StyleBlasterGrabber.pde
@@ -28,7 +28,7 @@ MotionSensor motionSensor;
//SETUP VARS
String version = "1.5";
int startHour = 8; //am
-int endHour = 15; //3pm
+int endHour = 12+4; //4pm
int endMinute = 25;
boolean production = true;
@@ -84,11 +84,11 @@ cam.settings();
//initialize sensor position
motionSensor._r.width = 20;
motionSensor._r.height = 20;
- motionSensor._r.x = width/2 - motionSensor._r.width/2;
- motionSensor._r.y = height * 3/5;
+ motionSensor._r.x = (width/2 - motionSensor._r.width/2);
+ motionSensor._r.y = height/2+50;
motionSensor.update();
- of = new OpticalFlow(cam);
+ of = new OpticalFlow(cam, 50);
}
@@ -298,5 +298,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
+
}

0 comments on commit e51a5b6

Please sign in to comment.