-
Notifications
You must be signed in to change notification settings - Fork 460
Expand file tree
/
Copy pathFilterImages.pde
More file actions
39 lines (31 loc) · 860 Bytes
/
FilterImages.pde
File metadata and controls
39 lines (31 loc) · 860 Bytes
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
import gab.opencv.*;
OpenCV opencv;
PImage img, thresh, blur, adaptive;
void setup() {
img = loadImage("test.jpg");
size(1080, 720);
opencv = new OpenCV(this, img);
PImage gray = opencv.getSnapshot();
opencv.threshold(80);
thresh = opencv.getSnapshot();
opencv.loadImage(gray);
opencv.blur(12);
blur = opencv.getSnapshot();
opencv.loadImage(gray);
opencv.adaptiveThreshold(591, 1);
adaptive = opencv.getSnapshot();
}
void draw() {
pushMatrix();
scale(0.5);
image(img, 0, 0);
image(thresh, img.width, 0);
image(blur, 0, img.height);
image(adaptive, img.width, img.height);
popMatrix();
fill(0);
text("source", img.width/2 - 100, 20 );
text("threshold", img.width - 100, 20 );
text("blur", img.width/2 - 100, img.height/2 + 20 );
text("adaptive threshold", img.width - 150, img.height/2 + 20 );
}