cleaned up the save_cb on all analyses

This commit is contained in:
Jamie Allen 2012-02-19 21:45:28 +01:00
parent 88fa037593
commit 85ce9c2e67
9 changed files with 51 additions and 55 deletions

View File

@ -152,14 +152,13 @@ void CamNoiseAnalysis::save_cb(Timer& timer)
{ {
_save_cnt++; _save_cnt++;
string file_name = ofToString(_save_cnt,2)+"_"+ ofToString(c,2)+"_"+ofToString(_run_cnt,2)+".jpg"; cout << "ColorSingleAnalysis::saving...\n";
string thisLocation = RefractiveIndex::_location;
string file = _whole_file_path+"/"+file_name; string file_name = ofToString(_save_cnt,2)+"_"+ ofToString(c,2)+"_"+ofToString(_run_cnt,2)+".jpg";
ofSaveImage(RefractiveIndex::_pixels, _whole_file_path+"/"+file_name, OF_IMAGE_QUALITY_BEST); ofSaveImage(RefractiveIndex::_pixels, _whole_file_path+"/"+file_name, OF_IMAGE_QUALITY_BEST);
_saved_filenames.push_back(file); _saved_filenames.push_back(_whole_file_path+"/"+file_name);
//if(_save_cnt >= NUM_SAVE_PER_RUN) //if(_save_cnt >= NUM_SAVE_PER_RUN)
// _RUN_DONE = true; // _RUN_DONE = true;

View File

@ -176,16 +176,14 @@ void ColorMultiAnalysis::save_cb(Timer& timer)
{ {
_save_cnt++; _save_cnt++;
// UPDATE THE COLOR ON THE SCREEN cout << "ColorMultiAnalysis::saving...\n";
//float c_last = c;
// cout << "COLORMULTIANALYSIS::saving...\n";
// cout << "c_last... " << c << endl;
string file_name = ofToString(_save_cnt,2)+"_"+ofToString(c,2)+"_"+ofToString(_run_cnt,2)+".jpg"; string file_name = ofToString(_save_cnt,2)+"_"+ofToString(c,2)+"_"+ofToString(_run_cnt,2)+".jpg";
// cout<<_whole_file_path<<endl;
ofSaveImage(RefractiveIndex::_pixels, _whole_file_path+"/"+file_name, OF_IMAGE_QUALITY_BEST); ofSaveImage(RefractiveIndex::_pixels, _whole_file_path+"/"+file_name, OF_IMAGE_QUALITY_BEST);
_saved_filenames.push_back(_whole_file_path+"/"+file_name);
//if(_save_cnt >= NUM_SAVE_PER_RUN){ //if(_save_cnt >= NUM_SAVE_PER_RUN){
// _RUN_DONE = true; // _RUN_DONE = true;
//} //}

View File

@ -156,13 +156,13 @@ void ColorSingleAnalysis::save_cb(Timer& timer)
{ {
_save_cnt++; _save_cnt++;
// cout << "ColorSingleAnalysis::saving...\n"; cout << "ColorSingleAnalysis::saving...\n";
string file_name =ofToString(_save_cnt,2)+"_"+fileNameTag+"_"+ofToString(_run_cnt,2)+".jpg"; string file_name =ofToString(_save_cnt,2)+"_"+fileNameTag+"_"+ofToString(_run_cnt,2)+".jpg";
ofSaveImage(RefractiveIndex::_pixels, _whole_file_path+"/"+file_name, OF_IMAGE_QUALITY_BEST); ofSaveImage(RefractiveIndex::_pixels, _whole_file_path+"/"+file_name, OF_IMAGE_QUALITY_BEST);
//cout<<_whole_file_path+"/"+file_name<<endl; _saved_filenames.push_back(_whole_file_path+"/"+file_name);
//if(_save_cnt >= NUM_SAVE_PER_RUN) //if(_save_cnt >= NUM_SAVE_PER_RUN)
// _RUN_DONE = true; // _RUN_DONE = true;

View File

@ -167,30 +167,16 @@ void DiffNoiseAnalysis::draw()
// this runs at save_cb timer rate = DELTA_T_SAVE // this runs at save_cb timer rate = DELTA_T_SAVE
void DiffNoiseAnalysis::save_cb(Timer& timer) void DiffNoiseAnalysis::save_cb(Timer& timer)
{ {
_save_cnt++;
float rand10 = ofRandom(0,10);
if (rand10 > 5.0) {
cout << "DiffNoiseAnalysis::saving...\n"; cout << "DiffNoiseAnalysis::saving...\n";
cout << "c_last... " << c << endl;
cout<<"rand10... " <<rand10<<endl;
string file_name = ofToString(_save_cnt,2)+"_"+ ofToString(c,2)+"_"+ofToString(_run_cnt,2)+".jpg"; string file_name = ofToString(_save_cnt,2)+"_"+ ofToString(c,2)+"_"+ofToString(_run_cnt,2)+".jpg";
string thisLocation = RefractiveIndex::_location;
//RefractiveIndex::_pixels = RefractiveIndex::_vidGrabber.getPixelsRef(); //get ofPixels from the camera
// fileName = imageSaveFolderPath+whichAnalysis+"_"+ofToString(100.0*i*scanLineSpeed/ofGetHeight(),2)+"%_"+ofToString(i)+".jpg";
//ofSaveImage(vectorOfPixels[i], fileName, OF_IMAGE_QUALITY_BEST);
string file = _whole_file_path+"/"+file_name;
ofSaveImage(RefractiveIndex::_pixels, _whole_file_path+"/"+file_name, OF_IMAGE_QUALITY_BEST); ofSaveImage(RefractiveIndex::_pixels, _whole_file_path+"/"+file_name, OF_IMAGE_QUALITY_BEST);
_saved_filenames.push_back(file); _saved_filenames.push_back(_whole_file_path+"/"+file_name);
}
_save_cnt++; _save_cnt++;
//if(_save_cnt >= NUM_SAVE_PER_RUN) //if(_save_cnt >= NUM_SAVE_PER_RUN)
// _RUN_DONE = true; // _RUN_DONE = true;

View File

@ -110,19 +110,17 @@ void IResponseAnalysis::draw()
// this runs at save_cb timer rate = DELTA_T_SAVE // this runs at save_cb timer rate = DELTA_T_SAVE
void IResponseAnalysis::save_cb(Timer& timer) void IResponseAnalysis::save_cb(Timer& timer)
{ {
_save_cnt++; _save_cnt++;
cout << "IResponseAnalysis::saving...\n"; cout << "IResponseAnalysis::saving...\n";
//cout << "c_last... " << c << endl;
string file_name = ofToString(_save_cnt,2)+"_"+ ofToString(c,2)+"_"+ofToString(_run_cnt,2)+".jpg";
string thisLocation = RefractiveIndex::_location;
//RefractiveIndex::_pixels = RefractiveIndex::_vidGrabber.getPixelsRef(); //get ofPixels from the camera string file_name = ofToString(_save_cnt,2)+"_"+ ofToString(c,2)+"_"+ofToString(_run_cnt,2)+".jpg";
// fileName = imageSaveFolderPath+whichAnalysis+"_"+ofToString(100.0*i*scanLineSpeed/ofGetHeight(),2)+"%_"+ofToString(i)+".jpg";
//ofSaveImage(vectorOfPixels[i], fileName, OF_IMAGE_QUALITY_BEST);
ofSaveImage(RefractiveIndex::_pixels, _whole_file_path+"/"+file_name, OF_IMAGE_QUALITY_BEST); ofSaveImage(RefractiveIndex::_pixels, _whole_file_path+"/"+file_name, OF_IMAGE_QUALITY_BEST);
_saved_filenames.push_back(_whole_file_path+"/"+file_name);
//if(_save_cnt >= NUM_SAVE_PER_RUN) //if(_save_cnt >= NUM_SAVE_PER_RUN)
// _RUN_DONE = true; // _RUN_DONE = true;
} }

View File

@ -128,16 +128,14 @@ void RelaxRateAnalysis::draw()
void RelaxRateAnalysis::save_cb(Timer& timer) void RelaxRateAnalysis::save_cb(Timer& timer)
{ {
_save_cnt++; _save_cnt++;
cout << "RelaxRateAnalysis::saving...\n"; cout << "RelaxRateAnalysis::saving...\n";
//cout << "c_last... " << c << endl;
string file_name = ofToString(_save_cnt,2)+"_"+ ofToString(c,2)+"_"+ofToString(_run_cnt,2)+".jpg"; string file_name = ofToString(_save_cnt,2)+"_"+ ofToString(c,2)+"_"+ofToString(_run_cnt,2)+".jpg";
string thisLocation = RefractiveIndex::_location;
string file = _whole_file_path+"/"+file_name; ofSaveImage(RefractiveIndex::_pixels, _whole_file_path+"/"+file_name, OF_IMAGE_QUALITY_BEST);
ofSaveImage(RefractiveIndex::_pixels, file, OF_IMAGE_QUALITY_BEST); _saved_filenames.push_back(_whole_file_path+"/"+file_name);
_saved_filenames.push_back(file);
//if(_save_cnt >= NUM_SAVE_PER_RUN) //if(_save_cnt >= NUM_SAVE_PER_RUN)
// _RUN_DONE = true; // _RUN_DONE = true;

View File

@ -211,7 +211,10 @@ void ShadowScapesAnalysis::draw()
void ShadowScapesAnalysis::save_cb(Timer& timer) void ShadowScapesAnalysis::save_cb(Timer& timer)
{ {
_save_cnt++;
cout << "ShadowScapesAnalysis::saving...\n"; cout << "ShadowScapesAnalysis::saving...\n";
string file_name; string file_name;
if(_dir == H) { if(_dir == H) {
@ -227,6 +230,8 @@ void ShadowScapesAnalysis::save_cb(Timer& timer)
} }
ofSaveImage(RefractiveIndex::_pixels, _whole_file_path+"/"+file_name, OF_IMAGE_QUALITY_BEST); ofSaveImage(RefractiveIndex::_pixels, _whole_file_path+"/"+file_name, OF_IMAGE_QUALITY_BEST);
_save_cnt++;
_saved_filenames.push_back(_whole_file_path+"/"+file_name);
} }

View File

@ -306,6 +306,8 @@ void ShapeFromShadingAnalysis::draw()
} }
ofDisableAlphaBlending(); ofDisableAlphaBlending();
} else {
_RUN_DONE = true;
} }
_frame_cnt++; _frame_cnt++;
@ -339,10 +341,16 @@ void ShapeFromShadingAnalysis::save_cb(Timer& timer)
{ {
//cout << "ShapeFromShadingAnalysis::saving...\n"; //cout << "ShapeFromShadingAnalysis::saving...\n";
_save_cnt++;
cout << "ShapeFromShadingAnalysis::saving...\n";
string file_name = ofToString(_save_cnt,2)+"_"+ quad +"_"+ofToString(_run_cnt,2)+".jpg"; string file_name = ofToString(_save_cnt,2)+"_"+ quad +"_"+ofToString(_run_cnt,2)+".jpg";
ofSaveImage(RefractiveIndex::_pixels, _whole_file_path+"/"+file_name, OF_IMAGE_QUALITY_BEST); ofSaveImage(RefractiveIndex::_pixels, _whole_file_path+"/"+file_name, OF_IMAGE_QUALITY_BEST);
_save_cnt++;
_saved_filenames.push_back(_whole_file_path+"/"+file_name);
//if(_save_cnt >= NUM_SAVE_PER_RUN) //if(_save_cnt >= NUM_SAVE_PER_RUN)
// _RUN_DONE = true; // _RUN_DONE = true;

View File

@ -152,13 +152,17 @@ void StrobeAnalysis::draw()
// this runs at save_cb timer rate = DELTA_T_SAVE // this runs at save_cb timer rate = DELTA_T_SAVE
void StrobeAnalysis::save_cb(Timer& timer) void StrobeAnalysis::save_cb(Timer& timer)
{ {
string file_name = ofToString(_save_cnt,2)+"_"+ ofToString(_strobe_on) +"_"+ofToString(_run_cnt,2)+".jpg";
ofSaveImage(RefractiveIndex::_pixels, _whole_file_path+"/"+file_name, OF_IMAGE_QUALITY_BEST);
_save_cnt++; _save_cnt++;
cout << "_save_cnt" << _save_cnt << endl; cout << "StrobeAnalysis::saving...\n";
string file_name = ofToString(_save_cnt,2)+"_"+ ofToString(_strobe_on) +"_"+ofToString(_run_cnt,2)+".jpg";
ofSaveImage(RefractiveIndex::_pixels, _whole_file_path+"/"+file_name, OF_IMAGE_QUALITY_BEST);
_saved_filenames.push_back(_whole_file_path+"/"+file_name);
cout << "_save_cnt_max" << _save_cnt_max << endl;
//TODO: something fucked here with my calc of _save_cnt_max - new structure should fix it? //TODO: something fucked here with my calc of _save_cnt_max - new structure should fix it?
//if(_save_cnt >= _save_cnt_max-10) { //if(_save_cnt >= _save_cnt_max-10) {