Chained analysis
This commit is contained in:
Executable → Regular
+69
@@ -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<time.size()-4;i++){
|
||||
if(time.at(i)==' '||time.at(i)==':'){
|
||||
replaceTime+="_";
|
||||
}
|
||||
else{
|
||||
replaceTime+=time.at(i);
|
||||
}
|
||||
}
|
||||
|
||||
ofDirectory dir;
|
||||
|
||||
_whole_file_path= string(ANALYSIS_PATH)+ RefractiveIndex::_location+"/"+ _name+"/"+replaceTime ;
|
||||
//directories have to be created one level at a time hence repeated calls
|
||||
if(!dir.doesDirectoryExist(_whole_file_path)){
|
||||
dir.createDirectory(string(ANALYSIS_PATH)+RefractiveIndex::_location+"/", true,false);
|
||||
dir.createDirectory(string(ANALYSIS_PATH)+RefractiveIndex::_location+"/"+ _name+"/", true,false);
|
||||
dir.createDirectory(string(ANALYSIS_PATH)+RefractiveIndex::_location+"/"+ _name+"/"+replaceTime+"/", true,false);
|
||||
}
|
||||
|
||||
//////////////////////////////END DIRECTORY CREATION //////////////////////////////////////////////////
|
||||
}
|
||||
|
||||
|
||||
+18
-25
@@ -5,7 +5,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "ofxControlPanel.h"
|
||||
#include "ofMain.h"
|
||||
#include "ofEvents.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
//#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<string> _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;
|
||||
};
|
||||
@@ -21,7 +21,7 @@ public:
|
||||
|
||||
void start()
|
||||
{
|
||||
_runnable = new RunnableAdapter<AbstractAnalysis>(*_analysis, &AbstractAnalysis::synthesize);
|
||||
_runnable = new RunnableAdapter<AbstractAnalysis>(*_analysis, &AbstractAnalysis::do_synthesize);
|
||||
_worker.start(*_runnable);
|
||||
}
|
||||
|
||||
|
||||
@@ -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<time.size()-4;i++){
|
||||
if(time.at(i)==' '||time.at(i)==':'){
|
||||
replaceTime+="_";
|
||||
}
|
||||
else{
|
||||
replaceTime+=time.at(i);
|
||||
}
|
||||
}
|
||||
|
||||
ofDirectory dir;
|
||||
|
||||
_whole_file_path= string(ANALYSIS_PATH)+RefractiveIndex::_location+"/"+ _name+"/"+replaceTime ;
|
||||
//directories have to be created one level at a time hence repeated calls
|
||||
if(!dir.doesDirectoryExist(_whole_file_path)){
|
||||
dir.createDirectory(string(ANALYSIS_PATH)+RefractiveIndex::_location+"/", true,false);
|
||||
dir.createDirectory(string(ANALYSIS_PATH)+RefractiveIndex::_location+"/"+ _name+"/", true,false);
|
||||
dir.createDirectory(string(ANALYSIS_PATH)+RefractiveIndex::_location+"/"+ _name+"/"+replaceTime+"/", true,false);
|
||||
}
|
||||
|
||||
//////////////////////////////END DIRECTORY CREATION //////////////////////////////////////////////////
|
||||
create_dir();
|
||||
|
||||
_frame_cnt = 0;
|
||||
_frame_cnt_max = ofGetFrameRate() * ((DELTA_T_SAVE * NUM_SAVE_PER_RUN) / 1000);
|
||||
c = 0;
|
||||
@@ -82,19 +52,6 @@ void CamFrameRateAnalysis::synthesize()
|
||||
}
|
||||
}
|
||||
|
||||
void CamFrameRateAnalysis::gui_attach(ofxControlPanel* gui)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CamFrameRateAnalysis::gui_detach()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//void CamFrameRateAnalysis::draw(ofPixels _pixels) //trying to figure out how to get pixels from the RefractiveIndex.cpp
|
||||
|
||||
|
||||
// this runs at frame rate = 33 ms for 30 FPS
|
||||
void CamFrameRateAnalysis::draw()
|
||||
{
|
||||
@@ -138,4 +95,4 @@ void CamFrameRateAnalysis::save_cb(Timer& timer)
|
||||
if(_save_cnt >= NUM_SAVE_PER_RUN)
|
||||
_RUN_DONE = true;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
};
|
||||
|
||||
@@ -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<time.size()-4;i++){
|
||||
if(time.at(i)==' '||time.at(i)==':'){
|
||||
replaceTime+="_";
|
||||
}
|
||||
else{
|
||||
replaceTime+=time.at(i);
|
||||
}
|
||||
}
|
||||
|
||||
ofDirectory dir;
|
||||
|
||||
_whole_file_path= string(ANALYSIS_PATH)+RefractiveIndex::_location+"/"+ _name+"/"+replaceTime ;
|
||||
//directories have to be created one level at a time hence repeated calls
|
||||
if(!dir.doesDirectoryExist(_whole_file_path)){
|
||||
dir.createDirectory(string(ANALYSIS_PATH)+RefractiveIndex::_location+"/", true,false);
|
||||
dir.createDirectory(string(ANALYSIS_PATH)+RefractiveIndex::_location+"/"+ _name+"/", true,false);
|
||||
dir.createDirectory(string(ANALYSIS_PATH)+RefractiveIndex::_location+"/"+ _name+"/"+replaceTime+"/", true,false);
|
||||
}
|
||||
|
||||
//////////////////////////////END DIRECTORY CREATION //////////////////////////////////////////////////
|
||||
create_dir();
|
||||
|
||||
_frame_cnt = 0;
|
||||
_frame_cnt_max = ofGetFrameRate() * ((DELTA_T_SAVE * NUM_SAVE_PER_RUN) / 1000);
|
||||
@@ -83,18 +52,6 @@ void CamNoiseAnalysis::synthesize()
|
||||
}
|
||||
}
|
||||
|
||||
void CamNoiseAnalysis::gui_attach(ofxControlPanel* gui)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CamNoiseAnalysis::gui_detach()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//void CamNoiseAnalysis::draw(ofPixels _pixels) //trying to figure out how to get pixels from the RefractiveIndex.cpp
|
||||
|
||||
|
||||
// this runs at frame rate = 33 ms for 30 FPS
|
||||
void CamNoiseAnalysis::draw()
|
||||
@@ -140,4 +97,4 @@ void CamNoiseAnalysis::save_cb(Timer& timer)
|
||||
if(_save_cnt >= NUM_SAVE_PER_RUN)
|
||||
_RUN_DONE = true;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
};
|
||||
|
||||
@@ -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;i<time.size()-4;i++){
|
||||
if(time.at(i)==' '||time.at(i)==':'){
|
||||
replaceTime+="_";
|
||||
}
|
||||
else{
|
||||
replaceTime+=time.at(i);
|
||||
}
|
||||
}
|
||||
|
||||
ofDirectory dir;
|
||||
|
||||
_whole_file_path= string(ANALYSIS_PATH)+RefractiveIndex::_location+"/"+ _name+"/"+replaceTime ;
|
||||
//directories have to be created one level at a time hence repeated calls
|
||||
if(!dir.doesDirectoryExist(_whole_file_path)){
|
||||
dir.createDirectory(string(ANALYSIS_PATH)+RefractiveIndex::_location+"/", true,false);
|
||||
dir.createDirectory(string(ANALYSIS_PATH)+RefractiveIndex::_location+"/"+ _name+"/", true,false);
|
||||
dir.createDirectory(string(ANALYSIS_PATH)+RefractiveIndex::_location+"/"+ _name+"/"+replaceTime+"/", true,false);
|
||||
}
|
||||
|
||||
//////////////////////////////END DIRECTORY CREATION //////////////////////////////////////////////////
|
||||
create_dir();
|
||||
_frame_cnt = 0;
|
||||
_frame_cnt_max = ofGetFrameRate() * ((DELTA_T_SAVE * NUM_SAVE_PER_RUN) / 1000);
|
||||
|
||||
c = 0;
|
||||
}
|
||||
|
||||
@@ -110,18 +78,6 @@ void ColorMultiAnalysis::synthesize()
|
||||
|
||||
}
|
||||
|
||||
void ColorMultiAnalysis::gui_attach(ofxControlPanel* gui)
|
||||
{
|
||||
gui->addToggle("GO", "GO", 0);
|
||||
gui->addButtonSlider("animation time limit", "ANIMATION_TIME_LIMIT", 10, 1, 3000, TRUE);
|
||||
|
||||
}
|
||||
|
||||
void ColorMultiAnalysis::gui_detach()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ColorMultiAnalysis::draw()
|
||||
{
|
||||
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
@@ -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<time.size()-4;i++){
|
||||
if(time.at(i)==' '||time.at(i)==':'){
|
||||
replaceTime+="_";
|
||||
}
|
||||
else{
|
||||
replaceTime+=time.at(i);
|
||||
}
|
||||
}
|
||||
|
||||
ofDirectory dir;
|
||||
|
||||
_whole_file_path= string(ANALYSIS_PATH)+RefractiveIndex::_location+"/"+ _name+"/"+replaceTime ;
|
||||
//directories have to be created one level at a time hence repeated calls
|
||||
if(!dir.doesDirectoryExist(_whole_file_path)){
|
||||
dir.createDirectory(string(ANALYSIS_PATH)+RefractiveIndex::_location+"/", true,false);
|
||||
dir.createDirectory(string(ANALYSIS_PATH)+RefractiveIndex::_location+"/"+ _name+"/", true,false);
|
||||
dir.createDirectory(string(ANALYSIS_PATH)+RefractiveIndex::_location+"/"+ _name+"/"+replaceTime+"/", true,false);
|
||||
}
|
||||
|
||||
//////////////////////////////END DIRECTORY CREATION //////////////////////////////////////////////////
|
||||
create_dir();
|
||||
_frame_cnt = 0;
|
||||
_frame_cnt_max = ofGetFrameRate() * ((DELTA_T_SAVE * NUM_SAVE_PER_RUN) / 1000);
|
||||
r = 0;
|
||||
@@ -84,17 +53,6 @@ void ColorSingleAnalysis::synthesize()
|
||||
}
|
||||
}
|
||||
|
||||
void ColorSingleAnalysis::gui_attach(ofxControlPanel* gui)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ColorSingleAnalysis::gui_detach()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void ColorSingleAnalysis::draw()
|
||||
{
|
||||
|
||||
@@ -142,4 +100,4 @@ void ColorSingleAnalysis::save_cb(Timer& timer)
|
||||
if(_save_cnt >= NUM_SAVE_PER_RUN)
|
||||
_RUN_DONE = true;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
};
|
||||
|
||||
@@ -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<time.size()-4;i++){
|
||||
if(time.at(i)==' '||time.at(i)==':'){
|
||||
replaceTime+="_";
|
||||
}
|
||||
else{
|
||||
replaceTime+=time.at(i);
|
||||
}
|
||||
}
|
||||
|
||||
ofDirectory dir;
|
||||
|
||||
_whole_file_path= string(ANALYSIS_PATH)+RefractiveIndex::_location+"/"+ _name+"/"+replaceTime ;
|
||||
//directories have to be created one level at a time hence repeated calls
|
||||
if(!dir.doesDirectoryExist(_whole_file_path)){
|
||||
dir.createDirectory(string(ANALYSIS_PATH)+RefractiveIndex::_location+"/", true,false);
|
||||
dir.createDirectory(string(ANALYSIS_PATH)+RefractiveIndex::_location+"/"+ _name+"/", true,false);
|
||||
dir.createDirectory(string(ANALYSIS_PATH)+RefractiveIndex::_location+"/"+ _name+"/"+replaceTime+"/", true,false);
|
||||
}
|
||||
|
||||
//////////////////////////////END DIRECTORY CREATION //////////////////////////////////////////////////
|
||||
create_dir();
|
||||
_frame_cnt = 0;
|
||||
_frame_cnt_max = ofGetFrameRate() * ((DELTA_T_SAVE * NUM_SAVE_PER_RUN) / 1000);
|
||||
c = 0;
|
||||
@@ -82,19 +51,6 @@ void DiffNoiseAnalysis::synthesize()
|
||||
}
|
||||
}
|
||||
|
||||
void DiffNoiseAnalysis::gui_attach(ofxControlPanel* gui)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void DiffNoiseAnalysis::gui_detach()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//void DiffNoiseAnalysis::draw(ofPixels _pixels) //trying to figure out how to get pixels from the RefractiveIndex.cpp
|
||||
|
||||
|
||||
// this runs at frame rate = 33 ms for 30 FPS
|
||||
void DiffNoiseAnalysis::draw()
|
||||
{
|
||||
@@ -143,4 +99,4 @@ void DiffNoiseAnalysis::save_cb(Timer& timer)
|
||||
if(_save_cnt >= NUM_SAVE_PER_RUN)
|
||||
_RUN_DONE = true;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
};
|
||||
|
||||
@@ -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<time.size()-4;i++){
|
||||
if(time.at(i)==' '||time.at(i)==':'){
|
||||
replaceTime+="_";
|
||||
}
|
||||
else{
|
||||
replaceTime+=time.at(i);
|
||||
}
|
||||
}
|
||||
|
||||
ofDirectory dir;
|
||||
|
||||
_whole_file_path= string(ANALYSIS_PATH)+RefractiveIndex::_location+"/"+ _name+"/"+replaceTime ;
|
||||
//directories have to be created one level at a time hence repeated calls
|
||||
if(!dir.doesDirectoryExist(_whole_file_path)){
|
||||
dir.createDirectory(string(ANALYSIS_PATH)+RefractiveIndex::_location+"/", true,false);
|
||||
dir.createDirectory(string(ANALYSIS_PATH)+RefractiveIndex::_location+"/"+ _name+"/", true,false);
|
||||
dir.createDirectory(string(ANALYSIS_PATH)+RefractiveIndex::_location+"/"+ _name+"/"+replaceTime+"/", true,false);
|
||||
}
|
||||
|
||||
//////////////////////////////END DIRECTORY CREATION //////////////////////////////////////////////////
|
||||
create_dir();
|
||||
_frame_cnt = 0;
|
||||
_frame_cnt_max = ofGetFrameRate() * ((DELTA_T_SAVE * NUM_SAVE_PER_RUN) / 1000);
|
||||
c = 0;
|
||||
@@ -82,18 +51,6 @@ void IResponseAnalysis::synthesize()
|
||||
}
|
||||
}
|
||||
|
||||
void IResponseAnalysis::gui_attach(ofxControlPanel* gui)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void IResponseAnalysis::gui_detach()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//void IResponseAnalysis::draw(ofPixels _pixels) //trying to figure out how to get pixels from the RefractiveIndex.cpp
|
||||
|
||||
|
||||
// this runs at frame rate = 33 ms for 30 FPS
|
||||
void IResponseAnalysis::draw()
|
||||
@@ -135,4 +92,4 @@ void IResponseAnalysis::save_cb(Timer& timer)
|
||||
if(_save_cnt >= NUM_SAVE_PER_RUN)
|
||||
_RUN_DONE = true;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
};
|
||||
|
||||
@@ -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<time.size()-4;i++){
|
||||
if(time.at(i)==' '||time.at(i)==':'){
|
||||
replaceTime+="_";
|
||||
}
|
||||
else{
|
||||
replaceTime+=time.at(i);
|
||||
}
|
||||
}
|
||||
|
||||
ofDirectory dir;
|
||||
|
||||
_whole_file_path= string(ANALYSIS_PATH)+RefractiveIndex::_location+"/"+ _name+"/"+replaceTime ;
|
||||
//directories have to be created one level at a time hence repeated calls
|
||||
if(!dir.doesDirectoryExist(_whole_file_path)){
|
||||
dir.createDirectory(string(ANALYSIS_PATH)+RefractiveIndex::_location+"/", true,false);
|
||||
dir.createDirectory(string(ANALYSIS_PATH)+RefractiveIndex::_location+"/"+ _name+"/", true,false);
|
||||
dir.createDirectory(string(ANALYSIS_PATH)+RefractiveIndex::_location+"/"+ _name+"/"+replaceTime+"/", true,false);
|
||||
}
|
||||
|
||||
//////////////////////////////END DIRECTORY CREATION //////////////////////////////////////////////////
|
||||
create_dir();
|
||||
_frame_cnt = 0;
|
||||
_frame_cnt_max = ofGetFrameRate() * ((DELTA_T_SAVE * NUM_SAVE_PER_RUN) / 1000);
|
||||
c = 0;
|
||||
@@ -82,19 +51,6 @@ void LatencyTestAnalysis::synthesize()
|
||||
}
|
||||
}
|
||||
|
||||
void LatencyTestAnalysis::gui_attach(ofxControlPanel* gui)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void LatencyTestAnalysis::gui_detach()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//void LatencyTestAnalysis::draw(ofPixels _pixels) //trying to figure out how to get pixels from the RefractiveIndex.cpp
|
||||
|
||||
|
||||
// this runs at frame rate = 33 ms for 30 FPS
|
||||
void LatencyTestAnalysis::draw()
|
||||
{
|
||||
@@ -153,4 +109,4 @@ void LatencyTestAnalysis::save_cb(Timer& timer)
|
||||
if(_save_cnt >= NUM_SAVE_PER_RUN)
|
||||
_RUN_DONE = true;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
};
|
||||
|
||||
@@ -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;i<time.size()-4;i++){
|
||||
if(time.at(i)==' '||time.at(i)==':'){
|
||||
replaceTime+="_";
|
||||
}
|
||||
else{
|
||||
replaceTime+=time.at(i);
|
||||
}
|
||||
}
|
||||
|
||||
ofDirectory dir;
|
||||
|
||||
_whole_file_path= string(ANALYSIS_PATH)+RefractiveIndex::_location+"/"+ _name+"/"+replaceTime ;
|
||||
//directories have to be created one level at a time hence repeated calls
|
||||
if(!dir.doesDirectoryExist(_whole_file_path)){
|
||||
dir.createDirectory(string(ANALYSIS_PATH)+RefractiveIndex::_location+"/", true,false);
|
||||
dir.createDirectory(string(ANALYSIS_PATH)+RefractiveIndex::_location+"/"+ _name+"/", true,false);
|
||||
dir.createDirectory(string(ANALYSIS_PATH)+RefractiveIndex::_location+"/"+ _name+"/"+replaceTime+"/", true,false);
|
||||
}
|
||||
|
||||
//////////////////////////////END DIRECTORY CREATION //////////////////////////////////////////////////
|
||||
create_dir();
|
||||
_speed = 300;
|
||||
}
|
||||
|
||||
@@ -103,25 +72,13 @@ void ShadowScapesAnalysis::synthesize()
|
||||
// do analysis here
|
||||
// go back to the files i've saved and do the math here -
|
||||
|
||||
/*
|
||||
while(_state != STATE_STOP)
|
||||
Thread::sleep(100);
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
void ShadowScapesAnalysis::gui_attach(ofxControlPanel* gui)
|
||||
{
|
||||
gui->addToggle("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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
};
|
||||
+5
-45
@@ -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;i<time.size()-4;i++){
|
||||
if(time.at(i)==' '||time.at(i)==':'){
|
||||
replaceTime+="_";
|
||||
}
|
||||
else{
|
||||
replaceTime+=time.at(i);
|
||||
}
|
||||
}
|
||||
|
||||
ofDirectory dir;
|
||||
|
||||
_whole_file_path= string(ANALYSIS_PATH)+RefractiveIndex::_location+"/"+ _name+"/"+replaceTime ;
|
||||
//directories have to be created one level at a time hence repeated calls
|
||||
if(!dir.doesDirectoryExist(_whole_file_path)){
|
||||
dir.createDirectory(string(ANALYSIS_PATH)+RefractiveIndex::_location+"/", true,false);
|
||||
dir.createDirectory(string(ANALYSIS_PATH)+RefractiveIndex::_location+"/"+ _name+"/", true,false);
|
||||
dir.createDirectory(string(ANALYSIS_PATH)+RefractiveIndex::_location+"/"+ _name+"/"+replaceTime+"/", true,false);
|
||||
}
|
||||
|
||||
//////////////////////////////END DIRECTORY CREATION //////////////////////////////////////////////////
|
||||
create_dir();
|
||||
}
|
||||
|
||||
void StrobeAnalysis::synthesize()
|
||||
@@ -97,21 +66,12 @@ void StrobeAnalysis::synthesize()
|
||||
strobe_timer.stop();
|
||||
|
||||
// do analysis here
|
||||
|
||||
|
||||
|
||||
/*
|
||||
while(_state != STATE_STOP)
|
||||
Thread::sleep(100);
|
||||
}
|
||||
|
||||
void StrobeAnalysis::gui_attach(ofxControlPanel* gui)
|
||||
{
|
||||
gui->addToggle("GO", "GO", 0);
|
||||
gui->addButtonSlider("animation time limit", "ANIMATION_TIME_LIMIT", 10, 1, 3000, TRUE);
|
||||
|
||||
}
|
||||
|
||||
void StrobeAnalysis::gui_detach()
|
||||
{
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
void StrobeAnalysis::draw()
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user