Created
February 17, 2011 17:40
-
-
Save qingfeng/832218 to your computer and use it in GitHub Desktop.
Processing+OpenCV
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hypermedia.video.*; | |
OpenCV opencv; | |
void setup() { | |
size(480, 320); | |
opencv = new OpenCV(this); | |
opencv.capture(width/2, height/2); | |
} | |
void draw() { | |
opencv.read(); | |
//左上 | |
opencv.convert(OpenCV.GRAY); //グレースケールに変換 | |
image(opencv.image(), 0, 0); //画面に表示 左上 | |
//右上 | |
opencv.invert(); //色を反転 | |
image(opencv.image(), width/2, 0); // 画面に表示 右上 | |
//左下 | |
opencv.restore(); //オリジナルの映像に戻す | |
opencv.flip(OpenCV.FLIP_HORIZONTAL); //映像を水平方向に反転する | |
image(opencv.image(), 0, height/2); // 画面に表示 左下 | |
//右下 | |
image(opencv.image(OpenCV.SOURCE), width/2, height/2); // 画面に表示 オリジナルの映像 右下 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment