From 1f8525289c3533805fa235d25804f3413243743a Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Fri, 12 Oct 2012 11:06:16 +0100 Subject: mode vis --- figgis_detect.layout | 8 ++++---- src/main.cpp | 2 +- src/testApp.cpp | 23 ++++++++++++++++++++--- src/testApp.h | 6 ++++++ 4 files changed, 31 insertions(+), 8 deletions(-) diff --git a/figgis_detect.layout b/figgis_detect.layout index 1870fbc..4d3d26b 100644 --- a/figgis_detect.layout +++ b/figgis_detect.layout @@ -7,7 +7,7 @@ - + @@ -17,9 +17,9 @@ - + - - + + diff --git a/src/main.cpp b/src/main.cpp index e502a4d..e922099 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -6,7 +6,7 @@ int main( ){ ofAppGlutWindow window; - ofSetupOpenGL(&window, 640,480, OF_WINDOW); // <-------- setup the GL context + ofSetupOpenGL(&window, 720,576, OF_WINDOW); // <-------- setup the GL context // this kicks off the running of my app // can be OF_WINDOW or OF_FULLSCREEN diff --git a/src/testApp.cpp b/src/testApp.cpp index 28d3ef2..d093497 100755 --- a/src/testApp.cpp +++ b/src/testApp.cpp @@ -10,8 +10,8 @@ void testApp::setup(){ threshold = 80; // - gw=640; - gh=480; + gw=720; + gh=576; vidGrabber.setVerbose(true); vidGrabber.initGrabber(gw,gh); //base grab size @@ -20,6 +20,8 @@ void testApp::setup(){ grayImage.allocate(gw,gh); grayBg.allocate(gw,gh); grayDiff.allocate(gw,gh); + + mode=COLOUR; bLearnBakground = true; @@ -67,7 +69,17 @@ void testApp::update(){ //-------------------------------------------------------------- void testApp::draw(){ ofSetColor(255,255,255); - colorImg.draw(0,0,gw,gh); //(ofGetHeight()-gh)/2,gw,ofGetHeight()+((gh-ofGetHeight())/2)); + switch(mode){ + case COLOUR: + colorImg.draw(0,0,gw,gh); //(ofGetHeight()-gh)/2,gw,ofGetHeight()+((gh-ofGetHeight())/2)); + break; + case GREY: + grayImage.draw(0,0,gw,gh); //(ofGetHeight()-gh)/2,gw,ofGetHeight()+((gh-ofGetHeight())/2)); + break; + case DIFF: + grayDiff.draw(0,0,gw,gh); //(ofGetHeight()-gh)/2,gw,ofGetHeight()+((gh-ofGetHeight())/2)); + break; + } for (int i = 0; i < contourFinder.nBlobs; i++){ contourFinder.blobs[i].draw(0,0); //(ofGetHeight()-gh)/2); @@ -128,6 +140,11 @@ void testApp::keyPressed(int key){ case OF_KEY_RIGHT: boundaries[selectedBoundary].note++; break; + case '1': + case '2': + case '3': + mode=key-48; + break; } } diff --git a/src/testApp.h b/src/testApp.h index 22389a6..9bcf15e 100755 --- a/src/testApp.h +++ b/src/testApp.h @@ -8,6 +8,10 @@ #include "ofxOsc.h" +#define COLOUR 1 +#define GREY 2 +#define DIFF 3 + class testApp : public ofBaseApp{ public: @@ -48,6 +52,8 @@ class testApp : public ofBaseApp{ ofxCvGrayscaleImage grayDiff; ofxCvContourFinder contourFinder; + + int mode; int threshold; bool bLearnBakground; -- cgit v1.2.3