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:
parent
24ddd694c7
commit
2f2b38019e
@ -6,6 +6,11 @@
|
||||
|
||||
// this is the main threaded loop for a given analysis
|
||||
void AbstractAnalysis::do_synthesize() {
|
||||
|
||||
for(int i = 0; i < NUM_RUN; i++) {
|
||||
|
||||
cout << "i NUM_RUN" << i << endl;
|
||||
|
||||
_saved_filenames_analysis.clear();
|
||||
_state = STATE_ACQUIRING;
|
||||
acquire();
|
||||
@ -15,6 +20,8 @@ void AbstractAnalysis::do_synthesize() {
|
||||
if(_state == STATE_STOP) goto exit;
|
||||
_state = STATE_DISPLAY_RESULTS;
|
||||
displayresults();
|
||||
}
|
||||
|
||||
exit:
|
||||
ofNotifyEvent(_synthesize_cb, _name);
|
||||
}
|
||||
|
||||
@ -59,6 +59,8 @@ protected:
|
||||
|
||||
int _state;
|
||||
|
||||
//int _run_cnt;
|
||||
|
||||
float DELTA_T_SAVE;
|
||||
int NUM_PHASE;
|
||||
int NUM_RUN;
|
||||
|
||||
@ -14,7 +14,7 @@ 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;
|
||||
|
||||
// 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;
|
||||
|
||||
while(!_RUN_DONE && _state != STATE_STOP)
|
||||
Thread::sleep(3);
|
||||
|
||||
save_timer->stop();
|
||||
|
||||
_RUN_DONE = false;
|
||||
}
|
||||
|
||||
// }
|
||||
}
|
||||
|
||||
void CamNoiseAnalysis::synthesise()
|
||||
|
||||
@ -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 ROUTINE
|
||||
for(int i = 0; i < NUM_RUN; i++) {
|
||||
_run_cnt++;
|
||||
_frame_cnt = 0; _save_cnt = 0; _anim_cnt = 0;
|
||||
_RUN_DONE = false;
|
||||
create_dir();
|
||||
|
||||
_run_cnt = i;
|
||||
// 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;
|
||||
|
||||
while(!_RUN_DONE && _state != STATE_STOP)
|
||||
Thread::sleep(3);
|
||||
|
||||
save_timer->stop();
|
||||
_RUN_DONE = false;
|
||||
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
void ColorMultiAnalysis::synthesise()
|
||||
|
||||
@ -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;
|
||||
@ -74,25 +70,26 @@ void ColorSingleAnalysis::acquire()
|
||||
|
||||
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;
|
||||
|
||||
_frame_cnt = 0; _save_cnt = 0; _anim_cnt = 0;
|
||||
|
||||
while(!_RUN_DONE && _state != STATE_STOP)
|
||||
Thread::sleep(3);
|
||||
|
||||
save_timer->stop();
|
||||
_RUN_DONE = false;
|
||||
}
|
||||
|
||||
|
||||
// }
|
||||
}
|
||||
|
||||
void ColorSingleAnalysis::synthesise()
|
||||
|
||||
@ -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++) {
|
||||
|
||||
_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;
|
||||
|
||||
_frame_cnt = 0; _save_cnt = 0; _anim_cnt = 0;
|
||||
save_timer->start(save_callback);
|
||||
|
||||
while(!_RUN_DONE && _state != STATE_STOP)
|
||||
Thread::sleep(3);
|
||||
|
||||
save_timer->stop();
|
||||
}
|
||||
|
||||
//}
|
||||
}
|
||||
|
||||
void DiffNoiseAnalysis::synthesise()
|
||||
|
||||
@ -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;
|
||||
|
||||
//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;
|
||||
save_timer->start(save_callback);
|
||||
|
||||
while(!_RUN_DONE && _state != STATE_STOP)
|
||||
Thread::sleep(3);
|
||||
|
||||
save_timer->stop();
|
||||
|
||||
_RUN_DONE = false;
|
||||
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
void IResponseAnalysis::synthesise()
|
||||
@ -309,7 +309,6 @@ void IResponseAnalysis::draw()
|
||||
{
|
||||
//cout << "STATE_DISPLAY_RESULTS...\n" << endl;
|
||||
|
||||
|
||||
if (_frame_cnt > 2)
|
||||
{
|
||||
_image_shown = true;
|
||||
|
||||
@ -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,45 +36,108 @@ 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;
|
||||
|
||||
//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;
|
||||
|
||||
while(!_RUN_DONE && _state != STATE_STOP)
|
||||
Thread::sleep(3);
|
||||
|
||||
save_timer->stop();
|
||||
|
||||
_RUN_DONE = false;
|
||||
}
|
||||
}
|
||||
|
||||
void RelaxRateAnalysis::synthesise()
|
||||
{
|
||||
//cout << "IResponseAnalysis::saving synthesis...\n";
|
||||
if(_state == STATE_STOP) return;
|
||||
|
||||
// _saved_filenames_analysis has all the file names of all the saved images
|
||||
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;
|
||||
|
||||
if(!image1.loadImage(_saved_filenames_analysis[i])){
|
||||
//couldn't load image
|
||||
cout << "didn't load image" << endl;
|
||||
}
|
||||
|
||||
if(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);
|
||||
|
||||
@ -82,31 +146,31 @@ void RelaxRateAnalysis::synthesise()
|
||||
void RelaxRateAnalysis::displayresults()
|
||||
{
|
||||
|
||||
for(float i=1;i<_saved_filenames_analysis.size();i++){
|
||||
for(float i=1;i<_saved_filenames_synthesis.size();i++){
|
||||
|
||||
if(_state == STATE_STOP) return;
|
||||
|
||||
// cout << "_saved_filenames_analysis[i]" << _saved_filenames_analysis[i] << endl;
|
||||
//cout << "_saved_filenames_analysis[i] - " << _saved_filenames_synthesis[i] << endl;
|
||||
|
||||
while(!_image_shown){
|
||||
Thread::sleep(2);
|
||||
//cout << "!_image_shown" << endl;
|
||||
}
|
||||
|
||||
|
||||
if(!image1.loadImage(_saved_filenames_analysis[i])){
|
||||
if(!image3.loadImage(_saved_filenames_synthesis[i])){
|
||||
//couldn't load image
|
||||
cout << "didn't load image" << endl;
|
||||
// cout << "didn't load image" << endl;
|
||||
}
|
||||
|
||||
|
||||
if(image1.loadImage(_saved_filenames_analysis[i])){
|
||||
image1.loadImage(_saved_filenames_analysis[i]);
|
||||
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:
|
||||
|
||||
@ -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 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;
|
||||
|
||||
};
|
||||
|
||||
@ -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,21 +65,22 @@ 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;
|
||||
|
||||
// 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;
|
||||
_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);
|
||||
|
||||
@ -88,8 +89,7 @@ void ShadowScapesAnalysis::acquire()
|
||||
|
||||
save_timer.stop();
|
||||
|
||||
_RUN_DONE = false;
|
||||
}
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -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,20 +61,12 @@ void ShapeFromShadingAnalysis::acquire()
|
||||
{
|
||||
|
||||
Timer* save_timer;
|
||||
|
||||
TimerCallback<ShapeFromShadingAnalysis> save_callback(*this, &ShapeFromShadingAnalysis::save_cb);
|
||||
|
||||
// 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;
|
||||
_run_cnt++;
|
||||
_frame_cnt = 0; _save_cnt = 0; _anim_cnt = 0;
|
||||
_RUN_DONE = false;
|
||||
create_dir();
|
||||
|
||||
_animation_cnt1 = 0;
|
||||
_animation_cnt2 = 0;
|
||||
@ -94,14 +86,23 @@ void ShapeFromShadingAnalysis::acquire()
|
||||
_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++) {
|
||||
|
||||
// _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;
|
||||
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
void ShapeFromShadingAnalysis::synthesise()
|
||||
|
||||
@ -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);
|
||||
|
||||
// RUN ROUTINE
|
||||
for(int i = 0; i < NUM_RUN; i++) {
|
||||
_frame_cnt = 0; _save_cnt = 0; _anim_cnt = 0; _strobe_cnt = 0;
|
||||
_run_cnt++;
|
||||
_RUN_DONE = false;
|
||||
create_dir();
|
||||
|
||||
_run_cnt = i;
|
||||
_save_cnt = 0;
|
||||
_frame_cnt = 0;
|
||||
// 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; _strobe_cnt = 0;
|
||||
|
||||
while(!_RUN_DONE && _state != STATE_STOP)
|
||||
Thread::sleep(3);
|
||||
|
||||
save_timer->stop();
|
||||
|
||||
_RUN_DONE = false;
|
||||
}
|
||||
|
||||
//}
|
||||
}
|
||||
|
||||
void StrobeAnalysis::synthesise()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user