Skip to content

Instantly share code, notes, and snippets.

@TheVisualG
Created February 5, 2018 13:30
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/f56c6348a25dc3b1eb584d10269d040c to your computer and use it in GitHub Desktop.
Save TheVisualG/f56c6348a25dc3b1eb584d10269d040c to your computer and use it in GitHub Desktop.
bg_test
import gab.opencv.*;
import processing.video.*;
Movie video;
OpenCV opencv;
void setup() {
size(1440, 1080);
video = new Movie(this, "test2.mov");
opencv = new OpenCV(this, 1440, 1080);
opencv.startBackgroundSubtraction(5, 3, 0.5);
video.loop();
video.play();
}
void draw() {
image(video, 1440, 1080);
opencv.loadImage(video);
opencv.updateBackground();
opencv.dilate();
opencv.erode();
noFill();
stroke(255, 0, 0);
strokeWeight(3);
for (Contour contour : opencv.findContours()) {
contour.draw();
}
}
void movieEvent(Movie m) {
m.read();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment