Last active
March 30, 2016 20:58
-
-
Save icq4ever/0794d7f263c85ab4ece22ff5e38c544c to your computer and use it in GitHub Desktop.
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
| void ofApp::setup() { | |
| camWidth = 1280; | |
| camHeight = 800; | |
| cam.initGrabber(camWidth, camHeight); | |
| tracker.setup(); | |
| camImg.allocate(camWidth, camHeight, OF_IMAGE_COLOR); // ofImage camImg - full size | |
| copiedImg.allocate(camWidth/2, camHeight/2, OF_IMAGE_COLOR); // ofImage copiedImg - half size | |
| fbo.allocate(camWidth/2, camHeight/2); // ofFbo fbo - half size | |
| } | |
| void ofApp::update() { | |
| ofSetWindowTitle(ofToString(ofGetFrameRate())); | |
| cam.update(); | |
| if(cam.isFrameNew()) { | |
| camImg = cam.getPixels(); // dump cam -> camImg | |
| // fill FBO | |
| fbo.begin(); | |
| cam.draw(0, 0, camWidth/2, camHeight/2); // draw half size | |
| fbo.end(); | |
| fbo.readToPixels(pix); | |
| copiedImg.setFromPixels(pix); | |
| copiedImg.update(); // need to this ?? | |
| // tracker.update(toCv(cam)); // tracking with ofVideoGrabber.. work. | |
| tracker.update(toCv(camImg)); // tracking with ofImage.. work. | |
| // tracker.update(toCv(copiedImg)); // OpenCV Error: Assertion failed (ssize.area() > 0) in resize, | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment