-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmode1.pde
37 lines (31 loc) · 1.07 KB
/
mode1.pde
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
void mode1 () {
pixelThisFrameMode1(video);
}
void pixelThisFrameMode1(PImage frame) {
float currWeight;
float localThreshold = 0.6 * videoScale;
for (int i = 0; i < cols; i++) {
for (int j = 0; j < rows; j++) {
int x = i * videoScale;
int y = j * videoScale;
// Reverse the column to mirro the image.
int loc = (frame.width - 1 - x) + y * frame.width;
color c = frame.pixels[loc];
// map weight to a smaller range // reverse mapping
currWeight = map(brightness(c), 0, 255, maxWeight, minWeight);
// no.1 paint with points / ellipse
// use threshold to convert binary lights
if (currWeight > localThreshold) {
stroke(255);
strokeWeight(currWeight);
point(x + 0.5 * videoScale, y + 0.5 * videoScale);
} else {
//ellipseMode(RADIUS);
//fill(255, 0, 0, 100);
//ellipse(x + 0.5 * videoScale, y + 0.5 * videoScale, currWeight, currWeight);
//strokeWeight(minWeight);
//point(x + 0.5 * videoScale, y + 0.5 * videoScale);
}
}
}
}