-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFindingBitShift.pde
More file actions
71 lines (59 loc) · 1.74 KB
/
FindingBitShift.pde
File metadata and controls
71 lines (59 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import codeanticode.syphon.*;
import processing.video.*;
// Size of each cell in the grid
int cellSize = 20;
// Number of columns and rows in our system
int cols, rows;
// Variable for capture device
Capture video;
Movie mov;
SyphonServer server;
void setup() {
size(1280, 720, P3D);
// Set up columns and rows
cols = width / cellSize;
rows = height / cellSize;
colorMode(HSB, 100);
rectMode(CENTER);
smooth();
// This the default video input, see the GettingStartedCapture
// example if it creates an error
//video = new Capture(this, width, height);
mov = new Movie(this, "finding.mp4");
mov.loop();
server = new SyphonServer(this, "Processing Syphon");
// Start capturing the imatges from the camera
// mov.start();
background(0);
}
void draw() {
if (mov.available()) {
mov.read();
mov.loadPixels();
background(0, 20);
// Begin loop for columns
for (int i = 0; i < cols;i++) {
// Begin loop for rows
for (int j = 0; j < rows;j++) {
// Where are we, pixel-wise?
int x = i * cellSize;
int y = j * cellSize;
//int loc = (mov.width - x - 1) + y*mov.width; // Reversing x to mirror the image
// Each rect is colored white with a size determined by brightness
color c = mov.get(i*cellSize, j*cellSize);
float sz = (brightness(c) / 255.0) * (cellSize + 35);
// fill(255);
// noStroke();
// rect(x + cellSize/2, y + cellSize/2, sz, sz);
fill(c << 1, 20);
noStroke();
rect(x + cellSize/2, y + cellSize/2, sz*3, sz*3);
stroke(c << 2);
strokeWeight(2);
noFill();
ellipse(x + cellSize/2, y + cellSize/2, sz + 10, sz + 10);
}
}
}
server.sendScreen();
}