-
Notifications
You must be signed in to change notification settings - Fork 222
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update to latest 2.0 beta. 50% of tests pass.
- Loading branch information
Jonathan Feinberg
committed
Oct 22, 2012
1 parent
a938b66
commit 7d1ce74
Showing
873 changed files
with
4,253 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1 +1 @@ | |||
2.0.2 | 3.0 BETA |
Binary file not shown.
This file was deleted.
Oops, something went wrong.
Binary file modified
BIN
-3.4 KB
(50%)
libraries/processing/opengl/gluegen-rt-natives-linux-amd64.jar
Binary file not shown.
Binary file modified
BIN
-3.35 KB
(50%)
libraries/processing/opengl/gluegen-rt-natives-linux-i586.jar
Binary file not shown.
Binary file not shown.
Binary file modified
BIN
-3.23 KB
(55%)
libraries/processing/opengl/gluegen-rt-natives-macosx-universal.jar
Binary file not shown.
Binary file modified
BIN
-775 Bytes
(89%)
libraries/processing/opengl/gluegen-rt-natives-windows-amd64.jar
Binary file not shown.
Binary file modified
BIN
-1.11 KB
(80%)
libraries/processing/opengl/gluegen-rt-natives-windows-i586.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+58.1 KB
libraries/processing/serial/RXTXcomm.jar → ...es/processing/serial/library/RXTXcomm.jar
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1 @@ | |||
name = Serial I/O |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File renamed without changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,27 @@ | |||
<?xml version="1.0"?> | |||
<project name="Processing Video Library" default="build"> | |||
|
|||
<target name="clean" description="Clean the build directories"> | |||
<delete dir="bin" /> | |||
<delete file="library/video.jar" /> | |||
</target> | |||
|
|||
<target name="compile" description="Compile sources"> | |||
<condition property="core-built"> | |||
<available file="../../../core/library/core.jar" /> | |||
</condition> | |||
<fail unless="core-built" message="Please build the core library first and make sure it sits in ../../../core/library/core.jar" /> | |||
|
|||
<mkdir dir="bin" /> | |||
<javac source="1.6" | |||
target="1.6" | |||
srcdir="src" destdir="bin" | |||
encoding="UTF-8" | |||
includeAntRuntime="false" | |||
classpath="../../../core/library/core.jar; library/gstreamer-java.jar; library/jna.jar" /> | |||
</target> | |||
|
|||
<target name="build" depends="compile" description="Build video library"> | |||
<jar basedir="bin" destfile="library/video.jar" /> | |||
</target> | |||
</project> |
136 changes: 136 additions & 0 deletions
136
libraries/processing/video/examples/Capture/AsciiVideo/AsciiVideo.pde
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,136 @@ | |||
/** | |||
* ASCII Video | |||
* by Ben Fry. | |||
* | |||
* | |||
* Text characters have been used to represent images since the earliest computers. | |||
* This sketch is a simple homage that re-interprets live video as ASCII text. | |||
* See the keyPressed function for more options, like changing the font size. | |||
*/ | |||
|
|||
import processing.video.*; | |||
|
|||
Capture video; | |||
boolean cheatScreen; | |||
|
|||
// All ASCII characters, sorted according to their visual density | |||
String letterOrder = | |||
" .`-_':,;^=+/\"|)\\<>)iv%xclrs{*}I?!][1taeo7zjLu" + | |||
"nT#JCwfy325Fp6mqSghVd4EgXPGZbYkOA&8U$@KHDBWNMR0Q"; | |||
char[] letters; | |||
|
|||
float[] bright; | |||
char[] chars; | |||
|
|||
PFont font; | |||
float fontSize = 1.5; | |||
|
|||
|
|||
void setup() { | |||
size(640, 480, P2D); | |||
|
|||
// Uses the default video input, see the reference if this causes an error | |||
video = new Capture(this, 160, 120); | |||
video.start(); | |||
int count = video.width * video.height; | |||
println(count); | |||
|
|||
font = loadFont("UniversLTStd-Light-48.vlw"); | |||
|
|||
// for the 256 levels of brightness, distribute the letters across | |||
// the an array of 256 elements to use for the lookup | |||
letters = new char[256]; | |||
for (int i = 0; i < 256; i++) { | |||
int index = int(map(i, 0, 256, 0, letterOrder.length())); | |||
letters[i] = letterOrder.charAt(index); | |||
} | |||
|
|||
// current characters for each position in the video | |||
chars = new char[count]; | |||
|
|||
// current brightness for each point | |||
bright = new float[count]; | |||
for (int i = 0; i < count; i++) { | |||
// set each brightness at the midpoint to start | |||
bright[i] = 128; | |||
} | |||
} | |||
|
|||
|
|||
void captureEvent(Capture c) { | |||
c.read(); | |||
} | |||
|
|||
|
|||
void draw() { | |||
background(0); | |||
|
|||
pushMatrix(); | |||
|
|||
float hgap = width / float(video.width); | |||
float vgap = height / float(video.height); | |||
|
|||
scale(max(hgap, vgap) * fontSize); | |||
textFont(font, fontSize); | |||
|
|||
int index = 0; | |||
video.loadPixels(); | |||
for (int y = 1; y < video.height; y++) { | |||
|
|||
// Move down for next line | |||
translate(0, 1.0 / fontSize); | |||
|
|||
pushMatrix(); | |||
for (int x = 0; x < video.width; x++) { | |||
int pixelColor = video.pixels[index]; | |||
// Faster method of calculating r, g, b than red(), green(), blue() | |||
int r = (pixelColor >> 16) & 0xff; | |||
int g = (pixelColor >> 8) & 0xff; | |||
int b = pixelColor & 0xff; | |||
|
|||
// Another option would be to properly calculate brightness as luminance: | |||
// luminance = 0.3*red + 0.59*green + 0.11*blue | |||
// Or you could instead red + green + blue, and make the the values[] array | |||
// 256*3 elements long instead of just 256. | |||
int pixelBright = max(r, g, b); | |||
|
|||
// The 0.1 value is used to damp the changes so that letters flicker less | |||
float diff = pixelBright - bright[index]; | |||
bright[index] += diff * 0.1; | |||
|
|||
fill(pixelColor); | |||
int num = int(bright[index]); | |||
text(letters[num], 0, 0); | |||
|
|||
// Move to the next pixel | |||
index++; | |||
|
|||
// Move over for next character | |||
translate(1.0 / fontSize, 0); | |||
} | |||
popMatrix(); | |||
} | |||
popMatrix(); | |||
|
|||
if (cheatScreen) { | |||
//image(video, 0, height - video.height); | |||
// set() is faster than image() when drawing untransformed images | |||
set(0, height - video.height, video); | |||
} | |||
} | |||
|
|||
|
|||
/** | |||
* Handle key presses: | |||
* 'c' toggles the cheat screen that shows the original image in the corner | |||
* 'g' grabs an image and saves the frame to a tiff image | |||
* 'f' and 'F' increase and decrease the font size | |||
*/ | |||
void keyPressed() { | |||
switch (key) { | |||
case 'g': saveFrame(); break; | |||
case 'c': cheatScreen = !cheatScreen; break; | |||
case 'f': fontSize *= 1.1; break; | |||
case 'F': fontSize *= 0.9; break; | |||
} | |||
} |
Binary file added
BIN
+164 KB
libraries/processing/video/examples/Capture/AsciiVideo/data/UniversLTStd-Light-48.vlw
Binary file not shown.
69 changes: 69 additions & 0 deletions
69
libraries/processing/video/examples/Capture/BackgroundSubtraction/BackgroundSubtraction.pde
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,69 @@ | |||
/** | |||
* Background Subtraction | |||
* by Golan Levin. | |||
* | |||
* Detect the presence of people and objects in the frame using a simple | |||
* background-subtraction technique. To initialize the background, press a key. | |||
*/ | |||
|
|||
|
|||
import processing.video.*; | |||
|
|||
int numPixels; | |||
int[] backgroundPixels; | |||
Capture video; | |||
|
|||
void setup() { | |||
// Change size to 320 x 240 if too slow at 640 x 480 | |||
size(640, 480, P2D); | |||
|
|||
video = new Capture(this, width, height); | |||
video.start(); | |||
numPixels = video.width * video.height; | |||
// Create array to store the background image | |||
backgroundPixels = new int[numPixels]; | |||
// Make the pixels[] array available for direct manipulation | |||
loadPixels(); | |||
} | |||
|
|||
void draw() { | |||
if (video.available()) { | |||
video.read(); // Read a new video frame | |||
video.loadPixels(); // Make the pixels of video available | |||
// Difference between the current frame and the stored background | |||
int presenceSum = 0; | |||
for (int i = 0; i < numPixels; i++) { // For each pixel in the video frame... | |||
// Fetch the current color in that location, and also the color | |||
// of the background in that spot | |||
color currColor = video.pixels[i]; | |||
color bkgdColor = backgroundPixels[i]; | |||
// Extract the red, green, and blue components of the current pixel�s color | |||
int currR = (currColor >> 16) & 0xFF; | |||
int currG = (currColor >> 8) & 0xFF; | |||
int currB = currColor & 0xFF; | |||
// Extract the red, green, and blue components of the background pixel�s color | |||
int bkgdR = (bkgdColor >> 16) & 0xFF; | |||
int bkgdG = (bkgdColor >> 8) & 0xFF; | |||
int bkgdB = bkgdColor & 0xFF; | |||
// Compute the difference of the red, green, and blue values | |||
int diffR = abs(currR - bkgdR); | |||
int diffG = abs(currG - bkgdG); | |||
int diffB = abs(currB - bkgdB); | |||
// Add these differences to the running tally | |||
presenceSum += diffR + diffG + diffB; | |||
// Render the difference image to the screen | |||
pixels[i] = color(diffR, diffG, diffB); | |||
// The following line does the same thing much faster, but is more technical | |||
//pixels[i] = 0xFF000000 | (diffR << 16) | (diffG << 8) | diffB; | |||
} | |||
updatePixels(); // Notify that the pixels[] array has changed | |||
println(presenceSum); // Print out the total amount of movement | |||
} | |||
} | |||
|
|||
// When a key is pressed, capture the background image into the backgroundPixels | |||
// buffer, by copying each of the current frame�s pixels into it. | |||
void keyPressed() { | |||
video.loadPixels(); | |||
arraycopy(video.pixels, backgroundPixels); | |||
} |
58 changes: 58 additions & 0 deletions
58
...aries/processing/video/examples/Capture/BrightnessThresholding/BrightnessThresholding.pde
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,58 @@ | |||
/** | |||
* Brightness Thresholding | |||
* by Golan Levin. | |||
* | |||
* Determines whether a test location (such as the cursor) is contained within | |||
* the silhouette of a dark object. | |||
*/ | |||
|
|||
|
|||
import processing.video.*; | |||
|
|||
color black = color(0); | |||
color white = color(255); | |||
int numPixels; | |||
Capture video; | |||
|
|||
void setup() { | |||
size(640, 480, P2D); // Change size to 320 x 240 if too slow at 640 x 480 | |||
strokeWeight(5); | |||
// Uses the default video input, see the reference if this causes an error | |||
video = new Capture(this, width, height); | |||
video.start(); | |||
numPixels = video.width * video.height; | |||
noCursor(); | |||
smooth(); | |||
} | |||
|
|||
void draw() { | |||
if (video.available()) { | |||
video.read(); | |||
video.loadPixels(); | |||
int threshold = 127; // Set the threshold value | |||
float pixelBrightness; // Declare variable to store a pixel's color | |||
// Turn each pixel in the video frame black or white depending on its brightness | |||
loadPixels(); | |||
for (int i = 0; i < numPixels; i++) { | |||
pixelBrightness = brightness(video.pixels[i]); | |||
if (pixelBrightness > threshold) { // If the pixel is brighter than the | |||
pixels[i] = white; // threshold value, make it white | |||
} | |||
else { // Otherwise, | |||
pixels[i] = black; // make it black | |||
} | |||
} | |||
updatePixels(); | |||
// Test a location to see where it is contained. Fetch the pixel at the test | |||
// location (the cursor), and compute its brightness | |||
int testValue = get(mouseX, mouseY); | |||
float testBrightness = brightness(testValue); | |||
if (testBrightness > threshold) { // If the test location is brighter than | |||
fill(black); // the threshold set the fill to black | |||
} | |||
else { // Otherwise, | |||
fill(white); // set the fill to white | |||
} | |||
ellipse(mouseX, mouseY, 20, 20); | |||
} | |||
} |
Oops, something went wrong.