merge Tom files

This commit is contained in:
dviid 2012-01-24 16:52:22 +01:00
parent 7123b1b386
commit b3e8415fcd
13 changed files with 631 additions and 528 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
src/.DS_Store

View File

@ -1,30 +1,4 @@
/*
- 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
@ -35,11 +9,24 @@
#include "IResponseAnalysis.h"
#include "StrobeAnalysis.h"
#include "ShadowScapesAnalysis.h"
#include "ColorMultiAnalysis.h"
#include "ColorSingleAnalysis.h"
#include "CamFrameRateAnalysis.h"
#include "CamNoiseAnalysis.h"
#include "LatencyTestAnalysis.h"
#include "DiffNoiseAnalysis.h"
#define CAMERA_ID 1
#define CAMERA_ACQU_WIDTH 640
#define CAMERA_ACQU_HEIGHT 480
ofPixels RefractiveIndex::_pixels;
ofVideoGrabber RefractiveIndex::_vidGrabber;
int RefractiveIndex::_vid_w, RefractiveIndex::_vid_h, RefractiveIndex::_vid_id;
bool RefractiveIndex::_vid_stream_open;
bool RefractiveIndex::_vid_toggle_on;
string RefractiveIndex::_location;
void RefractiveIndex::setup()
{
// rate
@ -51,7 +38,7 @@ void RefractiveIndex::setup()
_vid_h = CAMERA_ACQU_HEIGHT;
_vid_id = CAMERA_ID;
_vid_stream_open = false;
//setup_camera();
_vid_toggle_on = false;
// gui
_gui.loadFont("MONACO.TTF", 8);
@ -62,14 +49,18 @@ void RefractiveIndex::setup()
_gui.setWhichPanel(0);
// --> COLUMN #0
_gui.setWhichColumn(0);
_gui.addToggle("open camera", "CAM_IS_GO", 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
@ -78,22 +69,49 @@ void RefractiveIndex::setup()
_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)
//_pixels.allocate(
_location="MIDDLESBOROUGH";
//setup_camera();
}
void RefractiveIndex::update()
{
_gui.update();
RefractiveIndex::_vidGrabber.grabFrame(); // get a new frame from the camera
if (_vidGrabber.isFrameNew())
{
_pixels = _vidGrabber.getPixelsRef(); //get ofPixels from the camera
}
}
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()
@ -107,9 +125,11 @@ void RefractiveIndex::setup_camera()
ofLog(OF_LOG_ERROR) << "RefractiveIndex::setup_camera - could not initialise grabber";
return;
}
_vidGrabber.setDeviceID(_vid_id);
_vidGrabber.listDevices();
_vidGrabber.setVerbose(true);
_vid_stream_open = true;
_vidGrabber.setDeviceID(_vid_id);
}
void RefractiveIndex::keyPressed (int key)
@ -124,10 +144,9 @@ void RefractiveIndex::keyPressed (int key)
delete _analysisAdapator;
_currentAnalysis = NULL;
_analysisAdapator = NULL;
cout << "bingo!\n\n";
cout << "bingo!\n\n"; //bingo means 'stop analysis'?
}
}
}
void RefractiveIndex::mouseDragged(int x, int y, int button)
@ -135,25 +154,57 @@ 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 IResponseAnalysis();
_analysisAdapator = new AnalysisAdaptor(_currentAnalysis);
//_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)

View File

@ -1,30 +1,4 @@
/*
- 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
@ -68,12 +42,18 @@ protected:
// gui
ofxControlPanel _gui;
// acquisition
ofVideoGrabber _vidGrabber;
int _vid_w, _vid_h, _vid_id;
bool _vid_stream_open;
AbstractAnalysis* _currentAnalysis;
AnalysisAdaptor* _analysisAdapator;
public:
// acquisition
static ofPixels _pixels;
static ofVideoGrabber _vidGrabber;
vector<string> videoSourceList;
static int _vid_w, _vid_h, _vid_id;
static bool _vid_stream_open;
static bool _vid_toggle_on;
static string _location;
};

View File

@ -1,5 +1,4 @@
#include "ofAppGlutWindow.h"
#include "testApp.h"
#include "RefractiveIndex.h"
int main() {
@ -7,6 +6,5 @@ int main() {
//window.setGlutDisplayString("rgba double samples >= 8");
ofSetupOpenGL(&window, 1024, 768, OF_WINDOW);
ofRunApp(new RefractiveIndex());
//ofRunApp(new testApp());
}

View File

@ -18,30 +18,38 @@ using Poco::Thread;
void CamFrameRateAnalysis::setup(int camWidth, int camHeight)
{
// HERE IS WHERE WE SETUP THE DIRECTORY FOR ALL THE SAVED IMAGES
// 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 = "";
cout<<"time"<<time<<endl;
ofDirectory dir;
_whole_file_path= string(ANALYSIS_PATH)+RefractiveIndex::_location+"/"+ _name+"/"+time;
//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(_whole_file_path, true,false);
//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 //////////////////////////////////////////////////
_frame_cnt = 0;
_frame_cnt_max = ofGetFrameRate() * ((DELTA_T_SAVE * NUM_SAVE_PER_RUN) / 1000);
c = 0;

View File

@ -18,33 +18,38 @@ using Poco::Thread;
void CamNoiseAnalysis::setup(int camWidth, int camHeight)
{
// HERE IS WHERE WE SETUP THE DIRECTORY FOR ALL THE SAVED IMAGES
// 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 = "";
cout<<"time"<<time<<endl;
//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+"/"+time;
_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(_whole_file_path, true,false);
dir.createDirectory(string(ANALYSIS_PATH)+RefractiveIndex::_location+"/"+ _name+"/"+replaceTime+"/", true,false);
}
else{
cout<<"dir exists"<<endl;
}
//////////////////////////////END DIRECTORY CREATION //////////////////////////////////////////////////
_frame_cnt = 0;
_frame_cnt_max = ofGetFrameRate() * ((DELTA_T_SAVE * NUM_SAVE_PER_RUN) / 1000);

View File

@ -46,28 +46,37 @@ 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 = "";
cout<<"time"<<time<<endl;
//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+"/"+time;
_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(_whole_file_path, true,false);
dir.createDirectory(string(ANALYSIS_PATH)+RefractiveIndex::_location+"/"+ _name+"/"+replaceTime+"/", true,false);
}
//////////////////////////////END DIRECTORY CREATION //////////////////////////////////////////////////
_frame_cnt = 0;
_frame_cnt_max = ofGetFrameRate() * ((DELTA_T_SAVE * NUM_SAVE_PER_RUN) / 1000);

View File

@ -18,30 +18,38 @@ using Poco::Thread;
void ColorSingleAnalysis::setup(int camWidth, int camHeight)
{
// HERE IS WHERE WE SETUP THE DIRECTORY FOR ALL THE SAVED IMAGES
// 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 = "";
cout<<"time"<<time<<endl;
//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+"/"+time;
_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(_whole_file_path, true,false);
dir.createDirectory(string(ANALYSIS_PATH)+RefractiveIndex::_location+"/"+ _name+"/"+replaceTime+"/", true,false);
}
//////////////////////////////END DIRECTORY CREATION //////////////////////////////////////////////////
_frame_cnt = 0;
_frame_cnt_max = ofGetFrameRate() * ((DELTA_T_SAVE * NUM_SAVE_PER_RUN) / 1000);
r = 0;

View File

@ -18,29 +18,38 @@ 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 = "";
cout<<"time"<<time<<endl;
ofDirectory dir;
_whole_file_path= string(ANALYSIS_PATH)+RefractiveIndex::_location+"/"+ _name+"/"+time;
//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(_whole_file_path, true,false);
//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 //////////////////////////////////////////////////
_frame_cnt = 0;
_frame_cnt_max = ofGetFrameRate() * ((DELTA_T_SAVE * NUM_SAVE_PER_RUN) / 1000);
c = 0;

View File

@ -18,30 +18,38 @@ using Poco::Thread;
void IResponseAnalysis::setup(int camWidth, int camHeight)
{
// HERE IS WHERE WE SETUP THE DIRECTORY FOR ALL THE SAVED IMAGES
// 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 = "";
cout<<"time"<<time<<endl;
ofDirectory dir;
_whole_file_path= string(ANALYSIS_PATH)+RefractiveIndex::_location+"/"+ _name+"/"+time;
//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(_whole_file_path, true,false);
//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 //////////////////////////////////////////////////
_frame_cnt = 0;
_frame_cnt_max = ofGetFrameRate() * ((DELTA_T_SAVE * NUM_SAVE_PER_RUN) / 1000);
c = 0;

View File

@ -18,30 +18,38 @@ using Poco::Thread;
void LatencyTestAnalysis::setup(int camWidth, int camHeight)
{
// HERE IS WHERE WE SETUP THE DIRECTORY FOR ALL THE SAVED IMAGES
// 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 = "";
cout<<"time"<<time<<endl;
ofDirectory dir;
_whole_file_path= string(ANALYSIS_PATH)+RefractiveIndex::_location+"/"+ _name+"/"+time;
//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(_whole_file_path, true,false);
//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 //////////////////////////////////////////////////
_frame_cnt = 0;
_frame_cnt_max = ofGetFrameRate() * ((DELTA_T_SAVE * NUM_SAVE_PER_RUN) / 1000);
c = 0;

View File

@ -46,27 +46,38 @@ 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 = "";
cout<<"time"<<time<<endl;
//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+"/"+time;
_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(_whole_file_path, true,false);
dir.createDirectory(string(ANALYSIS_PATH)+RefractiveIndex::_location+"/"+ _name+"/"+replaceTime+"/", true,false);
}
//////////////////////////////END DIRECTORY CREATION //////////////////////////////////////////////////
_speed = 300;
}

View File

@ -45,32 +45,38 @@ using Poco::Thread;
void StrobeAnalysis::setup(int camWidth, int camHeight)
{
//AbstractAnalysis::setup(camWidth, camHeight);
//_lastTime = ofGetElapsedTimeMillis();
// HERE IS WHERE WE SETUP THE DIRECTORY FOR ALL THE SAVED IMAGES
// 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 = "";
cout<<"time"<<time<<endl;
//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+"/"+time;
_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(_whole_file_path, true,false);
dir.createDirectory(string(ANALYSIS_PATH)+RefractiveIndex::_location+"/"+ _name+"/"+replaceTime+"/", true,false);
}
//////////////////////////////END DIRECTORY CREATION //////////////////////////////////////////////////
}
void StrobeAnalysis::synthesize()