tried to add a keypress function - got almost there... need to figure out how to turn off the Analyses from RefractiveIndex.cpp... without blocking

This commit is contained in:
Jamie Allen 2012-02-19 23:34:48 +01:00
parent d536774cc8
commit f2593aed49
7 changed files with 96 additions and 14 deletions

View File

@ -71,6 +71,7 @@ void RefractiveIndex::setup()
// display
cout << "> display" << endl;
ofSetFrameRate(fps);
if(fps > 30) {
ofSetVerticalSync(FALSE);
} else {
@ -228,6 +229,85 @@ void RefractiveIndex::keyPressed (int key)
{
if( key =='f')
ofToggleFullscreen();
/* TODO: complete the below... would be good to trigger the Analysis from keypresses if needed... */
// currently this doesn't work... the save_cb's in the individual
// tried to add a stop_analysis(); call but it blocks the whole programme
// i.e.: ask david how to shut off the prior Analysis if it's not finished running from here?
/*
if(key == '1')
{
// something needs to go here to cancel the prior analysis
_currentAnalysis = _analysisVector.at(0);
_state = ISTATE_START;
}
if(key == '2')
{
// something needs to go here to cancel the prior analysis
_currentAnalysis = _analysisVector.at(1);
_state = ISTATE_START;
}
if(key == '3')
{
// something needs to go here to cancel the prior analysis
_currentAnalysis = _analysisVector.at(2);
_state = ISTATE_START;
}
if(key == '4')
{
// something needs to go here to cancel the prior analysis
_currentAnalysis = _analysisVector.at(3);
_state = ISTATE_START;
}
if(key == '5')
{
// something needs to go here to cancel the prior analysis
_currentAnalysis = _analysisVector.at(4);
_state = ISTATE_START;
}
if(key == '6')
{
// something needs to go here to cancel the prior analysis
_currentAnalysis = _analysisVector.at(5);
_state = ISTATE_START;
}
if(key == '7')
{
// something needs to go here to cancel the prior analysis
_currentAnalysis = _analysisVector.at(6);
_state = ISTATE_START;
}
if(key == '8')
{
// something needs to go here to cancel the prior analysis
_currentAnalysis = _analysisVector.at(7);
_state = ISTATE_START;
}
if(key == '9')
{
// something needs to go here to cancel the prior analysis
_currentAnalysis = _analysisVector.at(8);
_state = ISTATE_START;
}
*/
}
void RefractiveIndex::exit()

View File

@ -18,7 +18,7 @@ using Poco::Thread;
void CamNoiseAnalysis::setup(int camWidth, int camHeight)
{
DELTA_T_SAVE = 200;
DELTA_T_SAVE = 200;
NUM_PHASE = 1;
NUM_RUN = 1;
NUM_SAVE_PER_RUN = 100;
@ -153,7 +153,7 @@ void CamNoiseAnalysis::save_cb(Timer& timer)
_save_cnt++;
cout << "ColorSingleAnalysis::saving...\n";
cout << "CamNoiseAnalysis::saving...\n";
string file_name = ofToString(_save_cnt,2)+"_"+ ofToString(c,2)+"_"+ofToString(_run_cnt,2)+".jpg";

View File

@ -18,7 +18,7 @@ using Poco::Thread;
void ColorSingleAnalysis::setup(int camWidth, int camHeight)
{
DELTA_T_SAVE = 300;
DELTA_T_SAVE = 300; //300 is the right number here
NUM_PHASE = 1;
NUM_RUN = 1;
NUM_SAVE_PER_RUN = 100;

View File

@ -18,9 +18,9 @@ using Poco::Thread;
void RelaxRateAnalysis::setup(int camWidth, int camHeight)
{
DELTA_T_SAVE = 300;
DELTA_T_SAVE = 100; //300 is the correct number
NUM_PHASE = 1;
NUM_RUN = 3;
NUM_RUN = 1;
NUM_SAVE_PER_RUN = 100;
create_dir();
@ -98,7 +98,7 @@ void RelaxRateAnalysis::draw()
}
_frame_cnt++;
cout << "_frame_cnt:" << _frame_cnt << endl;
//cout << "_frame_cnt:" << _frame_cnt << endl;
break;
}

View File

@ -46,13 +46,15 @@ using Poco::Thread;
void ShadowScapesAnalysis::setup(int camWidth, int camHeight)
{
DELTA_T_SAVE = 100;
NUM_PHASE = 1;
NUM_RUN = 1;
NUM_SAVE_PER_RUN = 100;
create_dir();
_speed = 900.0; // 900.0 is the correct number
_speed = 100.0; // 900.0 is the correct number
_scanLineWidth = 100.0;
_run_cnt = 0;
_save_cnt = 0;
@ -60,12 +62,12 @@ void ShadowScapesAnalysis::setup(int camWidth, int camHeight)
void ShadowScapesAnalysis::acquire()
{
int w;
if (_dir == V) w = ofGetHeight();
if (_dir == H) w = ofGetWidth();
if (_dir == D) w = ofGetHeight();
int screenSpan;
if (_dir == V) screenSpan = ofGetHeight();
if (_dir == H) screenSpan = ofGetWidth();
if (_dir == D) screenSpan = ofGetHeight();
_step = ((w/_speed) * 1000.0) / 500.0;
_step = ((screenSpan/_speed) * 1000.0) / 500.0;
_line = 0;
// RUN ROUTINE

View File

@ -18,7 +18,7 @@ using Poco::Thread;
void ShapeFromShadingAnalysis::setup(int camWidth, int camHeight)
{
DELTA_T_SAVE = 300;
DELTA_T_SAVE = 300; //300 is about the right number
NUM_PHASE = 1;
NUM_RUN = 1;
NUM_SAVE_PER_RUN = 100;

View File

@ -48,7 +48,7 @@ void StrobeAnalysis::acquire()
_save_cnt = 0;
_frame_cnt = 0;
cout << "RUN NUM = " << i;
//cout << "RUN NUM = " << i;
save_timer = new Timer(0, DELTA_T_SAVE); // timing interval for saving files
save_timer->start(save_callback);