-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmode2.pde
36 lines (29 loc) · 967 Bytes
/
mode2.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
void mode2() {
pixelThisFrameMode2(motion);
}
void pixelThisFrameMode2(PImage frame) {
float currWeight;
float localThreshold = 0.7 * 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), 255, 0, 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 {
//strokeWeight(minWeight);
//stroke(200);;
//point(x + 0.5 * videoScale, y + 0.5 * videoScale);
}
}
}
}