mid-backed commit - master is dead
This commit is contained in:
parent
b5cebe9304
commit
5c5581f16e
@ -97,29 +97,29 @@ void RefractiveIndex::setup()
|
||||
|
||||
//TODO: whichever one of these is first - it always runs twice ?
|
||||
|
||||
_analysisVector.push_back(new ShadowScapesAnalysis(V));
|
||||
_analysisVector.push_back(new ShadowScapesAnalysis(H));
|
||||
_analysisVector.push_back(new ShadowScapesAnalysis(D));
|
||||
//_analysisVector.push_back(new ShadowScapesAnalysis(V));
|
||||
//_analysisVector.push_back(new ShadowScapesAnalysis(H));
|
||||
//_analysisVector.push_back(new ShadowScapesAnalysis(D));
|
||||
|
||||
_analysisVector.push_back(new RelaxRateAnalysis());
|
||||
|
||||
_analysisVector.push_back(new IResponseAnalysis());
|
||||
//_analysisVector.push_back(new IResponseAnalysis());
|
||||
|
||||
_analysisVector.push_back(new ShapeFromShadingAnalysis());
|
||||
//_analysisVector.push_back(new ShapeFromShadingAnalysis());
|
||||
|
||||
_analysisVector.push_back(new StrobeAnalysis());
|
||||
//_analysisVector.push_back(new StrobeAnalysis());
|
||||
|
||||
_analysisVector.push_back(new CamNoiseAnalysis());
|
||||
//_analysisVector.push_back(new CamNoiseAnalysis());
|
||||
|
||||
_analysisVector.push_back(new ColorSingleAnalysis());
|
||||
//_analysisVector.push_back(new ColorSingleAnalysis());
|
||||
|
||||
_analysisVector.push_back(new ColorMultiAnalysis());
|
||||
//_analysisVector.push_back(new ColorMultiAnalysis());
|
||||
|
||||
_analysisVector.push_back(new DiffNoiseAnalysis());
|
||||
//_analysisVector.push_back(new DiffNoiseAnalysis());
|
||||
|
||||
|
||||
_currentAnalysisIndx = 0;
|
||||
_currentAnalysis = _analysisVector.at(_currentAnalysisIndx);
|
||||
_currentAnalysis = _analysisVector.at(_currentAnalysisIndx++);
|
||||
|
||||
_state = ISTATE_START;
|
||||
|
||||
@ -209,6 +209,7 @@ void RefractiveIndex::setup_camera()
|
||||
ofLog(OF_LOG_ERROR) << "RefractiveIndex::setup_camera - could not initialise grabber";
|
||||
return;
|
||||
}
|
||||
_vidGrabber.setUseTexture(false);
|
||||
_vidGrabber.listDevices();
|
||||
_vidGrabber.setVerbose(true);
|
||||
_vid_stream_open = true;
|
||||
|
||||
@ -72,8 +72,8 @@ void AbstractAnalysis::create_dir()
|
||||
}
|
||||
|
||||
ofxFileHelper fileHelper;
|
||||
_whole_file_path = ANALYSIS_PATH + RefractiveIndex::_location + "/" + _name + "/"+replaceTime ;
|
||||
//cout << "_whole_file_path = " << _whole_file_path << endl;
|
||||
_whole_file_path = ofToDataPath("") + ANALYSIS_PATH + RefractiveIndex::_location + "/" + _name + "/"+replaceTime ;
|
||||
cout << "_whole_file_path = " << _whole_file_path << endl;
|
||||
|
||||
if(!fileHelper.doesDirectoryExist(_whole_file_path)){
|
||||
fileHelper.makeDirectory(ANALYSIS_PATH);
|
||||
@ -163,7 +163,8 @@ ofPixels AbstractAnalysis::calculateListOfZValues(ofImage image1, ofImage image2
|
||||
int y=0;
|
||||
|
||||
//for each pixel...
|
||||
for(int i=0;i<imagePixels1.size();i+=3){
|
||||
//for(int i=0;i<imagePixels1.size();i+=3){
|
||||
for(int i=0;i<20;i+=3){
|
||||
|
||||
//get the colour of each image at this x y location - we will use these colours for comparison according to the below criteria
|
||||
ofColor colourImage1 = imagePixels1.getColor(x, y);
|
||||
@ -319,8 +320,15 @@ int AbstractAnalysis::getRecordedValueFromFileName(string str){
|
||||
void AbstractAnalysis::saveimage(string filename)
|
||||
{
|
||||
if(RefractiveIndex::_pixels.isAllocated()) {
|
||||
ofSaveImage(RefractiveIndex::_pixels, filename, OF_IMAGE_QUALITY_BEST);
|
||||
_saved_filenames.push_back(filename);
|
||||
|
||||
string fname = _whole_file_path + "/" + filename;
|
||||
|
||||
cout << "saving - " << fname << endl;
|
||||
|
||||
ofSaveImage(RefractiveIndex::_pixels, fname, OF_IMAGE_QUALITY_BEST);
|
||||
|
||||
_saved_filenames.push_back(fname);
|
||||
|
||||
} else {
|
||||
ofLog(OF_LOG_ERROR) << "RefractiveIndex::_pixels NOT allocated...";
|
||||
}
|
||||
|
||||
@ -233,13 +233,7 @@ void CamNoiseAnalysis::save_cb(Timer& timer)
|
||||
_save_cnt++;
|
||||
|
||||
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);
|
||||
|
||||
_saved_filenames.push_back(ofToDataPath("")+file);
|
||||
saveimage(file_name);
|
||||
|
||||
//if(_save_cnt >= NUM_SAVE_PER_RUN)
|
||||
// _RUN_DONE = true;
|
||||
|
||||
@ -247,34 +247,14 @@ void ColorMultiAnalysis::draw()
|
||||
// this runs at save_cb timer rate = DELTA_T_SAVE
|
||||
void ColorMultiAnalysis::save_cb(Timer& timer)
|
||||
{
|
||||
_save_cnt++;
|
||||
|
||||
// UPDATE THE COLOR ON THE SCREEN
|
||||
//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";
|
||||
saveimage(file_name);
|
||||
|
||||
// cout<<_whole_file_path<<endl;
|
||||
ofSaveImage(RefractiveIndex::_pixels, _whole_file_path+"/"+file_name, OF_IMAGE_QUALITY_BEST);
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
// _saved_filenames.push_back("/Users/tomschofield/of_preRelease_v007_osx/apps/myApps/refractiveIndexDavidFeb/bin/data/"+_whole_file_path+"/"+file_name);
|
||||
_saved_filenames.push_back("fish.jpg");
|
||||
_save_cnt++;
|
||||
|
||||
=======
|
||||
_saved_filenames.push_back(ofToDataPath("")+_whole_file_path+"/"+file_name);
|
||||
>>>>>>> tom
|
||||
if(_save_cnt >= NUM_SAVE_PER_RUN){
|
||||
_RUN_DONE = true;
|
||||
}
|
||||
=======
|
||||
|
||||
//if(_save_cnt >= NUM_SAVE_PER_RUN){
|
||||
// _RUN_DONE = true;
|
||||
//}
|
||||
>>>>>>> 88fa0375934e9ad87053542e88a0f9fe61af0a66
|
||||
}
|
||||
|
||||
void ColorMultiAnalysis::display_results_cb(Timer& timer){
|
||||
|
||||
@ -236,18 +236,13 @@ void ColorSingleAnalysis::draw()
|
||||
// this runs at save_cb timer rate = DELTA_T_SAVE
|
||||
void ColorSingleAnalysis::save_cb(Timer& timer)
|
||||
{
|
||||
_save_cnt++;
|
||||
|
||||
//cout << "ColorSingleAnalysis::saving...\n";
|
||||
|
||||
string file_name =ofToString(_save_cnt,2)+"_"+fileNameTag+"_"+ofToString(_run_cnt,2)+".jpg";
|
||||
saveimage(file_name);
|
||||
|
||||
//cout<<ofToString(_save_cnt,2)+"_"+fileNameTag+"_"+ofToString(_run_cnt,2)+".jpg";
|
||||
cout<<file_name<<endl;
|
||||
ofSaveImage(RefractiveIndex::_pixels, _whole_file_path+"/"+file_name, OF_IMAGE_QUALITY_BEST);
|
||||
_saved_filenames.push_back(ofToDataPath("")+_whole_file_path+"/"+file_name);
|
||||
|
||||
//cout<<_whole_file_path+"/"+file_name<<endl;
|
||||
_save_cnt++;
|
||||
|
||||
//if(_save_cnt >= NUM_SAVE_PER_RUN)
|
||||
// _RUN_DONE = true;
|
||||
|
||||
@ -257,20 +257,12 @@ void DiffNoiseAnalysis::save_cb(Timer& timer)
|
||||
cout<<"rand10... " <<rand10<<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
|
||||
// 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);
|
||||
|
||||
_saved_filenames.push_back(ofToDataPath("")+file);
|
||||
saveimage(file_name);
|
||||
|
||||
}
|
||||
|
||||
_save_cnt++;
|
||||
|
||||
//if(_save_cnt >= NUM_SAVE_PER_RUN)
|
||||
// _RUN_DONE = true;
|
||||
|
||||
|
||||
@ -192,19 +192,12 @@ void IResponseAnalysis::draw()
|
||||
// this runs at save_cb timer rate = DELTA_T_SAVE
|
||||
void IResponseAnalysis::save_cb(Timer& timer)
|
||||
{
|
||||
_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;
|
||||
saveimage(file_name);
|
||||
|
||||
//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);
|
||||
_saved_filenames.push_back(ofToDataPath("")+_whole_file_path+"/"+file_name);
|
||||
|
||||
ofSaveImage(RefractiveIndex::_pixels, _whole_file_path+"/"+file_name, OF_IMAGE_QUALITY_BEST);
|
||||
_save_cnt++;
|
||||
|
||||
//if(_save_cnt >= NUM_SAVE_PER_RUN)
|
||||
// _RUN_DONE = true;
|
||||
|
||||
@ -61,6 +61,7 @@ void RelaxRateAnalysis::acquire()
|
||||
|
||||
void RelaxRateAnalysis::synthesise()
|
||||
{
|
||||
/*
|
||||
//incrementer to whichMesh
|
||||
speed=0.2;
|
||||
//whichMesh is the index in the vector of meshes
|
||||
@ -100,10 +101,13 @@ void RelaxRateAnalysis::synthesise()
|
||||
index++;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
void RelaxRateAnalysis::display_results(){
|
||||
|
||||
/*
|
||||
|
||||
Timer* display_results_timer;
|
||||
|
||||
TimerCallback<RelaxRateAnalysis> display_results_callback(*this, &RelaxRateAnalysis::display_results_cb);
|
||||
@ -119,6 +123,7 @@ void RelaxRateAnalysis::display_results(){
|
||||
Thread::sleep(3);
|
||||
|
||||
display_results_timer->stop();
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
@ -170,6 +175,7 @@ void RelaxRateAnalysis::draw()
|
||||
|
||||
case STATE_DISPLAY_RESULTS:
|
||||
{
|
||||
/*
|
||||
// display results of the synthesis
|
||||
// display results of the synthesis
|
||||
int imageWidth=640;
|
||||
@ -191,6 +197,7 @@ void RelaxRateAnalysis::draw()
|
||||
whichMesh+=speed;
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
break;
|
||||
}
|
||||
@ -207,17 +214,14 @@ void RelaxRateAnalysis::draw()
|
||||
// this runs at save_cb timer rate = DELTA_T_SAVE
|
||||
void RelaxRateAnalysis::save_cb(Timer& timer)
|
||||
{
|
||||
_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 thisLocation = RefractiveIndex::_location;
|
||||
|
||||
string file = _whole_file_path+"/"+file_name;
|
||||
saveimage(file_name);
|
||||
|
||||
ofSaveImage(RefractiveIndex::_pixels, file, OF_IMAGE_QUALITY_BEST);
|
||||
_save_cnt++;
|
||||
|
||||
_saved_filenames.push_back(ofToDataPath("")+file);
|
||||
|
||||
//if(_save_cnt >= NUM_SAVE_PER_RUN)
|
||||
// _RUN_DONE = true;
|
||||
|
||||
@ -119,6 +119,14 @@ void ShadowScapesAnalysis::synthesise()
|
||||
//there is a known issue with using loadImage inside classes in other directories. the fix is to call setUseTExture(false)
|
||||
image1.setUseTexture(false);
|
||||
image2.setUseTexture(false);
|
||||
|
||||
string fnamei = _saved_filenames[i];
|
||||
string fnameii = _saved_filenames[i + 1];
|
||||
|
||||
bool l1 = image1.loadImage(_saved_filenames[i]);
|
||||
bool l2 = image2.loadImage(_saved_filenames[i+1]);
|
||||
|
||||
|
||||
//some of the textures are not loading correctly so only make mesh if both the images load
|
||||
if(image1.loadImage(_saved_filenames[i]) && image2.loadImage(_saved_filenames[i+1])){
|
||||
meshes.push_back(ofMesh());
|
||||
@ -126,6 +134,9 @@ void ShadowScapesAnalysis::synthesise()
|
||||
setMeshFromPixels( calculateListOfZValues(image1,image2, COMPARE_BRIGHTNESS), image2, &meshes[index]);
|
||||
index++;
|
||||
}
|
||||
|
||||
image1.clear();
|
||||
image2.clear();
|
||||
}
|
||||
|
||||
}
|
||||
@ -288,6 +299,14 @@ void ShadowScapesAnalysis::draw()
|
||||
void ShadowScapesAnalysis::save_cb(Timer& timer)
|
||||
{
|
||||
|
||||
RefractiveIndex::_vidGrabber.grabFrame(); // get a new frame from the camera
|
||||
|
||||
if (RefractiveIndex::_vidGrabber.isFrameNew())
|
||||
{
|
||||
RefractiveIndex::_pixels = RefractiveIndex::_vidGrabber.getPixelsRef(); //get ofPixels from the camera
|
||||
}
|
||||
|
||||
|
||||
cout << "ShadowScapesAnalysis::saving...\n";
|
||||
string file_name;
|
||||
|
||||
@ -302,9 +321,9 @@ void ShadowScapesAnalysis::save_cb(Timer& timer)
|
||||
if(_dir == D) {
|
||||
file_name = ofToString(_save_cnt, 2)+"_D_"+ofToString(_line, 2)+"_"+ofToString(_run_cnt,2)+".jpg";
|
||||
}
|
||||
_saved_filenames.push_back(ofToDataPath("")+_whole_file_path+"/"+file_name);
|
||||
|
||||
ofSaveImage(RefractiveIndex::_pixels, _whole_file_path+"/"+file_name, OF_IMAGE_QUALITY_BEST);
|
||||
saveimage(file_name);
|
||||
|
||||
_save_cnt++;
|
||||
|
||||
}
|
||||
|
||||
@ -232,9 +232,8 @@ void StrobeAnalysis::draw()
|
||||
void StrobeAnalysis::save_cb(Timer& timer)
|
||||
{
|
||||
string file_name = ofToString(_save_cnt,2)+"_"+ ofToString(_strobe_on) +"_"+ofToString(_run_cnt,2)+".jpg";
|
||||
_saved_filenames.push_back(ofToDataPath("")+_whole_file_path+"/"+file_name);
|
||||
saveimage(file_name);
|
||||
|
||||
ofSaveImage(RefractiveIndex::_pixels, _whole_file_path+"/"+file_name, OF_IMAGE_QUALITY_BEST);
|
||||
_save_cnt++;
|
||||
|
||||
cout << "_save_cnt" << _save_cnt << endl;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user