Skip to content

Instantly share code, notes, and snippets.

@kasperkamperman
Created June 21, 2016 10:43
Show Gist options
  • Save kasperkamperman/e43691f41f217b31207348d91d3aa3fb to your computer and use it in GitHub Desktop.
Save kasperkamperman/e43691f41f217b31207348d91d3aa3fb to your computer and use it in GitHub Desktop.
Happy OpenCV Glitch accident
/*
Happy Glitch accident:
http://giphy.com/gifs/fTGmbedzRZfLq
Uses the OpenCV for Processing library:
https://github.com/atduskgreg/opencv-processing
*/
import processing.video.*;
import gab.opencv.*;
import org.opencv.core.Mat;
OpenCV opencv;
Capture video;
void setup() {
size(640, 480,P2D);
video = new Capture(this, 320, 240);
video.start();
opencv = new OpenCV( this, video.width, video.height);
}
void draw() {
if (video.available()) {
video.read();
opencv.loadImage(video);
Mat workMat = OpenCV.imitate(opencv.getGray());
image(opencv.getSnapshot(workMat),0,0, 640,480);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment