added proper looping structure - fixed up some un-initialised variables

the looping structure for RUN_NUM now occurs in AbstractAnalysis, so
that the sequencing is correct - a few related variables were not reset
- so those are fixed now too.
This commit is contained in:
Jamie Allen 2012-02-22 15:36:22 +01:00
parent 24ddd694c7
commit 2f2b38019e
12 changed files with 319 additions and 235 deletions

View File

@ -6,15 +6,22 @@
// this is the main threaded loop for a given analysis
void AbstractAnalysis::do_synthesize() {
_saved_filenames_analysis.clear();
_state = STATE_ACQUIRING;
acquire();
if(_state == STATE_STOP) goto exit;
_state = STATE_SYNTHESISING;
synthesise();
if(_state == STATE_STOP) goto exit;
_state = STATE_DISPLAY_RESULTS;
displayresults();
for(int i = 0; i < NUM_RUN; i++) {
cout << "i NUM_RUN" << i << endl;
_saved_filenames_analysis.clear();
_state = STATE_ACQUIRING;
acquire();
if(_state == STATE_STOP) goto exit;
_state = STATE_SYNTHESISING;
synthesise();
if(_state == STATE_STOP) goto exit;
_state = STATE_DISPLAY_RESULTS;
displayresults();
}
exit:
ofNotifyEvent(_synthesize_cb, _name);
}

View File

@ -59,6 +59,8 @@ protected:
int _state;
//int _run_cnt;
float DELTA_T_SAVE;
int NUM_PHASE;
int NUM_RUN;

View File

@ -13,8 +13,8 @@ using Poco::Thread;
void CamNoiseAnalysis::setup(int camWidth, int camHeight)
{
NUM_RUN = 1;
NUM_RUN = 5;
int acq_run_time = 20; // 20 seconds of acquiring per run
@ -23,16 +23,15 @@ void CamNoiseAnalysis::setup(int camWidth, int camHeight)
_frame_cnt_max = acq_run_time*ofGetFrameRate(); // e.g.: 30 frames per second * 20 seconds = 600 frames
create_dir();
_frame_cnt = 0;
_run_cnt = 0;
c = 0;
int anim_time = 10; // 10 seconds
_anim_cnt_max = anim_time*ofGetFrameRate(); // e.g.: 30 frames per second = 150 frames
create_dir();
//create_dir();
_show_image = false;
_image_shown = false;
@ -64,29 +63,28 @@ void CamNoiseAnalysis::acquire()
{
Timer* save_timer;
TimerCallback<CamNoiseAnalysis> save_callback(*this, &CamNoiseAnalysis::save_cb);
_frame_cnt = 0; _save_cnt = 0; _anim_cnt = 0;
_run_cnt++;
_RUN_DONE = false;
create_dir();
// RUN ROUTINE
for(int i = 0; i < NUM_RUN; i++) {
_run_cnt = i;
//cout << "RUN NUM = " << i;
save_timer = new Timer(0, DELTA_T_SAVE); // timing interval for saving files
save_timer->start(save_callback);
_RUN_DONE = false;
_frame_cnt = 0; _save_cnt = 0; _anim_cnt = 0;
// for(int i = 0; i < NUM_RUN; i++) {
// _run_cnt = i;
//cout << "RUN NUM = " << i;
save_timer = new Timer(0, DELTA_T_SAVE); // timing interval for saving files
save_timer->start(save_callback);
while(!_RUN_DONE && _state != STATE_STOP)
Thread::sleep(3);
save_timer->stop();
_RUN_DONE = false;
}
save_timer->stop();
// }
}
void CamNoiseAnalysis::synthesise()

View File

@ -13,7 +13,7 @@ using Poco::Thread;
void ColorMultiAnalysis::setup(int camWidth, int camHeight)
{
NUM_RUN = 1;
NUM_RUN = 5;
int acq_run_time = 35;
@ -22,19 +22,15 @@ void ColorMultiAnalysis::setup(int camWidth, int camHeight)
_frame_cnt_max = acq_run_time*ofGetFrameRate(); // e.g.: 30 frames per second * 20 seconds = 600 frames
create_dir();
//create_dir();
_frame_cnt = 0;
_run_cnt = 0;
c = 0;
int anim_time = 10; // 10 seconds
_anim_cnt_max = anim_time*ofGetFrameRate(); // e.g.: 30 frames per second = 150 frames
create_dir();
_show_image = false;
_image_shown = false;
//for an ofxOpenCv.h image i would like to use..."
//image3.allocate(RefractiveIndex::_vid_w, RefractiveIndex::_vid_h);
@ -67,29 +63,29 @@ void ColorMultiAnalysis::acquire()
{
Timer* save_timer;
TimerCallback<ColorMultiAnalysis> save_callback(*this, &ColorMultiAnalysis::save_cb);
_run_cnt++;
_frame_cnt = 0; _save_cnt = 0; _anim_cnt = 0;
_RUN_DONE = false;
create_dir();
// RUN ROUTINE
for(int i = 0; i < NUM_RUN; i++) {
//for(int i = 0; i < NUM_RUN; i++) {
_run_cnt = i;
// _run_cnt = i;
//cout << "RUN NUM = " << i;
save_timer = new Timer(0, DELTA_T_SAVE); // timing interval for saving files
save_timer->start(save_callback);
_RUN_DONE = false;
_frame_cnt = 0; _save_cnt = 0; _anim_cnt = 0;
save_timer = new Timer(0, DELTA_T_SAVE); // timing interval for saving files
save_timer->start(save_callback);
while(!_RUN_DONE && _state != STATE_STOP)
Thread::sleep(3);
save_timer->stop();
_RUN_DONE = false;
}
save_timer->stop();
//}
}
void ColorMultiAnalysis::synthesise()

View File

@ -14,7 +14,7 @@ using Poco::Thread;
void ColorSingleAnalysis::setup(int camWidth, int camHeight)
{
NUM_RUN = 1;
NUM_RUN = 5;
int acq_run_time = 25; // 20 seconds of acquiring per run
@ -23,19 +23,15 @@ void ColorSingleAnalysis::setup(int camWidth, int camHeight)
_frame_cnt_max = acq_run_time*ofGetFrameRate(); // e.g.: 30 frames per second * 20 seconds = 600 frames
create_dir();
//create_dir();
_run_cnt = 0;
_frame_cnt = 0;
c = 0;
int anim_time = 10; // 10 seconds
_anim_cnt_max = anim_time*ofGetFrameRate(); // e.g.: 30 frames per second = 150 frames
create_dir();
NUM_RUN = 1;
r = 0;
g = 0;
b = 0;
@ -73,26 +69,27 @@ void ColorSingleAnalysis::acquire()
Timer* save_timer;
TimerCallback<ColorSingleAnalysis> save_callback(*this, &ColorSingleAnalysis::save_cb);
_run_cnt++;
_frame_cnt = 0; _save_cnt = 0; _anim_cnt = 0;
_RUN_DONE = false;
create_dir();
// RUN ROUTINE
for(int i = 0; i < NUM_RUN; i++) {
_run_cnt = i;
//for(int i = 0; i < NUM_RUN; i++) {
// _run_cnt = i;
//cout << "RUN NUM = " << i;
save_timer = new Timer(0, DELTA_T_SAVE); // timing interval for saving files
save_timer->start(save_callback);
_RUN_DONE = false;
save_timer = new Timer(0, DELTA_T_SAVE); // timing interval for saving files
save_timer->start(save_callback);
_frame_cnt = 0; _save_cnt = 0; _anim_cnt = 0;
while(!_RUN_DONE && _state != STATE_STOP)
Thread::sleep(3);
save_timer->stop();
_RUN_DONE = false;
}
save_timer->stop();
// }
}
void ColorSingleAnalysis::synthesise()

View File

@ -14,7 +14,7 @@ using Poco::Thread;
void DiffNoiseAnalysis::setup(int camWidth, int camHeight)
{
NUM_RUN = 1;
NUM_RUN = 5;
int acq_run_time = 20; // 20 seconds of acquiring per run
@ -23,25 +23,21 @@ void DiffNoiseAnalysis::setup(int camWidth, int camHeight)
_frame_cnt_max = acq_run_time*ofGetFrameRate(); // e.g.: 30 frames per second * 20 seconds = 600 frames
create_dir();
//create_dir();
_run_cnt = 0;
_frame_cnt = 0;
c = 0;
int anim_time = 10; // 10 seconds
_anim_cnt_max = anim_time*ofGetFrameRate(); // e.g.: 30 frames per second = 150 frames
create_dir();
_show_image = false;
_image_shown = false;
//for an ofxOpenCv.h image i would like to use..."
//image3.allocate(RefractiveIndex::_vid_w, RefractiveIndex::_vid_h);
_show_image = false;
_image_shown = false;
// images use for drawing the synthesized files to the screen ///
image1.setUseTexture(false); // the non texture image that is needed to first load the image
image2.setUseTexture(true); // the image that needs to get written to the screen which takes the content of image1
@ -68,29 +64,30 @@ void DiffNoiseAnalysis::setup(int camWidth, int camHeight)
void DiffNoiseAnalysis::acquire()
{
Timer* save_timer;
TimerCallback<DiffNoiseAnalysis> save_callback(*this, &DiffNoiseAnalysis::save_cb);
_run_cnt++;
_frame_cnt = 0; _save_cnt = 0; _anim_cnt = 0;
_RUN_DONE = false;
create_dir();
// RUN ROUTINE
for(int i = 0; i < NUM_RUN; i++) {
//for(int i = 0; i < NUM_RUN; i++) {
_run_cnt = i;
//cout << "RUN NUM = " << i;
save_timer = new Timer(0, DELTA_T_SAVE); // timing interval for saving files
save_timer->start(save_callback);
_RUN_DONE = false;
_frame_cnt = 0; _save_cnt = 0; _anim_cnt = 0;
// _run_cnt = i;
//cout << "RUN NUM = " << i;
save_timer = new Timer(0, DELTA_T_SAVE); // timing interval for saving files
save_timer->start(save_callback);
while(!_RUN_DONE && _state != STATE_STOP)
Thread::sleep(3);
save_timer->stop();
}
save_timer->stop();
//}
}
void DiffNoiseAnalysis::synthesise()

View File

@ -13,7 +13,7 @@ using Poco::Thread;
void IResponseAnalysis::setup(int camWidth, int camHeight)
{
NUM_RUN = 1;
NUM_RUN = 5;
int acq_run_time = 20; // 20 seconds of acquiring per run
@ -22,8 +22,9 @@ void IResponseAnalysis::setup(int camWidth, int camHeight)
_frame_cnt_max = acq_run_time*ofGetFrameRate(); // e.g.: 30 frames per second * 20 seconds = 600 frames
create_dir();
//create_dir();
_run_cnt = 0;
_frame_cnt = 0;
c = 0;
@ -61,29 +62,28 @@ void IResponseAnalysis::acquire()
{
Timer* save_timer;
TimerCallback<IResponseAnalysis> save_callback(*this, &IResponseAnalysis::save_cb);
_run_cnt++;
_frame_cnt = 0; _save_cnt = 0; _anim_cnt = 0;
_RUN_DONE = false;
create_dir();
// RUN ROUTINE
for(int i = 0; i < NUM_RUN; i++) {
_run_cnt = i;
//cout << "RUN NUM = " << i;
save_timer = new Timer(0, DELTA_T_SAVE); // timing interval for saving files
save_timer->start(save_callback);
_frame_cnt = 0; _save_cnt = 0; _anim_cnt = 0;
//for(int i = 0; i < NUM_RUN; i++) {
//_run_cnt = i;
//cout << "RUN NUM = " << i;
save_timer = new Timer(0, DELTA_T_SAVE); // timing interval for saving files
save_timer->start(save_callback);
while(!_RUN_DONE && _state != STATE_STOP)
Thread::sleep(3);
save_timer->stop();
_RUN_DONE = false;
}
save_timer->stop();
//}
}
void IResponseAnalysis::synthesise()
@ -309,7 +309,6 @@ void IResponseAnalysis::draw()
{
//cout << "STATE_DISPLAY_RESULTS...\n" << endl;
if (_frame_cnt > 2)
{
_image_shown = true;

View File

@ -13,7 +13,7 @@ using Poco::Thread;
void RelaxRateAnalysis::setup(int camWidth, int camHeight)
{
NUM_RUN = 1;
NUM_RUN = 5;
int acq_run_time = 20; // 20 seconds of acquiring per run
@ -22,8 +22,9 @@ void RelaxRateAnalysis::setup(int camWidth, int camHeight)
_frame_cnt_max = acq_run_time*ofGetFrameRate(); // e.g.: 30 frames per second * 20 seconds = 600 frames
create_dir();
//create_dir();
_run_cnt = 0;
_level = 0;
_flip = 1;
_frame_cnt = 0;
@ -35,78 +36,141 @@ void RelaxRateAnalysis::setup(int camWidth, int camHeight)
_show_image = false;
_image_shown = false;
//for an ofxOpenCv.h image i would like to use..."
//image3.allocate(RefractiveIndex::_vid_w, RefractiveIndex::_vid_h);
// images use for drawing the synthesized files to the screen ///
image1.setUseTexture(false); // the non texture image that is needed to first load the image
image2.setUseTexture(true); // the image that needs to get written to the screen which takes the content of image1
// images used for re-loading and saving out the synthesized files ///
image3.setUseTexture(false);
image4.setUseTexture(false);
image5.setUseTexture(false);
//cout << "RefractiveIndex::_vid_w " << RefractiveIndex::_vid_w << endl;
//cout << "RefractiveIndex::_vid_h " << RefractiveIndex::_vid_h << endl;
cvColorImage1.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h);
cvGrayImage1.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h);
cvGrayDiff1.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h);
cvColorImage2.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h);
cvGrayImage2.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h);
cvGrayDiff2.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h);
image1.setUseTexture(false);
image2.setUseTexture(true);
}
void RelaxRateAnalysis::acquire()
{
Timer* save_timer;
TimerCallback<RelaxRateAnalysis> save_callback(*this, &RelaxRateAnalysis::save_cb);
_run_cnt++;
_frame_cnt = 0; _save_cnt = 0; _anim_cnt = 0;
_RUN_DONE = false;
create_dir();
// RUN ROUTINE
for(int i = 0; i < NUM_RUN; i++) {
_run_cnt = i;
//cout << "RUN NUM = " << i;
save_timer = new Timer(0, DELTA_T_SAVE); // timing interval for saving files
save_timer->start(save_callback);
_RUN_DONE = false;
_frame_cnt = 0; _save_cnt = 0; _anim_cnt = 0;
//for(int i = 0; i < NUM_RUN; i++) {
//_run_cnt = i;
//cout << "RUN NUM = " << i;
save_timer = new Timer(0, DELTA_T_SAVE); // timing interval for saving files
save_timer->start(save_callback);
while(!_RUN_DONE && _state != STATE_STOP)
Thread::sleep(3);
save_timer->stop();
save_timer->stop();
_RUN_DONE = false;
}
}
void RelaxRateAnalysis::synthesise()
{
// _saved_filenames_analysis has all the file names of all the saved images
while(!_RUN_DONE && _state != STATE_STOP)
Thread::sleep(3);
}
void RelaxRateAnalysis::displayresults()
{
//cout << "IResponseAnalysis::saving synthesis...\n";
if(_state == STATE_STOP) return;
for(float i=1;i<_saved_filenames_analysis.size();i++){
for(float i=1;i<_saved_filenames_analysis.size()-1;i++){
//cout << "IResponseAnalysis::synthesis FOR LOOP...\n";
//cout << "_saved_filenames_analysis[i]" << _saved_filenames_analysis[i] << endl;
if(_state == STATE_STOP) return;
// cout << "_saved_filenames_analysis[i]" << _saved_filenames_analysis[i] << endl;
while(!_image_shown){
Thread::sleep(2);
//cout << "!_image_shown" << endl;
}
if(!image1.loadImage(_saved_filenames_analysis[i])){
//couldn't load image
cout << "didn't load image" << endl;
}
if(image1.loadImage(_saved_filenames_analysis[i])){
image1.loadImage(_saved_filenames_analysis[i]);
//cout << "LOADED image1!!!" << endl;
if(image5.loadImage(_saved_filenames_analysis[i+1])){
///////////////////////// PROCESS THE SAVED CAMERA IMAGES OF SHIT TO THE IMAGES //////////////////////////
cvColorImage1.setFromPixels(image1.getPixels(), image1.width, image1.height);
cvColorImage2.setFromPixels(image5.getPixels(), image5.width, image5.height);
cvGrayImage1 = cvColorImage1;
cvGrayImage2 = cvColorImage2;
//cvGrayDiff1.absDiff(cvGrayImage2, cvGrayImage1);
cvGrayDiff1.erode();
cvGrayDiff1.contrastStretch();
cvGrayDiff1.blur(5);
//cvGrayDiff1.dilate();
//cvGrayDiff1.contrastStretch();
/////////////////////////////////// SAVE TO DISK IN THE SYNTHESIS FOLDER ////////////////////////////////
string file_name;
file_name = ofToString(_synth_save_cnt, 2)+"_RelaxRateAnalysis_"+ofToString(_run_cnt,2)+".jpg";
//image4.setFromPixels(cvColorImage1.getPixelsRef(),image3.width, image3.height, OF_IMAGE_COLOR);
ofSaveImage(cvGrayDiff1.getPixelsRef(),_whole_file_path_synthesis+"/"+file_name, OF_IMAGE_QUALITY_BEST);
_saved_filenames_synthesis.push_back(_whole_file_path_synthesis+"/"+file_name);
_synth_save_cnt++;
}
}
}
// _saved_filenames_synthesis has processed all the files in the analysis images folder
while(!_RUN_DONE && _state != STATE_STOP)
Thread::sleep(3);
}
void RelaxRateAnalysis::displayresults()
{
for(float i=1;i<_saved_filenames_synthesis.size();i++){
if(_state == STATE_STOP) return;
//cout << "_saved_filenames_analysis[i] - " << _saved_filenames_synthesis[i] << endl;
while(!_image_shown){
Thread::sleep(2);
//cout << "!_image_shown" << endl;
}
if(!image3.loadImage(_saved_filenames_synthesis[i])){
//couldn't load image
// cout << "didn't load image" << endl;
}
if(image3.loadImage(_saved_filenames_synthesis[i])){
image3.loadImage(_saved_filenames_synthesis[i]);
//cout << "_show_image = true;" << endl;
_show_image = true;
_image_shown = false;
}
}
}
@ -250,11 +314,12 @@ void RelaxRateAnalysis::draw()
if (_show_image)
{
//cout << "_show_image...\n" << endl;
ofEnableAlphaBlending();
ofSetColor(255, 255, 255, 255);
image2.setFromPixels(image1.getPixels(),image1.width,image1.height, OF_IMAGE_COLOR);
ofSetColor(255, 255, 255);
image2.setFromPixels(image3.getPixels(),image3.width,image3.height, OF_IMAGE_GRAYSCALE);
image2.draw(0,0, ofGetWidth(), ofGetHeight());
ofDisableAlphaBlending();
@ -263,6 +328,7 @@ void RelaxRateAnalysis::draw()
// display results of the synthesis
_RUN_DONE = true;
break;
}
default:

View File

@ -28,11 +28,32 @@ protected:
bool _RUN_DONE;
float _flip, _level;
int _run_cnt, _save_cnt, _anim_cnt;
int _run_cnt, _save_cnt, _synth_save_cnt, _anim_cnt;
float c, _frame_cnt, _frame_cnt_max, _anim_cnt_max;
bool _show_image, _image_shown;
ofImage image1;
ofImage image2;
ofImage image1;
ofImage image2;
ofImage image3;
ofImage image4;
ofImage image5;
ofImage image6;
ofxCvColorImage cvColorImage1;
ofxCvColorImage cvColorImage2;
ofxCvColorImage cvColorImage3;
ofxCvColorImage cvColorImage4;
ofxCvColorImage cvColorImage5;
ofxCvColorImage cvColorImage6;
ofxCvGrayscaleImage cvGrayDiff1;
ofxCvGrayscaleImage cvGrayDiff2;
ofxCvGrayscaleImage cvGrayImage1;
ofxCvGrayscaleImage cvGrayImage2;
ofxCvGrayscaleImage cvGrayImage3;
ofxCvGrayscaleImage cvGrayImage4;
ofxCvContourFinder cvContourFinder1;
};

View File

@ -16,7 +16,7 @@ using Poco::Thread;
void ShadowScapesAnalysis::setup(int camWidth, int camHeight)
{
NUM_RUN = 1;
NUM_RUN = 5;
int acq_run_time = 15; // 10 seconds of acquiring per run
@ -33,7 +33,7 @@ void ShadowScapesAnalysis::setup(int camWidth, int camHeight)
DELTA_T_SAVE = 3*(10*acq_run_time/2); // for 20 seconds, we want this to be around 100 files
// or 5 times per second = every 200 ms
create_dir(); // this makes both synth and analysis folder structures
//create_dir(); // this makes both synth and analysis folder structures
_scanLineWidth = 100.0;
_run_cnt = 0;
@ -65,31 +65,31 @@ void ShadowScapesAnalysis::setup(int camWidth, int camHeight)
cvColorImage2.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h);
cvGrayImage2.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h);
cvGrayDiff2.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h);
}
void ShadowScapesAnalysis::acquire()
{
_line = 0;
Timer save_timer(0, DELTA_T_SAVE);
TimerCallback<ShadowScapesAnalysis> save_callback(*this, &ShadowScapesAnalysis::save_cb);
// RUN ROUTINE
for(int i = 0; i < NUM_RUN; i++) {
Timer save_timer(0, DELTA_T_SAVE);
TimerCallback<ShadowScapesAnalysis> save_callback(*this, &ShadowScapesAnalysis::save_cb);
_RUN_DONE = false;
_frame_cnt = 0; _save_cnt = 0; _anim_cnt = 0;
save_timer.start(save_callback);
_run_cnt++;
_frame_cnt = 0; _save_cnt = 0; _anim_cnt = 0;
_line = 0;
_RUN_DONE = false;
create_dir();
//cout << "RUN NUM = " << i;
save_timer.start(save_callback);
while(!_RUN_DONE && _state != STATE_STOP)
Thread::sleep(3);
save_timer.stop();
_RUN_DONE = false;
}
save_timer.stop();
//}
}

View File

@ -12,7 +12,7 @@ using Poco::Thread;
void ShapeFromShadingAnalysis::setup(int camWidth, int camHeight)
{
NUM_RUN = 1;
NUM_RUN = 5;
int acq_run_time = 20; // 20 seconds of acquiring per run
@ -21,8 +21,8 @@ void ShapeFromShadingAnalysis::setup(int camWidth, int camHeight)
_frame_cnt_max = acq_run_time*ofGetFrameRate(); // e.g.: 30 frames per second * 20 seconds = 600 frames
create_dir();
//create_dir();
_run_cnt = 0;
_frame_cnt = 0;
c = 0;
@ -61,47 +61,48 @@ void ShapeFromShadingAnalysis::acquire()
{
Timer* save_timer;
TimerCallback<ShapeFromShadingAnalysis> save_callback(*this, &ShapeFromShadingAnalysis::save_cb);
_run_cnt++;
_frame_cnt = 0; _save_cnt = 0; _anim_cnt = 0;
_RUN_DONE = false;
create_dir();
_animation_cnt1 = 0;
_animation_cnt2 = 0;
_animation_cnt3 = 0;
_animation_cnt4 = 0;
_animation_cnt5 = 0;
_animation_cnt6 = 0;
_animation_cnt7 = 0;
_animation_cnt8 = 0;
_animation_cnt9 = 0;
_animation_cnt10 = 0;
_animation_cnt11 = 0;
_animation_cnt12 = 0;
_animation_cnt13 = 0;
_animation_cnt14 = 0;
_animation_cnt15 = 0;
_animation_cnt16 = 0;
_animation_reset = false; // coundn't get this to work - so using seperate counters - shitty!
// RUN ROUTINE
for(int i = 0; i < NUM_RUN; i++) {
//for(int i = 0; i < NUM_RUN; i++) {
_run_cnt = i;
// _run_cnt = i;
//cout << "RUN NUM = " << i;
save_timer = new Timer(0, DELTA_T_SAVE); // timing interval for saving files
save_timer->start(save_callback);
_RUN_DONE = false;
_frame_cnt = 0; _save_cnt = 0; _anim_cnt = 0;
_animation_cnt1 = 0;
_animation_cnt2 = 0;
_animation_cnt3 = 0;
_animation_cnt4 = 0;
_animation_cnt5 = 0;
_animation_cnt6 = 0;
_animation_cnt7 = 0;
_animation_cnt8 = 0;
_animation_cnt9 = 0;
_animation_cnt10 = 0;
_animation_cnt11 = 0;
_animation_cnt12 = 0;
_animation_cnt13 = 0;
_animation_cnt14 = 0;
_animation_cnt15 = 0;
_animation_cnt16 = 0;
_animation_reset = false; // coundn't get this to work - so using seperate counters - shitty!
save_timer = new Timer(0, DELTA_T_SAVE); // timing interval for saving files
save_timer->start(save_callback);
while(!_RUN_DONE && _state != STATE_STOP)
Thread::sleep(3);
save_timer->stop();
_RUN_DONE = false;
}
save_timer->stop();
// }
}
void ShapeFromShadingAnalysis::synthesise()

View File

@ -12,7 +12,7 @@ using Poco::Thread;
void StrobeAnalysis::setup(int camWidth, int camHeight)
{
NUM_RUN = 1;
NUM_RUN = 5;
int acq_run_time = 25; // 20 seconds of acquiring per run
@ -25,12 +25,13 @@ void StrobeAnalysis::setup(int camWidth, int camHeight)
// The British Health and Safety Executive recommend that a net flash rate for a bank of strobe lights does not exceed 5 flashes per second, at which only 5% of photosensitive epileptics are at risk. It also recommends that no strobing effect continue for more than 30 seconds, due to the potential for discomfort and disorientation.
create_dir();
//create_dir();
_run_cnt = 0;
int anim_time = 5; // 5 seconds for the animation
_anim_cnt_max = anim_time*ofGetFrameRate(); // e.g.: 30 frames per second = 150 frames
_show_image = false;
_image_shown = false;
@ -61,31 +62,30 @@ void StrobeAnalysis::acquire()
{
Timer* save_timer;
TimerCallback<StrobeAnalysis> save_callback(*this, &StrobeAnalysis::save_cb);
_frame_cnt = 0; _save_cnt = 0; _anim_cnt = 0; _strobe_cnt = 0;
_run_cnt++;
_RUN_DONE = false;
create_dir();
// RUN ROUTINE
for(int i = 0; i < NUM_RUN; i++) {
//for(int i = 0; i < NUM_RUN; i++) {
_run_cnt = i;
_save_cnt = 0;
_frame_cnt = 0;
//cout << "RUN NUM = " << i;
save_timer = new Timer(0, DELTA_T_SAVE); // timing interval for saving files
save_timer->start(save_callback);
_RUN_DONE = false;
_frame_cnt = 0; _save_cnt = 0; _anim_cnt = 0; _strobe_cnt = 0;
//_run_cnt = i;
//cout << "RUN NUM = " << i;
save_timer = new Timer(0, DELTA_T_SAVE); // timing interval for saving files
save_timer->start(save_callback);
while(!_RUN_DONE && _state != STATE_STOP)
Thread::sleep(3);
save_timer->stop();
_RUN_DONE = false;
}
save_timer->stop();
//}
}
void StrobeAnalysis::synthesise()