Skip to content

Instantly share code, notes, and snippets.

@TheVisualG
Created February 5, 2018 11:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TheVisualG/228cb6cc64104e8ffbebbd008faf2dcc to your computer and use it in GitHub Desktop.
Save TheVisualG/228cb6cc64104e8ffbebbd008faf2dcc to your computer and use it in GitHub Desktop.
import gab.opencv.*;
OpenCV opencv;
PImage img, thresh, blur, adaptive;
void setup() {
img = loadImage("profile_test.jpg");
size(1080, 1080);
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 );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment