Permalink
Browse files

merged from master

  • Loading branch information...
2 parents 9976620 + 5ef6a73 commit 03aafc924ae51d7f383076ca7fdfca9b4caf5050 @CorpusCallosum CorpusCallosum committed Dec 15, 2012
Showing with 12,988 additions and 136 deletions.
  1. +0 −1 README
  2. +49 −30 processing/StyleBlasterGrabber/StyleBlasterGrabber.pde
  3. +89 −0 processing/StyleBlasterGrabber/applet/MotionSensor.pde
  4. +423 −0 processing/StyleBlasterGrabber/applet/OpticalFlow.pde
  5. BIN processing/StyleBlasterGrabber/applet/StyleBlasterGrabber.jar
  6. +847 −0 processing/StyleBlasterGrabber/applet/StyleBlasterGrabber.java
  7. +274 −0 processing/StyleBlasterGrabber/applet/StyleBlasterGrabber.pde
  8. BIN processing/StyleBlasterGrabber/applet/core.jar
  9. BIN processing/StyleBlasterGrabber/applet/gifAnimation.jar
  10. +208 −0 processing/StyleBlasterGrabber/applet/index.html
  11. BIN processing/StyleBlasterGrabber/applet/loading.gif
  12. BIN processing/StyleBlasterGrabber/applet/opengl.jar
  13. BIN processing/StyleBlasterGrabber/applet/postToWeb.jar
  14. +29 −0 processing/StyleBlasterGrabber/applet/timer.pde
  15. BIN processing/StyleBlasterGrabber/applet/video.jar
  16. BIN processing/StyleBlasterGrabber/application.linux32/lib/StyleBlasterGrabber.jar
  17. +20 −17 processing/StyleBlasterGrabber/application.linux32/source/StyleBlasterGrabber.pde
  18. +1 −0 processing/StyleBlasterGrabber/application.linux32/source/timer.pde
  19. BIN processing/StyleBlasterGrabber/application.linux64/lib/StyleBlasterGrabber.jar
  20. +20 −17 processing/StyleBlasterGrabber/application.linux64/source/StyleBlasterGrabber.pde
  21. +1 −0 processing/StyleBlasterGrabber/application.linux64/source/timer.pde
  22. +1 −1 processing/StyleBlasterGrabber/application.macosx/StyleBlasterGrabber.app/Contents/Info.plist
  23. BIN ...rabber/application.macosx/StyleBlasterGrabber.app/Contents/Resources/Java/StyleBlasterGrabber.jar
  24. +20 −17 processing/StyleBlasterGrabber/application.macosx/source/StyleBlasterGrabber.pde
  25. +1 −0 processing/StyleBlasterGrabber/application.macosx/source/timer.pde
  26. BIN processing/StyleBlasterGrabber/application.windows32/lib/StyleBlasterGrabber.jar
  27. +1 −1 processing/StyleBlasterGrabber/application.windows32/lib/args.txt
  28. +21 −17 processing/StyleBlasterGrabber/application.windows32/source/StyleBlasterGrabber.java
  29. +20 −17 processing/StyleBlasterGrabber/application.windows32/source/StyleBlasterGrabber.pde
  30. +1 −0 processing/StyleBlasterGrabber/application.windows32/source/timer.pde
  31. BIN processing/StyleBlasterGrabber/application.windows64/lib/StyleBlasterGrabber.jar
  32. +1 −1 processing/StyleBlasterGrabber/application.windows64/lib/args.txt
  33. +20 −17 processing/StyleBlasterGrabber/application.windows64/source/StyleBlasterGrabber.pde
  34. +1 −0 processing/StyleBlasterGrabber/application.windows64/source/timer.pde
  35. +1 −0 processing/StyleBlasterGrabber/timer.pde
  36. +89 −0 processing/StyleBlasterGrabber2_0/MotionSensor.pde
  37. +417 −0 processing/StyleBlasterGrabber2_0/OpticalFlow.pde
  38. +279 −0 processing/StyleBlasterGrabber2_0/StyleBlasterGrabber2_0.pde
  39. +4 −0 processing/StyleBlasterGrabber2_0/application.linux32/StyleBlasterGrabber
  40. BIN processing/StyleBlasterGrabber2_0/application.linux32/lib/StyleBlasterGrabber.jar
  41. BIN processing/StyleBlasterGrabber2_0/application.linux32/lib/core.jar
  42. BIN processing/StyleBlasterGrabber2_0/application.linux32/lib/gifAnimation.jar
  43. BIN processing/StyleBlasterGrabber2_0/application.linux32/lib/gluegen-rt.jar
  44. BIN processing/StyleBlasterGrabber2_0/application.linux32/lib/jogl.jar
  45. BIN processing/StyleBlasterGrabber2_0/application.linux32/lib/opengl.jar
  46. BIN processing/StyleBlasterGrabber2_0/application.linux32/lib/postToWeb.jar
  47. BIN processing/StyleBlasterGrabber2_0/application.linux32/lib/video.jar
  48. BIN processing/StyleBlasterGrabber2_0/application.linux32/libgluegen-rt.so
  49. BIN processing/StyleBlasterGrabber2_0/application.linux32/libjogl.so
  50. BIN processing/StyleBlasterGrabber2_0/application.linux32/libjogl_awt.so
  51. BIN processing/StyleBlasterGrabber2_0/application.linux32/libjogl_cg.so
  52. +89 −0 processing/StyleBlasterGrabber2_0/application.linux32/source/MotionSensor.pde
  53. +423 −0 processing/StyleBlasterGrabber2_0/application.linux32/source/OpticalFlow.pde
  54. +283 −0 processing/StyleBlasterGrabber2_0/application.linux32/source/StyleBlasterGrabber.pde
  55. +28 −0 processing/StyleBlasterGrabber2_0/application.linux32/source/timer.pde
  56. +4 −0 processing/StyleBlasterGrabber2_0/application.linux64/StyleBlasterGrabber
  57. BIN processing/StyleBlasterGrabber2_0/application.linux64/lib/StyleBlasterGrabber.jar
  58. BIN processing/StyleBlasterGrabber2_0/application.linux64/lib/core.jar
  59. BIN processing/StyleBlasterGrabber2_0/application.linux64/lib/gifAnimation.jar
  60. BIN processing/StyleBlasterGrabber2_0/application.linux64/lib/gluegen-rt.jar
  61. BIN processing/StyleBlasterGrabber2_0/application.linux64/lib/jogl.jar
  62. BIN processing/StyleBlasterGrabber2_0/application.linux64/lib/opengl.jar
  63. BIN processing/StyleBlasterGrabber2_0/application.linux64/lib/postToWeb.jar
  64. BIN processing/StyleBlasterGrabber2_0/application.linux64/lib/video.jar
  65. BIN processing/StyleBlasterGrabber2_0/application.linux64/libgluegen-rt.so
  66. BIN processing/StyleBlasterGrabber2_0/application.linux64/libjogl.so
  67. BIN processing/StyleBlasterGrabber2_0/application.linux64/libjogl_awt.so
  68. BIN processing/StyleBlasterGrabber2_0/application.linux64/libjogl_cg.so
  69. +89 −0 processing/StyleBlasterGrabber2_0/application.linux64/source/MotionSensor.pde
  70. +423 −0 processing/StyleBlasterGrabber2_0/application.linux64/source/OpticalFlow.pde
  71. +283 −0 processing/StyleBlasterGrabber2_0/application.linux64/source/StyleBlasterGrabber.pde
  72. +28 −0 processing/StyleBlasterGrabber2_0/application.linux64/source/timer.pde
  73. BIN processing/StyleBlasterGrabber2_0/application.windows32/StyleBlasterGrabber.exe
  74. BIN processing/StyleBlasterGrabber2_0/application.windows32/gluegen-rt.dll
  75. BIN processing/StyleBlasterGrabber2_0/application.windows32/jogl.dll
  76. BIN processing/StyleBlasterGrabber2_0/application.windows32/jogl_awt.dll
  77. BIN processing/StyleBlasterGrabber2_0/application.windows32/jogl_cg.dll
  78. BIN processing/StyleBlasterGrabber2_0/application.windows32/lib/StyleBlasterGrabber.jar
  79. +3 −0 processing/StyleBlasterGrabber2_0/application.windows32/lib/args.txt
  80. BIN processing/StyleBlasterGrabber2_0/application.windows32/lib/core.jar
  81. BIN processing/StyleBlasterGrabber2_0/application.windows32/lib/gifAnimation.jar
  82. BIN processing/StyleBlasterGrabber2_0/application.windows32/lib/gluegen-rt.jar
  83. BIN processing/StyleBlasterGrabber2_0/application.windows32/lib/jogl.jar
  84. BIN processing/StyleBlasterGrabber2_0/application.windows32/lib/opengl.jar
  85. BIN processing/StyleBlasterGrabber2_0/application.windows32/lib/postToWeb.jar
  86. BIN processing/StyleBlasterGrabber2_0/application.windows32/lib/video.jar
  87. +89 −0 processing/StyleBlasterGrabber2_0/application.windows32/source/MotionSensor.pde
  88. +423 −0 processing/StyleBlasterGrabber2_0/application.windows32/source/OpticalFlow.pde
  89. +855 −0 processing/StyleBlasterGrabber2_0/application.windows32/source/StyleBlasterGrabber.java
  90. +283 −0 processing/StyleBlasterGrabber2_0/application.windows32/source/StyleBlasterGrabber.pde
  91. +28 −0 processing/StyleBlasterGrabber2_0/application.windows32/source/timer.pde
  92. BIN processing/StyleBlasterGrabber2_0/application.windows64/StyleBlasterGrabber.exe
  93. BIN processing/StyleBlasterGrabber2_0/application.windows64/gluegen-rt.dll
  94. BIN processing/StyleBlasterGrabber2_0/application.windows64/jogl.dll
  95. BIN processing/StyleBlasterGrabber2_0/application.windows64/jogl_awt.dll
  96. BIN processing/StyleBlasterGrabber2_0/application.windows64/jogl_cg.dll
  97. BIN processing/StyleBlasterGrabber2_0/application.windows64/lib/StyleBlasterGrabber.jar
  98. +3 −0 processing/StyleBlasterGrabber2_0/application.windows64/lib/args.txt
  99. BIN processing/StyleBlasterGrabber2_0/application.windows64/lib/core.jar
  100. BIN processing/StyleBlasterGrabber2_0/application.windows64/lib/gifAnimation.jar
  101. BIN processing/StyleBlasterGrabber2_0/application.windows64/lib/gluegen-rt.jar
  102. BIN processing/StyleBlasterGrabber2_0/application.windows64/lib/jogl.jar
  103. BIN processing/StyleBlasterGrabber2_0/application.windows64/lib/opengl.jar
  104. BIN processing/StyleBlasterGrabber2_0/application.windows64/lib/postToWeb.jar
  105. BIN processing/StyleBlasterGrabber2_0/application.windows64/lib/video.jar
  106. +89 −0 processing/StyleBlasterGrabber2_0/application.windows64/source/MotionSensor.pde
  107. +423 −0 processing/StyleBlasterGrabber2_0/application.windows64/source/OpticalFlow.pde
  108. +283 −0 processing/StyleBlasterGrabber2_0/application.windows64/source/StyleBlasterGrabber.pde
  109. +28 −0 processing/StyleBlasterGrabber2_0/application.windows64/source/timer.pde
  110. +6 −0 processing/StyleBlasterGrabber2_0/readme.textile
  111. +28 −0 processing/StyleBlasterGrabber2_0/timer.pde
  112. +89 −0 processing/StyleBlasterGrabber_Mexico/MotionSensor.pde
  113. +423 −0 processing/StyleBlasterGrabber_Mexico/OpticalFlow.pde
  114. +292 −0 processing/StyleBlasterGrabber_Mexico/StyleBlasterGrabber_Mexico.pde
  115. +4 −0 processing/StyleBlasterGrabber_Mexico/application.linux32/StyleBlasterGrabber_Mexico
  116. BIN processing/StyleBlasterGrabber_Mexico/application.linux32/lib/StyleBlasterGrabber_Mexico.jar
  117. BIN processing/StyleBlasterGrabber_Mexico/application.linux32/lib/core.jar
  118. BIN processing/StyleBlasterGrabber_Mexico/application.linux32/lib/gifAnimation.jar
  119. BIN processing/StyleBlasterGrabber_Mexico/application.linux32/lib/gluegen-rt.jar
  120. BIN processing/StyleBlasterGrabber_Mexico/application.linux32/lib/jogl.jar
  121. BIN processing/StyleBlasterGrabber_Mexico/application.linux32/lib/opengl.jar
  122. BIN processing/StyleBlasterGrabber_Mexico/application.linux32/lib/postToWeb.jar
  123. BIN processing/StyleBlasterGrabber_Mexico/application.linux32/lib/video.jar
  124. BIN processing/StyleBlasterGrabber_Mexico/application.linux32/libgluegen-rt.so
  125. BIN processing/StyleBlasterGrabber_Mexico/application.linux32/libjogl.so
  126. BIN processing/StyleBlasterGrabber_Mexico/application.linux32/libjogl_awt.so
  127. BIN processing/StyleBlasterGrabber_Mexico/application.linux32/libjogl_cg.so
  128. +89 −0 processing/StyleBlasterGrabber_Mexico/application.linux32/source/MotionSensor.pde
  129. +423 −0 processing/StyleBlasterGrabber_Mexico/application.linux32/source/OpticalFlow.pde
  130. +292 −0 processing/StyleBlasterGrabber_Mexico/application.linux32/source/StyleBlasterGrabber_Mexico.pde
  131. +29 −0 processing/StyleBlasterGrabber_Mexico/application.linux32/source/timer.pde
  132. +4 −0 processing/StyleBlasterGrabber_Mexico/application.linux64/StyleBlasterGrabber_Mexico
  133. BIN processing/StyleBlasterGrabber_Mexico/application.linux64/lib/StyleBlasterGrabber_Mexico.jar
  134. BIN processing/StyleBlasterGrabber_Mexico/application.linux64/lib/core.jar
  135. BIN processing/StyleBlasterGrabber_Mexico/application.linux64/lib/gifAnimation.jar
  136. BIN processing/StyleBlasterGrabber_Mexico/application.linux64/lib/gluegen-rt.jar
  137. BIN processing/StyleBlasterGrabber_Mexico/application.linux64/lib/jogl.jar
  138. BIN processing/StyleBlasterGrabber_Mexico/application.linux64/lib/opengl.jar
  139. BIN processing/StyleBlasterGrabber_Mexico/application.linux64/lib/postToWeb.jar
  140. BIN processing/StyleBlasterGrabber_Mexico/application.linux64/lib/video.jar
  141. BIN processing/StyleBlasterGrabber_Mexico/application.linux64/libgluegen-rt.so
  142. BIN processing/StyleBlasterGrabber_Mexico/application.linux64/libjogl.so
  143. BIN processing/StyleBlasterGrabber_Mexico/application.linux64/libjogl_awt.so
  144. BIN processing/StyleBlasterGrabber_Mexico/application.linux64/libjogl_cg.so
  145. +89 −0 processing/StyleBlasterGrabber_Mexico/application.linux64/source/MotionSensor.pde
  146. +423 −0 processing/StyleBlasterGrabber_Mexico/application.linux64/source/OpticalFlow.pde
  147. +292 −0 processing/StyleBlasterGrabber_Mexico/application.linux64/source/StyleBlasterGrabber_Mexico.pde
  148. +29 −0 processing/StyleBlasterGrabber_Mexico/application.linux64/source/timer.pde
  149. +75 −0 .../StyleBlasterGrabber_Mexico/application.macosx/StyleBlasterGrabber_Mexico.app/Contents/Info.plist
  150. BIN ...abber_Mexico/application.macosx/StyleBlasterGrabber_Mexico.app/Contents/MacOS/JavaApplicationStub
  151. BIN ...ber_Mexico/application.macosx/StyleBlasterGrabber_Mexico.app/Contents/MacOS/JavaApplicationStub64
  152. +1 −0 ...ing/StyleBlasterGrabber_Mexico/application.macosx/StyleBlasterGrabber_Mexico.app/Contents/PkgInfo
  153. BIN ...tion.macosx/StyleBlasterGrabber_Mexico.app/Contents/Resources/Java/StyleBlasterGrabber_Mexico.jar
  154. BIN ...Grabber_Mexico/application.macosx/StyleBlasterGrabber_Mexico.app/Contents/Resources/Java/core.jar
  155. BIN ...Mexico/application.macosx/StyleBlasterGrabber_Mexico.app/Contents/Resources/Java/gifAnimation.jar
  156. BIN ...r_Mexico/application.macosx/StyleBlasterGrabber_Mexico.app/Contents/Resources/Java/gluegen-rt.jar
  157. BIN ...Grabber_Mexico/application.macosx/StyleBlasterGrabber_Mexico.app/Contents/Resources/Java/jogl.jar
  158. BIN ...co/application.macosx/StyleBlasterGrabber_Mexico.app/Contents/Resources/Java/libgluegen-rt.jnilib
  159. BIN ...r_Mexico/application.macosx/StyleBlasterGrabber_Mexico.app/Contents/Resources/Java/libjogl.jnilib
  160. BIN ...xico/application.macosx/StyleBlasterGrabber_Mexico.app/Contents/Resources/Java/libjogl_awt.jnilib
  161. BIN ...exico/application.macosx/StyleBlasterGrabber_Mexico.app/Contents/Resources/Java/libjogl_cg.jnilib
  162. BIN ...abber_Mexico/application.macosx/StyleBlasterGrabber_Mexico.app/Contents/Resources/Java/opengl.jar
  163. BIN ...er_Mexico/application.macosx/StyleBlasterGrabber_Mexico.app/Contents/Resources/Java/postToWeb.jar
  164. BIN ...rabber_Mexico/application.macosx/StyleBlasterGrabber_Mexico.app/Contents/Resources/Java/video.jar
  165. BIN ...erGrabber_Mexico/application.macosx/StyleBlasterGrabber_Mexico.app/Contents/Resources/sketch.icns
  166. +89 −0 processing/StyleBlasterGrabber_Mexico/application.macosx/source/MotionSensor.pde
  167. +423 −0 processing/StyleBlasterGrabber_Mexico/application.macosx/source/OpticalFlow.pde
  168. +292 −0 processing/StyleBlasterGrabber_Mexico/application.macosx/source/StyleBlasterGrabber_Mexico.pde
  169. +29 −0 processing/StyleBlasterGrabber_Mexico/application.macosx/source/timer.pde
  170. BIN processing/StyleBlasterGrabber_Mexico/application.windows32/StyleBlasterGrabber_Mexico.exe
  171. BIN processing/StyleBlasterGrabber_Mexico/application.windows32/gluegen-rt.dll
  172. BIN processing/StyleBlasterGrabber_Mexico/application.windows32/jogl.dll
  173. BIN processing/StyleBlasterGrabber_Mexico/application.windows32/jogl_awt.dll
  174. BIN processing/StyleBlasterGrabber_Mexico/application.windows32/jogl_cg.dll
  175. BIN processing/StyleBlasterGrabber_Mexico/application.windows32/lib/StyleBlasterGrabber_Mexico.jar
  176. +3 −0 processing/StyleBlasterGrabber_Mexico/application.windows32/lib/args.txt
  177. BIN processing/StyleBlasterGrabber_Mexico/application.windows32/lib/core.jar
  178. BIN processing/StyleBlasterGrabber_Mexico/application.windows32/lib/gifAnimation.jar
  179. BIN processing/StyleBlasterGrabber_Mexico/application.windows32/lib/gluegen-rt.jar
  180. BIN processing/StyleBlasterGrabber_Mexico/application.windows32/lib/jogl.jar
  181. BIN processing/StyleBlasterGrabber_Mexico/application.windows32/lib/opengl.jar
  182. BIN processing/StyleBlasterGrabber_Mexico/application.windows32/lib/postToWeb.jar
  183. BIN processing/StyleBlasterGrabber_Mexico/application.windows32/lib/video.jar
  184. +89 −0 processing/StyleBlasterGrabber_Mexico/application.windows32/source/MotionSensor.pde
  185. +423 −0 processing/StyleBlasterGrabber_Mexico/application.windows32/source/OpticalFlow.pde
  186. +865 −0 processing/StyleBlasterGrabber_Mexico/application.windows32/source/StyleBlasterGrabber_Mexico.java
  187. +292 −0 processing/StyleBlasterGrabber_Mexico/application.windows32/source/StyleBlasterGrabber_Mexico.pde
  188. +29 −0 processing/StyleBlasterGrabber_Mexico/application.windows32/source/timer.pde
  189. BIN processing/StyleBlasterGrabber_Mexico/application.windows64/StyleBlasterGrabber_Mexico.exe
  190. BIN processing/StyleBlasterGrabber_Mexico/application.windows64/gluegen-rt.dll
  191. BIN processing/StyleBlasterGrabber_Mexico/application.windows64/jogl.dll
  192. BIN processing/StyleBlasterGrabber_Mexico/application.windows64/jogl_awt.dll
  193. BIN processing/StyleBlasterGrabber_Mexico/application.windows64/jogl_cg.dll
  194. BIN processing/StyleBlasterGrabber_Mexico/application.windows64/lib/StyleBlasterGrabber_Mexico.jar
  195. +3 −0 processing/StyleBlasterGrabber_Mexico/application.windows64/lib/args.txt
  196. BIN processing/StyleBlasterGrabber_Mexico/application.windows64/lib/core.jar
  197. BIN processing/StyleBlasterGrabber_Mexico/application.windows64/lib/gifAnimation.jar
  198. BIN processing/StyleBlasterGrabber_Mexico/application.windows64/lib/gluegen-rt.jar
  199. BIN processing/StyleBlasterGrabber_Mexico/application.windows64/lib/jogl.jar
  200. BIN processing/StyleBlasterGrabber_Mexico/application.windows64/lib/opengl.jar
  201. BIN processing/StyleBlasterGrabber_Mexico/application.windows64/lib/postToWeb.jar
  202. BIN processing/StyleBlasterGrabber_Mexico/application.windows64/lib/video.jar
  203. +89 −0 processing/StyleBlasterGrabber_Mexico/application.windows64/source/MotionSensor.pde
  204. +423 −0 processing/StyleBlasterGrabber_Mexico/application.windows64/source/OpticalFlow.pde
  205. +292 −0 processing/StyleBlasterGrabber_Mexico/application.windows64/source/StyleBlasterGrabber_Mexico.pde
  206. +29 −0 processing/StyleBlasterGrabber_Mexico/application.windows64/source/timer.pde
  207. +6 −0 processing/StyleBlasterGrabber_Mexico/readme.textile
  208. +29 −0 processing/StyleBlasterGrabber_Mexico/timer.pde
View
1 README
@@ -1,4 +1,3 @@
-HOW TO BLAST
So, you want to join the Styleblaster Network?
Camera setup instructions:
@@ -10,7 +10,7 @@ Capture sensor;
Timer cameraTimer, sensorTimer;
int numPixels;
boolean blast; //turns photo-taking on or off
-boolean ignoreSensor = true;
+boolean ignoreSensor = false;
boolean debug = false;
boolean uploading = false;
boolean checkRight = false;
@@ -23,13 +23,14 @@ byte[] imgBytes;
PImage grabImage;
//GifMaker gifExport;
-MotionSensor leftSensor, rightSensor;
+MotionSensor motionSensor;
//SETUP VARS
String version = "1.5";
int startHour = 7; //am
int endHour = 16; //3:59pm
int endMinute = 25;
+<<<<<<< HEAD
int sensorBuffer = -220;
int sensorBufferY = 50;
@@ -43,10 +44,14 @@ String devUploadURL = "http://styleblaster.herokuapp.com/upload/dev";
String uploadURL = nycUploadURL;
String tag = "nyc";
+=======
+String uploadURL = "http://styleblaster.herokuapp.com/upload";
+>>>>>>> master
int camWidth;
int camHeight = 720;
int sensorThreshold = 13;
-int flowThreshold = -220;
+int flowDirection = -1; //-1 = right to left, 1 = left to right
+int flowThreshold = 220;
float sensorRes = 1;
public void setup() {
@@ -89,8 +94,13 @@ public void setup() {
sensorTimer = new Timer(1000);
//initialize the hit areas
- leftSensor = new MotionSensor();
- rightSensor = new MotionSensor();
+ motionSensor = new MotionSensor();
+ //initialize sensor position
+ motionSensor._r.width = 20;
+ motionSensor._r.height = 20;
+ motionSensor._r.x = width/2 - motionSensor._r.width/2;
+ motionSensor._r.y = height * 2/3;
+ motionSensor.update();
of = new OpticalFlow(cam);
@@ -113,14 +123,14 @@ void draw() {
if (mousePressed) {
rectMode(CORNER);
- leftSensor._bDiff = 0;
+ motionSensor._bDiff = 0;
ignoreSensor = true;
- int sensorWidth = round((mouseX - leftSensor._r.x));
- int sensorHeight = mouseY - leftSensor._r.y;
- leftSensor._r.width = sensorWidth;
- leftSensor._r.height = sensorHeight;
+ int sensorWidth = round((mouseX - motionSensor._r.x));
+ int sensorHeight = mouseY - motionSensor._r.y;
+ motionSensor._r.width = sensorWidth;
+ motionSensor._r.height = sensorHeight;
- leftSensor.update();
+ motionSensor.update();
blast = false;
}
@@ -138,7 +148,7 @@ void draw() {
}
else {
if (grab) {
- println("!!!HIT!!! @ : "+rightSensor._bDiff);
+ println("!!!HIT!!! @ : ");
fill(255, 0, 0);
onHit();
}
@@ -156,8 +166,7 @@ void draw() {
//date
text(getTimestamp(), 5, 15);
- leftSensor.draw();
- rightSensor.draw();
+ motionSensor.draw();
fill(255);
text("threshold: "+sensorThreshold, 5, height-5);
@@ -170,8 +179,11 @@ void draw() {
boolean hit = false;
grab = false;
//update the reference image on the sensors
- leftSensor._image = grabImage;
+ motionSensor._image = grabImage;
+
+ //GIF EXPORT*********START
if (doGifs){
+
if (of.xFlowSum < flowThreshold) {
if (!recordGif) {
// gifExport = new GifMaker(this, getTimestamp()+".gif");
@@ -188,29 +200,34 @@ void draw() {
recordGif = false;
// gifExport = new GifMaker(this, "export.gif");
}}
+//GIF EXPORT**********END
- hit = leftSensor.checkHitArea();
+ hit = motionSensor.checkHitArea();
if (hit) {
- leftSensor.reset();
-
- if (of.xFlowSum < flowThreshold) {
+ motionSensor.reset();
+ boolean dir = false;
+ if(flowDirection == -1){
+ //right to left
+ dir = of.xFlowSum < flowThreshold*flowDirection;
+ }
+ else{
+ //left to right
+ dir = of.xFlowSum > flowThreshold;
+ }
+
+ if (dir) {
grab = true;
}
}
}
}
void mousePressed() {
- leftSensor._r.x = mouseX;
- leftSensor._r.y = mouseY;
- // rightSensor._r.x = mouseX+rightSensor._r.width;
- // rightSensor._r.y = mouseY;
- // rightSensor._r.y = mouseY+sensorBufferY;
+ motionSensor._r.x = mouseX;
+ motionSensor._r.y = mouseY;
ignoreSensor = true;
}
-
-
void onHit() {
//IS THE CAMERA TIMER NEEDED HERE?
if (cameraTimer.isFinished()) {
@@ -280,21 +297,23 @@ void keyPressed() {
else if (key == '.') {
//increase the threshold
sensorThreshold += 1;
- leftSensor._thresh = sensorThreshold;
- rightSensor._thresh = sensorThreshold;
+ motionSensor._thresh = sensorThreshold;
}
else if (key == ',') {
//increase the threshold
sensorThreshold -= 1;
- leftSensor._thresh = sensorThreshold;
- rightSensor._thresh = sensorThreshold;
+ motionSensor._thresh = sensorThreshold;
}
else if (key=='w') of.flagseg=!of.flagseg; // segmentation on/off
else if (key=='s') of.flagsound=!of.flagsound; // sound on/off
else if (key=='m') of.flagmirror=!of.flagmirror; // mirror on/off
else if (key=='f') of.flagflow=!of.flagflow; // show opticalflow on/off
+<<<<<<< HEAD
else if (key=='d') disable=!disable; // show opticalflow on/off
else if (key=='v') production=!production; // send to production endpoint
+=======
+ else if (key=='d') disable=!disable; // disable/enable
+>>>>>>> master
}
@@ -0,0 +1,89 @@
+import java.awt.Rectangle;
+import processing.video.*;
+
+
+class MotionSensor {
+ Rectangle _r = new Rectangle(0, 0, 0, 0);
+ int _thresh = 13;
+ float _sensorRes = 1;
+ float _lastTestAreaBrightness, _bDiff;
+ int _numPixels;
+ PImage _image;
+ // Capture _cam;
+
+ MotionSensor() {
+
+ }
+
+ boolean checkHitArea() {
+ // _cam = cam;
+ float testAreaBrightness = getTestAreaBrightness();
+ //find teh absolute diff of the current brightness and the last brightness
+ //println("testAreaBrightness: "+testAreaBrightness);
+ // println("_lastTestAreaBrightness: "+_lastTestAreaBrightness);
+ _bDiff = abs(testAreaBrightness - _lastTestAreaBrightness);
+
+ _lastTestAreaBrightness = testAreaBrightness;
+
+ if (_bDiff > _thresh) {
+ return true;
+ }
+ return false;
+ }
+
+ //returns the average brightness of the test area defined by the test area rectangle
+ float getTestAreaBrightness() {
+ _image.loadPixels();
+ float testAreaBrightness = 0;
+
+ // For each pixel in the test area
+ for (int x = _r.x; x < _r.x+_r.width; x+=_sensorRes) {
+ for (int y = _r.y; y < _r.y+_r.height; y+=_sensorRes) {
+ // println("_cam.get(x, y): "+ _cam.get(x, y));
+ testAreaBrightness += brightness(_image.get(x, y));
+ // println("brightness(_cam.get(x, y): "+ brightness(_cam.get(x, y)));
+ }
+ }
+
+ testAreaBrightness /= _numPixels;
+ testAreaBrightness *= _sensorRes;
+
+ return testAreaBrightness;
+ }
+
+ void draw() {
+ // println("MotionSensor.draw");
+ rect(_r.x, _r.y, _r.width, _r.height);
+ text(_bDiff, _r.x, _r.y - 5);
+ }
+
+ void update() {
+ _numPixels = _r.width*_r.height;
+ }
+
+ void reset(){
+ float testAreaBrightness = getTestAreaBrightness();
+ _bDiff = abs(testAreaBrightness - _lastTestAreaBrightness);
+ _lastTestAreaBrightness = testAreaBrightness;
+ }
+
+ //GETTERS AND SETTERS
+ void setWidth(int n) {
+ _r.width = n;
+ }
+
+
+
+ void setHeight(int n) {
+ _r.height = n;
+ }
+
+ void setX(int n) {
+ _r.x = n;
+ }
+
+ void setY(int n) {
+ _r.y = n;
+ }
+}
+
Oops, something went wrong.

0 comments on commit 03aafc9

Please sign in to comment.