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/boundary.cpp | 12 ++++-- src/boundary.h | 6 ++- src/main.cpp | 4 +- src/testApp.cpp | 125 +++++++++++++++++++++++++++++++++++-------------------- src/testApp.h | 30 +++++++------ 5 files changed, 112 insertions(+), 65 deletions(-) (limited to 'src') diff --git a/src/boundary.cpp b/src/boundary.cpp index c30f676..64957ed 100755 --- a/src/boundary.cpp +++ b/src/boundary.cpp @@ -2,12 +2,12 @@ boundary::boundary() { - note=40; //middle C + filename=""; } -boundary::boundary(int _note) +boundary::boundary(string file) { - note=_note; + filename=file; } boundary::~boundary() @@ -20,7 +20,7 @@ void boundary::draw(){ for (int i=0;i points; ofPoint centroid; + + void checkfile(ofPoint pos,string file); + string filename; }; diff --git a/src/main.cpp b/src/main.cpp index e922099..fca2408 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -6,11 +6,11 @@ int main( ){ ofAppGlutWindow window; - ofSetupOpenGL(&window, 720,576, OF_WINDOW); // <-------- setup the GL context + ofSetupOpenGL(ofxFensterManager::get(), 720,576, OF_WINDOW); // <-------- setup the GL context // this kicks off the running of my app // can be OF_WINDOW or OF_FULLSCREEN // pass in width and height too: - ofRunApp( new testApp()); + ofRunFensterApp( new testApp()); } 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 boundaries; int selectedBoundary; - + }; -- cgit v1.2.3