From f7667bd306b983f8f8daa0b40719aa665bf555b0 Mon Sep 17 00:00:00 2001 From: Comment Date: Mon, 28 Jan 2013 12:42:36 +0000 Subject: drag filenames into areas --- src/testApp.cpp | 125 ++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 80 insertions(+), 45 deletions(-) (limited to 'src/testApp.cpp') diff --git a/src/testApp.cpp b/src/testApp.cpp index d093497..1ca45e4 100755 --- a/src/testApp.cpp +++ b/src/testApp.cpp @@ -1,69 +1,85 @@ #include "testApp.h" - //-------------------------------------------------------------- void testApp::setup(){ loadSettings("settings.xml"); //sender.setup(host.c_str(),port); - sender.setup("192.168.15.6",57117); - + sender.setup("169.254.113.20",57117); + bInvert=true; threshold = 80; // - + gw=720; gh=576; - + vidGrabber.setVerbose(true); - vidGrabber.initGrabber(gw,gh); //base grab size - + bool bGrab=false; + //vidGrabber.initGrabber(gw,gh); //base grab size + colorImg.allocate(gw,gh); grayImage.allocate(gw,gh); grayBg.allocate(gw,gh); grayDiff.allocate(gw,gh); - + mode=COLOUR; bLearnBakground = true; - - + + bFlip=true; - + if (boundaries.size()==0) { boundaries.push_back(boundary()); } selectedBoundary=0; +// ofAddListener(ofEvents().fileDragEvent, this, &testApp::fileDragEvent); + /* + guiWin=new guiWindow(); + //gui window stuff + ofxFenster* win2=ofxFensterManager::get()->createFenster(0, 0, 200, 400, OF_WINDOW); + + //ofAddListener(win2->events.windowResized, this, &testApp::windowEvent); + + win2->setWindowTitle("config"); + win2->addListener(guiWin); + guiWin->setup(); + guiWin->setParent(this); + +*/ } //-------------------------------------------------------------- void testApp::update(){ - vidGrabber.grabFrame(); - bool bNewFrame = vidGrabber.isFrameNew(); - if (bNewFrame){ - colorImg.setFromPixels(vidGrabber.getPixels(), gw,gh); - if (bFlip) colorImg.mirror(false,true); - grayImage = colorImg; - if (bInvert) grayImage.invert(); - if (bLearnBakground == true){ - grayBg = grayImage; // the = sign copys the pixels from grayImage into grayBg (operator overloading) - bLearnBakground = false; - } - grayDiff.absDiff(grayBg, grayImage); - grayDiff.threshold(threshold); - contourFinder.findContours(grayDiff, 20, (gw*gh)/3, 10, true); // find holes - } - - //generate midi - - for (int i = 0; i < contourFinder.nBlobs; i++){ - for (int j=0;j