diff --git a/example/RefractiveIndex.cpp b/example/RefractiveIndex.cpp index 6fdb7be..8931e25 100644 --- a/example/RefractiveIndex.cpp +++ b/example/RefractiveIndex.cpp @@ -1,4 +1,8 @@ /* + + todo: + (1) Look at warinings about the #define which get over written + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~ author: dviid ~ contact: dviid@labs.ciid.dk @@ -16,10 +20,22 @@ #include "LatencyTestAnalysis.h" #include "DiffNoiseAnalysis.h" +#include "ofxXmlSettings.h" + #define CAMERA_ID 1 #define CAMERA_ACQU_WIDTH 640 #define CAMERA_ACQU_HEIGHT 480 +#define LOCATION "MIDDLESBOROUGH" + +#define ISTATE_UNDEF 0xEEEE +#define ISTATE_START 0xAAAA +#define ISTATE_STOP 0xBBBB +#define ISTATE_TRANSITION 0xCCCC +#define ISTATE_END 0xDDDD + +int _state = ISTATE_UNDEF; + ofPixels RefractiveIndex::_pixels; ofVideoGrabber RefractiveIndex::_vidGrabber; int RefractiveIndex::_vid_w, RefractiveIndex::_vid_h, RefractiveIndex::_vid_id; @@ -27,64 +43,140 @@ bool RefractiveIndex::_vid_stream_open; bool RefractiveIndex::_vid_toggle_on; string RefractiveIndex::_location; +ofxXmlSettings XML; + void RefractiveIndex::setup() { - // rate - ofSetFrameRate(30); - ofSetVerticalSync(TRUE); + bool save_config = false; + + cout << "Loading configuration..." << endl; + if(!XML.loadFile("../data/config.refindx")) { + ofLog(OF_LOG_ERROR) << "error loading config - using default."; + save_config = true; + } + + // + _vid_id = XML.getValue("config:camera:id", CAMERA_ID); + _vid_w = XML.getValue("config:camera:width", CAMERA_ACQU_WIDTH); + _vid_h = XML.getValue("config:camera:width", CAMERA_ACQU_HEIGHT); + + // + int fps = XML.getValue("config:display:fps", 30); + + // + _location = XML.getValue("config:locale:name", LOCATION); + + cout << "Configuring..." << endl; + // display + cout << "> display" << endl; + ofSetFrameRate(fps); + if(fps > 30) { + ofSetVerticalSync(FALSE); + } else { + ofSetVerticalSync(TRUE); + } + cout << "* fps = " << fps << endl; + // camera - _vid_w = CAMERA_ACQU_WIDTH; - _vid_h = CAMERA_ACQU_HEIGHT; - _vid_id = CAMERA_ID; - _vid_stream_open = false; - _vid_toggle_on = false; + cout << "> camera" << endl; + cout << "* cam id = " << _vid_id << endl; + cout << "* cam width = " << _vid_w << endl; + cout << "* cam height = " << _vid_h << endl; + + _vid_stream_open = false; + setup_camera(); + + cout << "RRRRRREADY!" << endl; - // gui - _gui.loadFont("MONACO.TTF", 8); - _gui.setup("REFRACTIVE INDEX", 0, 0, ofGetWidth(), ofGetHeight()); - - // -> PANEL #0 - _gui.addPanel("configuration", 4, false); - _gui.setWhichPanel(0); - // --> COLUMN #0 - _gui.setWhichColumn(0); - - //GET THE INPUT NAMES FROM THE QT VIDEO GRABBER - - _gui.addToggle("more cam settings", "SETTINGS", 0); - - _gui.addToggle("turn on camera", "CAM_IS_GO", 0); - _gui.addButtonSlider("camera width", "CAM_WIDTH", _vid_w, CAMERA_ACQU_WIDTH, 1920, true); - _gui.addButtonSlider("camera height", "CAM_HEIGHT", _vid_h, CAMERA_ACQU_HEIGHT, 1080, true); - - _gui.setWhichColumn(1); - _gui.addToggle("run", "RUN", 0); - - _gui.setupEvents(); - _gui.enableEvents(); - // -- this gives you back an ofEvent for all events in this control panel object - ofAddListener(_gui.guiEvent, this, &RefractiveIndex::eventsIn); - - _currentAnalysis = NULL; _analysisAdapator = NULL; //getting a warning from the OFlog that the pixels aren't allocated - // void ofPixels::allocate(int w, int h, ofImageType type) + // void ofPixels::allocate(int w, int h, ofImageType type) + + + // setup analysis + + _analysisVector.push_back(new ShadowScapesAnalysis()); + _analysisVector.push_back(new StrobeAnalysis()); + _analysisVector.push_back(new IResponseAnalysis()); + _analysisVector.push_back(new ColorMultiAnalysis()); + _analysisVector.push_back(new CamFrameRateAnalysis()); + _analysisVector.push_back(new CamNoiseAnalysis()); + _analysisVector.push_back(new ColorSingleAnalysis()); + _analysisVector.push_back(new LatencyTestAnalysis()); + _analysisVector.push_back(new DiffNoiseAnalysis()); + + _currentAnalysisIndx = 0; + _currentAnalysis = _analysisVector.at(_currentAnalysisIndx); + + _state = ISTATE_START; + +} - //_pixels.allocate( - _location="MIDDLESBOROUGH"; - //setup_camera(); +void RefractiveIndex::analysis_cb(string & analysis) +{ + assert(analysis == _currentAnalysis->_name); + + _state = ISTATE_STOP; +} +void RefractiveIndex::start_analysis() +{ + ofAddListener(_currentAnalysis->_synthesize_cb, this, &RefractiveIndex::analysis_cb); + _analysisAdapator = new AnalysisAdaptor(_currentAnalysis); + _currentAnalysis->setup(_vid_w, _vid_h); + _analysisAdapator->start(); +} + +void RefractiveIndex::stop_analysis() +{ + if(_analysisAdapator == NULL) return; + + _analysisAdapator->stop(); //blocking + ofRemoveListener(_currentAnalysis->_synthesize_cb, this, &RefractiveIndex::analysis_cb); + _currentAnalysis = NULL; + delete _analysisAdapator; + _analysisAdapator = NULL; +} + +void RefractiveIndex::state_analysis() +{ + switch (_state) { + case ISTATE_START: + start_analysis(); + _state = ISTATE_UNDEF; + break; + case ISTATE_TRANSITION: + if(_currentAnalysisIndx >= _analysisVector.size()) { + _currentAnalysisIndx = 0; + _state = ISTATE_END; + } else { + _currentAnalysis = _analysisVector.at(_currentAnalysisIndx++); + _state = ISTATE_START; + } + break; + case ISTATE_STOP: + stop_analysis(); // blocking + _state = ISTATE_TRANSITION; + break; + case ISTATE_END: + break; + case ISTATE_UNDEF: + break; + default: + break; + } } void RefractiveIndex::update() { - _gui.update(); + state_analysis(); + RefractiveIndex::_vidGrabber.grabFrame(); // get a new frame from the camera if (_vidGrabber.isFrameNew()) - { + { _pixels = _vidGrabber.getPixelsRef(); //get ofPixels from the camera } } @@ -92,26 +184,8 @@ void RefractiveIndex::update() void RefractiveIndex::draw() { ofBackground(0, 0, 0); - - if(_currentAnalysis) - _currentAnalysis->draw(); - - // i would like to pass the pixels we've just got from the camera into the draw function for the current analysis here - // but the way that 'draw' functino in _currentAnalysis, which is an AbstractAnalysis, is as a "Pure Virtual Function" - // which i think means it can't be passed any arguments or data??? - - //_currentAnalysis->draw(_pixels); - - else - _gui.draw(); - - // if there is a new frame in the camera - /* if (_vidGrabber.isFrameNew()) - { - _vidGrabber.draw(0,0); //get ofPixels from the camera - }*/ } void RefractiveIndex::setup_camera() @@ -136,80 +210,4 @@ void RefractiveIndex::keyPressed (int key) { if( key =='f') ofToggleFullscreen(); - - else if( key =='s') { - if(_currentAnalysis && _analysisAdapator) { - _analysisAdapator->stop(); - delete _currentAnalysis; - delete _analysisAdapator; - _currentAnalysis = NULL; - _analysisAdapator = NULL; - cout << "bingo!\n\n"; //bingo means 'stop analysis'? - } - } -} - -void RefractiveIndex::mouseDragged(int x, int y, int button) -{ - _gui.mouseDragged(x, y, button); -} - - -void RefractiveIndex::mousePressed(int x, int y, int button) -{ - _gui.mousePressed(x, y, button); -} - - -void RefractiveIndex::mouseReleased(int x, int y, int button) -{ - _gui.mouseReleased(); -} - - -void RefractiveIndex::eventsIn(guiCallbackData& data) -{ - if(data.getDisplayName() == "run"){ - - ofLog(OF_LOG_VERBOSE) << "run..."; - - //_currentAnalysis = new ShadowScapesAnalysis(); // create an analysis and give it an adaptor - //_currentAnalysis = new StrobeAnalysis(); // create an analysis and give it an adaptor - //_currentAnalysis = new IResponseAnalysis(); // create an analysis and give it an adaptor - //_currentAnalysis = new ColorMultiAnalysis(); - //_currentAnalysis = new CamFrameRateAnalysis(); - //_currentAnalysis = new CamNoiseAnalysis(); - _currentAnalysis = new ColorSingleAnalysis(); - //_currentAnalysis = new LatencyTestAnalysis(); - //_currentAnalysis = new DiffNoiseAnalysis(); - - _analysisAdapator = new AnalysisAdaptor(_currentAnalysis); //Adaptors start and stop - _currentAnalysis->setup(_vid_w, _vid_h); - _analysisAdapator->start(); - } - - if(data.getDisplayName() == "turn on camera" ){ - - _vid_toggle_on=!_vid_toggle_on; - - if (_vid_toggle_on) - { - setup_camera(); - } else if (!_vid_toggle_on) { - _vidGrabber.close(); - } - } - - //more cam settings", "SETTINGS" - if( data.getDisplayName() == "more cam settings" ){ - _vidGrabber.videoSettings(); - } - -} - -void RefractiveIndex::grabBackgroundEvent(guiCallbackData & data) -{ - -} - - +} \ No newline at end of file diff --git a/example/RefractiveIndex.h b/example/RefractiveIndex.h index 8a6c06d..3036272 100644 --- a/example/RefractiveIndex.h +++ b/example/RefractiveIndex.h @@ -7,7 +7,8 @@ #pragma once #include "ofMain.h" -#include "ofxControlPanel.h" +#include "ofEvents.h" +//#include "ofxControlPanel.h" #include "AbstractAnalysis.h" #include "AnalysisAdaptor.h" @@ -24,6 +25,10 @@ public: // refindx void setup_camera(); + void analysis_cb(string & analysis); + void start_analysis(); + void stop_analysis(); + void state_analysis(); // ofx void keyPressed (int key); @@ -36,23 +41,27 @@ public: protected: - void eventsIn(guiCallbackData & data); - void grabBackgroundEvent(guiCallbackData & data); + //void eventsIn(guiCallbackData & data); + //void grabBackgroundEvent(guiCallbackData & data); // gui - ofxControlPanel _gui; + //ofxControlPanel _gui; - AbstractAnalysis* _currentAnalysis; - AnalysisAdaptor* _analysisAdapator; + AbstractAnalysis* _currentAnalysis; + int _currentAnalysisIndx; + AnalysisAdaptor* _analysisAdapator; + vector _analysisVector; public: // acquisition static ofPixels _pixels; static ofVideoGrabber _vidGrabber; - vector videoSourceList; + vector videoSourceList; static int _vid_w, _vid_h, _vid_id; static bool _vid_stream_open; static bool _vid_toggle_on; + + // this should be in xml static string _location; diff --git a/example/main.cpp b/example/main.cpp index fc36be1..cab31b6 100755 --- a/example/main.cpp +++ b/example/main.cpp @@ -1,10 +1,27 @@ #include "ofAppGlutWindow.h" #include "RefractiveIndex.h" +#include "ofxXmlSettings.h" + +#define SCREEN_WIDTH 800 +#define SCREEN_HEIGHT 600 int main() { ofAppGlutWindow window; - //window.setGlutDisplayString("rgba double samples >= 8"); - ofSetupOpenGL(&window, 1024, 768, OF_WINDOW); + + ofxXmlSettings XML; + XML.loadFile("../data/config.refindx"); + bool fullscreen = (XML.getValue("config:display:fullscreen", "false") == "true" ? true : false); + int screen_w = XML.getValue("config:display:width", SCREEN_WIDTH); + int screen_h = XML.getValue("config:display:height", SCREEN_HEIGHT); + + cout << "> display configuration" << endl; + cout << "* fullscreen: " << (fullscreen ? "yes" : "no") << endl; + if(!fullscreen) { + cout << "* screen width: " << screen_w << endl; + cout << "* screen height: " << screen_h << endl; + } + + ofSetupOpenGL(&window, screen_w, screen_h, (fullscreen ? OF_FULLSCREEN : OF_WINDOW)); ofRunApp(new RefractiveIndex()); } diff --git a/src/AbstractAnalysis.cpp b/src/AbstractAnalysis.cpp old mode 100755 new mode 100644 index 298b554..751109a --- a/src/AbstractAnalysis.cpp +++ b/src/AbstractAnalysis.cpp @@ -1,7 +1,76 @@ /* + - copyright (c) 2011 Copenhagen Institute of Interaction Design (CIID) + - all rights reserved. + + + redistribution and use in source and binary forms, with or without + + modification, are permitted provided that the following conditions + + are met: + + > redistributions of source code must retain the above copyright + + notice, this list of conditions and the following disclaimer. + + > redistributions in binary form must reproduce the above copyright + + notice, this list of conditions and the following disclaimer in + + the documentation and/or other materials provided with the + + distribution. + + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + + FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + + COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + + BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + + OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + + OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + + SUCH DAMAGE. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~ author: dviid ~ contact: dviid@labs.ciid.dk */ #include "AbstractAnalysis.h" +#include "RefractiveIndex.h" + +void AbstractAnalysis::do_synthesize() { + synthesize(); + ofNotifyEvent(_synthesize_cb, _name); +} + +void AbstractAnalysis::create_dir() +{ + // HERE IS WHERE WE SETUP THE DIRECTORY FOR ALL THE SAVED IMAGES + + //FOR WINDOWS i HAVE HAD TO REPLACE SPACES WITH UNDERSCORES AND REDUCE THE LENGTH OF THE FOLDER NAME + time_t rawtime; + struct tm * timeinfo; + + time ( &rawtime ); + timeinfo = localtime ( &rawtime ); + string time = asctime(timeinfo); + string replaceTime = ""; + + //DON'T INCLUDE THE DAY IN WORDS EG 'TUE' OR THE YEAR EG 2012 THIS MAKES THE DIRECTORY NAME TOO LONG AND CAUSES DIR CREATION TO FAIL + for(int i=4;i //#define ANALYSIS_PATH "data/analysis/" @@ -20,40 +22,31 @@ public: virtual ~AbstractAnalysis(){;} // generic function to set up the camera - virtual void setup(int camWidth, int camHeight){_cam_w = camWidth; _cam_h = camHeight;} - - // the runnable function in the thread - virtual void synthesize() = 0; // this means that this function needs to be overwritten by children that inherit this class - - // throwing the - virtual void gui_attach(ofxControlPanel* gui){_gui = gui;} - virtual void gui_detach(){;} - - - // virtual void draw(ofPixels _pixels) = 0; - // virtual void draw(ofPixels)=0; - // how to get the pixels into the analysis classes?!? -j - + virtual void setup(int camWidth, int camHeight){_cam_w = camWidth; _cam_h = camHeight;} + void do_synthesize(); + // ofx virtual void draw() = 0; + +protected: - // this is what's called a Pure Virtual Function - not sure if you can pass ofPixels through this? + virtual void create_dir(); - /* - When a virtual function is called, the implementation is chosen based not on the static type of the pointer - or reference, but on the type of the object being pointed to, which can vary at run time - So this Pure Virtual Function will be called based on the kind of object or class that instantiated it(?) - */ + // the runnable function in the thread + virtual void synthesize() = 0; + // this means that this function needs to be overwritten by children that inherit this class public: string _name; + + // event + ofEvent _synthesize_cb; protected: - ofxControlPanel* _gui; - int _cam_w, _cam_h; - - int _state; + int _cam_w, _cam_h; + int _state; + string _whole_file_path; friend class AnalysisAdaptor; }; \ No newline at end of file diff --git a/src/AnalysisAdaptor.h b/src/AnalysisAdaptor.h index 69d3136..2e32464 100755 --- a/src/AnalysisAdaptor.h +++ b/src/AnalysisAdaptor.h @@ -21,7 +21,7 @@ public: void start() { - _runnable = new RunnableAdapter(*_analysis, &AbstractAnalysis::synthesize); + _runnable = new RunnableAdapter(*_analysis, &AbstractAnalysis::do_synthesize); _worker.start(*_runnable); } diff --git a/src/CamFrameRateAnalysis.cpp b/src/CamFrameRateAnalysis.cpp index 1d1a010..7d5a1c6 100755 --- a/src/CamFrameRateAnalysis.cpp +++ b/src/CamFrameRateAnalysis.cpp @@ -18,38 +18,8 @@ using Poco::Thread; void CamFrameRateAnalysis::setup(int camWidth, int camHeight) { - // HERE IS WHERE WE SETUP THE DIRECTORY FOR ALL THE SAVED IMAGES - - //FOR WINDOWS i HAVE HAD TO REPLACE SPACES WITH UNDERSCORES AND REDUCE THE LENGTH OF THE FOLDER NAME - time_t rawtime; - struct tm * timeinfo; - - time ( &rawtime ); - timeinfo = localtime ( &rawtime ); - string time = asctime(timeinfo); - string replaceTime = ""; - - //DON'T INCLUDE THE DAY IN WORDS EG 'TUE' OR THE YEAR EG 2012 THIS MAKES THE DIRECTORY NAME TOO LONG AND CAUSES DIR CREATION TO FAIL - for(int i=4;i= NUM_SAVE_PER_RUN) _RUN_DONE = true; -} +} diff --git a/src/CamFrameRateAnalysis.h b/src/CamFrameRateAnalysis.h index aae0c40..c8fc374 100755 --- a/src/CamFrameRateAnalysis.h +++ b/src/CamFrameRateAnalysis.h @@ -26,10 +26,7 @@ public: public: void setup(int camWidth, int camHeight); - void synthesize(); - void gui_attach(ofxControlPanel* gui); - void gui_detach(); - + void synthesize(); void draw(); void save_cb(Poco::Timer& timer); @@ -38,7 +35,6 @@ protected: bool _RUN_DONE; int _run_cnt, _save_cnt; - float c, _frame_cnt, _frame_cnt_max; - string _whole_file_path; + float c, _frame_cnt, _frame_cnt_max; }; diff --git a/src/CamNoiseAnalysis.cpp b/src/CamNoiseAnalysis.cpp index 8b2b179..566c6aa 100755 --- a/src/CamNoiseAnalysis.cpp +++ b/src/CamNoiseAnalysis.cpp @@ -18,38 +18,7 @@ using Poco::Thread; void CamNoiseAnalysis::setup(int camWidth, int camHeight) { - // HERE IS WHERE WE SETUP THE DIRECTORY FOR ALL THE SAVED IMAGES - - //FOR WINDOWS i HAVE HAD TO REPLACE SPACES WITH UNDERSCORES AND REDUCE THE LENGTH OF THE FOLDER NAME - time_t rawtime; - struct tm * timeinfo; - - time ( &rawtime ); - timeinfo = localtime ( &rawtime ); - string time = asctime(timeinfo); - string replaceTime = ""; - - //DON'T INCLUDE THE DAY IN WORDS EG 'TUE' OR THE YEAR EG 2012 THIS MAKES THE DIRECTORY NAME TOO LONG AND CAUSES DIR CREATION TO FAIL - for(int i=4;i= NUM_SAVE_PER_RUN) _RUN_DONE = true; -} +} diff --git a/src/CamNoiseAnalysis.h b/src/CamNoiseAnalysis.h index bff2b63..f180a58 100755 --- a/src/CamNoiseAnalysis.h +++ b/src/CamNoiseAnalysis.h @@ -25,9 +25,6 @@ public: void setup(int camWidth, int camHeight); void synthesize(); - void gui_attach(ofxControlPanel* gui); - void gui_detach(); - void draw(); void save_cb(Poco::Timer& timer); @@ -37,6 +34,5 @@ protected: bool _RUN_DONE; int _run_cnt, _save_cnt; float c, _frame_cnt, _frame_cnt_max; - string _whole_file_path; }; diff --git a/src/ColorMultiAnalysis.cpp b/src/ColorMultiAnalysis.cpp index 1804690..23167e8 100755 --- a/src/ColorMultiAnalysis.cpp +++ b/src/ColorMultiAnalysis.cpp @@ -45,41 +45,9 @@ using Poco::Thread; void ColorMultiAnalysis::setup(int camWidth, int camHeight) { - // HERE IS WHERE WE SETUP THE DIRECTORY FOR ALL THE SAVED IMAGES - - //FOR WINDOWS i HAVE HAD TO REPLACE SPACES WITH UNDERSCORES AND REDUCE THE LENGTH OF THE FOLDER NAME - time_t rawtime; - struct tm * timeinfo; - - time ( &rawtime ); - timeinfo = localtime ( &rawtime ); - string time = asctime(timeinfo); - string replaceTime = ""; - - //DON'T INCLUDE THE DAY IN WORDS EG 'TUE' OR THE YEAR EG 2012 THIS MAKES THE DIRECTORY NAME TOO LONG AND CAUSES DIR CREATION TO FAIL - for(int i=4;iaddToggle("GO", "GO", 0); - gui->addButtonSlider("animation time limit", "ANIMATION_TIME_LIMIT", 10, 1, 3000, TRUE); - -} - -void ColorMultiAnalysis::gui_detach() -{ - -} - void ColorMultiAnalysis::draw() { diff --git a/src/ColorMultiAnalysis.h b/src/ColorMultiAnalysis.h index d84be9a..61af16c 100755 --- a/src/ColorMultiAnalysis.h +++ b/src/ColorMultiAnalysis.h @@ -17,10 +17,7 @@ public: public: void setup(int camWidth, int camHeight); - void synthesize(); - void gui_attach(ofxControlPanel* gui); - void gui_detach(); - + void synthesize(); void draw(); void save_cb(Poco::Timer& timer); @@ -30,5 +27,4 @@ protected: bool _RUN_DONE; int _run_cnt, _save_cnt; float c, _frame_cnt, _frame_cnt_max; - string _whole_file_path; }; diff --git a/src/ColorSingleAnalysis.cpp b/src/ColorSingleAnalysis.cpp index 091dd1f..9e8c561 100755 --- a/src/ColorSingleAnalysis.cpp +++ b/src/ColorSingleAnalysis.cpp @@ -18,38 +18,7 @@ using Poco::Thread; void ColorSingleAnalysis::setup(int camWidth, int camHeight) { - // HERE IS WHERE WE SETUP THE DIRECTORY FOR ALL THE SAVED IMAGES - - //FOR WINDOWS i HAVE HAD TO REPLACE SPACES WITH UNDERSCORES AND REDUCE THE LENGTH OF THE FOLDER NAME - time_t rawtime; - struct tm * timeinfo; - - time ( &rawtime ); - timeinfo = localtime ( &rawtime ); - string time = asctime(timeinfo); - string replaceTime = ""; - - //DON'T INCLUDE THE DAY IN WORDS EG 'TUE' OR THE YEAR EG 2012 THIS MAKES THE DIRECTORY NAME TOO LONG AND CAUSES DIR CREATION TO FAIL - for(int i=4;i= NUM_SAVE_PER_RUN) _RUN_DONE = true; -} +} diff --git a/src/ColorSingleAnalysis.h b/src/ColorSingleAnalysis.h index 53c2b10..059f5be 100755 --- a/src/ColorSingleAnalysis.h +++ b/src/ColorSingleAnalysis.h @@ -24,10 +24,7 @@ public: public: void setup(int camWidth, int camHeight); - void synthesize(); - void gui_attach(ofxControlPanel* gui); - void gui_detach(); - + void synthesize(); void draw(); void save_cb(Poco::Timer& timer); @@ -37,6 +34,5 @@ protected: bool _RUN_DONE; int _run_cnt, _save_cnt; float r,g,b, _frame_cnt, _frame_cnt_max; - string _whole_file_path; }; diff --git a/src/DiffNoiseAnalysis.cpp b/src/DiffNoiseAnalysis.cpp index 6ba13bb..ef00e10 100755 --- a/src/DiffNoiseAnalysis.cpp +++ b/src/DiffNoiseAnalysis.cpp @@ -18,38 +18,7 @@ using Poco::Thread; void DiffNoiseAnalysis::setup(int camWidth, int camHeight) { - // HERE IS WHERE WE SETUP THE DIRECTORY FOR ALL THE SAVED IMAGES - - //FOR WINDOWS i HAVE HAD TO REPLACE SPACES WITH UNDERSCORES AND REDUCE THE LENGTH OF THE FOLDER NAME - time_t rawtime; - struct tm * timeinfo; - - time ( &rawtime ); - timeinfo = localtime ( &rawtime ); - string time = asctime(timeinfo); - string replaceTime = ""; - - //DON'T INCLUDE THE DAY IN WORDS EG 'TUE' OR THE YEAR EG 2012 THIS MAKES THE DIRECTORY NAME TOO LONG AND CAUSES DIR CREATION TO FAIL - for(int i=4;i= NUM_SAVE_PER_RUN) _RUN_DONE = true; -} +} diff --git a/src/DiffNoiseAnalysis.h b/src/DiffNoiseAnalysis.h index 929cf50..f179ae3 100755 --- a/src/DiffNoiseAnalysis.h +++ b/src/DiffNoiseAnalysis.h @@ -24,10 +24,7 @@ public: public: void setup(int camWidth, int camHeight); - void synthesize(); - void gui_attach(ofxControlPanel* gui); - void gui_detach(); - + void synthesize(); void draw(); void save_cb(Poco::Timer& timer); @@ -37,6 +34,5 @@ protected: bool _RUN_DONE; int _run_cnt, _save_cnt; float c, _frame_cnt, _frame_cnt_max; - string _whole_file_path; }; diff --git a/src/IResponseAnalysis.cpp b/src/IResponseAnalysis.cpp index 03373ec..54d9e4e 100755 --- a/src/IResponseAnalysis.cpp +++ b/src/IResponseAnalysis.cpp @@ -18,38 +18,7 @@ using Poco::Thread; void IResponseAnalysis::setup(int camWidth, int camHeight) { - // HERE IS WHERE WE SETUP THE DIRECTORY FOR ALL THE SAVED IMAGES - - //FOR WINDOWS i HAVE HAD TO REPLACE SPACES WITH UNDERSCORES AND REDUCE THE LENGTH OF THE FOLDER NAME - time_t rawtime; - struct tm * timeinfo; - - time ( &rawtime ); - timeinfo = localtime ( &rawtime ); - string time = asctime(timeinfo); - string replaceTime = ""; - - //DON'T INCLUDE THE DAY IN WORDS EG 'TUE' OR THE YEAR EG 2012 THIS MAKES THE DIRECTORY NAME TOO LONG AND CAUSES DIR CREATION TO FAIL - for(int i=4;i= NUM_SAVE_PER_RUN) _RUN_DONE = true; -} +} diff --git a/src/IResponseAnalysis.h b/src/IResponseAnalysis.h index 06f4bd7..b33647c 100755 --- a/src/IResponseAnalysis.h +++ b/src/IResponseAnalysis.h @@ -25,9 +25,6 @@ public: void setup(int camWidth, int camHeight); void synthesize(); - void gui_attach(ofxControlPanel* gui); - void gui_detach(); - void draw(); void save_cb(Poco::Timer& timer); @@ -37,6 +34,5 @@ protected: bool _RUN_DONE; int _run_cnt, _save_cnt; float c, _frame_cnt, _frame_cnt_max; - string _whole_file_path; }; diff --git a/src/LatencyTestAnalysis.cpp b/src/LatencyTestAnalysis.cpp index 67a0fec..f13e906 100755 --- a/src/LatencyTestAnalysis.cpp +++ b/src/LatencyTestAnalysis.cpp @@ -18,38 +18,7 @@ using Poco::Thread; void LatencyTestAnalysis::setup(int camWidth, int camHeight) { - // HERE IS WHERE WE SETUP THE DIRECTORY FOR ALL THE SAVED IMAGES - - //FOR WINDOWS i HAVE HAD TO REPLACE SPACES WITH UNDERSCORES AND REDUCE THE LENGTH OF THE FOLDER NAME - time_t rawtime; - struct tm * timeinfo; - - time ( &rawtime ); - timeinfo = localtime ( &rawtime ); - string time = asctime(timeinfo); - string replaceTime = ""; - - //DON'T INCLUDE THE DAY IN WORDS EG 'TUE' OR THE YEAR EG 2012 THIS MAKES THE DIRECTORY NAME TOO LONG AND CAUSES DIR CREATION TO FAIL - for(int i=4;i= NUM_SAVE_PER_RUN) _RUN_DONE = true; -} +} diff --git a/src/LatencyTestAnalysis.h b/src/LatencyTestAnalysis.h index 417493f..f3d0bd3 100755 --- a/src/LatencyTestAnalysis.h +++ b/src/LatencyTestAnalysis.h @@ -24,10 +24,7 @@ public: public: void setup(int camWidth, int camHeight); - void synthesize(); - void gui_attach(ofxControlPanel* gui); - void gui_detach(); - + void synthesize(); void draw(); void save_cb(Poco::Timer& timer); @@ -37,6 +34,5 @@ protected: bool _RUN_DONE; int _run_cnt, _save_cnt; float c, _frame_cnt, _frame_cnt_max; - string _whole_file_path; }; diff --git a/src/ShadowScapesAnalysis.cpp b/src/ShadowScapesAnalysis.cpp index 11205b6..56055d4 100755 --- a/src/ShadowScapesAnalysis.cpp +++ b/src/ShadowScapesAnalysis.cpp @@ -46,38 +46,7 @@ using Poco::Thread; void ShadowScapesAnalysis::setup(int camWidth, int camHeight) { - // HERE IS WHERE WE SETUP THE DIRECTORY FOR ALL THE SAVED IMAGES - - //FOR WINDOWS i HAVE HAD TO REPLACE SPACES WITH UNDERSCORES AND REDUCE THE LENGTH OF THE FOLDER NAME - time_t rawtime; - struct tm * timeinfo; - - time ( &rawtime ); - timeinfo = localtime ( &rawtime ); - string time = asctime(timeinfo); - string replaceTime = ""; - - //DON'T INCLUDE THE DAY IN WORDS EG 'TUE' OR THE YEAR EG 2012 THIS MAKES THE DIRECTORY NAME TOO LONG AND CAUSES DIR CREATION TO FAIL - for(int i=4;iaddToggle("GO", "GO", 0); - gui->addButtonSlider("animation time limit", "ANIMATION_TIME_LIMIT", 10, 1, 3000, TRUE); - -} - -void ShadowScapesAnalysis::gui_detach() -{ - - -} - - // the animation draw - and the output draw void ShadowScapesAnalysis::draw() { @@ -152,14 +109,10 @@ void ShadowScapesAnalysis::draw() void ShadowScapesAnalysis::scan_cb(Timer& timer) { - cout << "ShadowScapesAnalysis::scan_cb\n"; - _line += _step; if((_dir == H && _line >= ofGetWidth()) || (_dir == V && _line >= ofGetHeight())) { _state = STATE_ANALYSIS; } - - } diff --git a/src/ShadowScapesAnalysis.h b/src/ShadowScapesAnalysis.h index 8b38d4d..59004a2 100755 --- a/src/ShadowScapesAnalysis.h +++ b/src/ShadowScapesAnalysis.h @@ -44,15 +44,13 @@ class ShadowScapesAnalysis : public AbstractAnalysis { public: ShadowScapesAnalysis(shadow_type dir): AbstractAnalysis("SHADOWSCAPE"), _dir(dir){;} + ShadowScapesAnalysis(): AbstractAnalysis("SHADOWSCAPE"), _dir(H){;} virtual ~ShadowScapesAnalysis(){;} public: void setup(int camWidth, int camHeight); void synthesize(); - void gui_attach(ofxControlPanel* gui); - void gui_detach(); - void draw(); void scan_cb(Poco::Timer& timer); @@ -64,6 +62,4 @@ protected: int _step; shadow_type _dir; - string _whole_file_path; - }; \ No newline at end of file diff --git a/src/StrobeAnalysis.cpp b/src/StrobeAnalysis.cpp index a8b7e52..c48971b 100755 --- a/src/StrobeAnalysis.cpp +++ b/src/StrobeAnalysis.cpp @@ -45,38 +45,7 @@ using Poco::Thread; void StrobeAnalysis::setup(int camWidth, int camHeight) { - // HERE IS WHERE WE SETUP THE DIRECTORY FOR ALL THE SAVED IMAGES - - //FOR WINDOWS i HAVE HAD TO REPLACE SPACES WITH UNDERSCORES AND REDUCE THE LENGTH OF THE FOLDER NAME - time_t rawtime; - struct tm * timeinfo; - - time ( &rawtime ); - timeinfo = localtime ( &rawtime ); - string time = asctime(timeinfo); - string replaceTime = ""; - - //DON'T INCLUDE THE DAY IN WORDS EG 'TUE' OR THE YEAR EG 2012 THIS MAKES THE DIRECTORY NAME TOO LONG AND CAUSES DIR CREATION TO FAIL - for(int i=4;iaddToggle("GO", "GO", 0); - gui->addButtonSlider("animation time limit", "ANIMATION_TIME_LIMIT", 10, 1, 3000, TRUE); - -} - -void StrobeAnalysis::gui_detach() -{ - + */ } void StrobeAnalysis::draw() diff --git a/src/StrobeAnalysis.h b/src/StrobeAnalysis.h index b6358b7..a4e456e 100755 --- a/src/StrobeAnalysis.h +++ b/src/StrobeAnalysis.h @@ -46,9 +46,6 @@ public: void setup(int camWidth, int camHeight); void synthesize(); - void gui_attach(ofxControlPanel* gui); - void gui_detach(); - void draw(); void strobe_cb(Poco::Timer& timer); @@ -57,5 +54,4 @@ protected: int _strobe_cnt; bool _darkness; - string _whole_file_path; };