Compare commits
No commits in common. "master" and "tom" have entirely different histories.
10
README
Normal file
10
README
Normal file
@ -0,0 +1,10 @@
|
||||
WARNING: WORK IN PROGRESS...
|
||||
|
||||
configuring OpenFrameworks
|
||||
-----------------
|
||||
|
||||
these files are configured according to OpenFrameworks addons - http://ofxaddons.com/howto
|
||||
|
||||
(1) drag-drop "ReflectiveIndex" folder into your OpenFrameworks project
|
||||
(2) Install depedencies: {ofxDirList, ofxControlPanel, ofxXmlSettings};
|
||||
(3) Press Play!
|
||||
@ -1,2 +0,0 @@
|
||||
<img src="https://davidgauthier.info/rfi/img-resize/rfi3.jpg" width="100%">
|
||||
<img src="https://davidgauthier.info/rfi/img-resize/rfi4.jpg" width="100%">
|
||||
@ -103,23 +103,23 @@ void RefractiveIndex::setup()
|
||||
|
||||
_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 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,7 +209,6 @@ 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;
|
||||
|
||||
@ -4,14 +4,6 @@
|
||||
|
||||
#define SCREEN_WIDTH 800
|
||||
#define SCREEN_HEIGHT 600
|
||||
/////////////////////////dis is the new shit///////////
|
||||
|
||||
/////////////////////////dis is the new shit///////////
|
||||
|
||||
/////////////////////////dis is the new shit///////////
|
||||
|
||||
/////////////////////////dis is the new shit///////////
|
||||
|
||||
|
||||
int main() {
|
||||
ofAppGlutWindow window;
|
||||
|
||||
@ -72,8 +72,8 @@ void AbstractAnalysis::create_dir()
|
||||
}
|
||||
|
||||
ofxFileHelper fileHelper;
|
||||
_whole_file_path = ofToDataPath("") + ANALYSIS_PATH + RefractiveIndex::_location + "/" + _name + "/"+replaceTime ;
|
||||
cout << "_whole_file_path = " << _whole_file_path << endl;
|
||||
_whole_file_path = 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,8 +163,7 @@ 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<20;i+=3){
|
||||
for(int i=0;i<imagePixels1.size();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);
|
||||
@ -317,20 +316,3 @@ int AbstractAnalysis::getRecordedValueFromFileName(string str){
|
||||
}
|
||||
|
||||
|
||||
void AbstractAnalysis::saveimage(string filename)
|
||||
{
|
||||
if(RefractiveIndex::_pixels.isAllocated()) {
|
||||
|
||||
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...";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -39,7 +39,6 @@ public:
|
||||
protected:
|
||||
|
||||
virtual void create_dir();
|
||||
virtual void saveimage(string filename);
|
||||
|
||||
// acquire images - all the children (see - do_synthesize)
|
||||
virtual void acquire() = 0;
|
||||
|
||||
@ -133,9 +133,6 @@ void CamNoiseAnalysis::draw()
|
||||
// still need to deal with latency frames here - i.e.: there are frames
|
||||
/// *** TODO *** ///
|
||||
|
||||
if (_frame_cnt < _frame_cnt_max)
|
||||
{
|
||||
|
||||
ofEnableAlphaBlending();
|
||||
ofColor aColour;
|
||||
|
||||
@ -174,16 +171,11 @@ void CamNoiseAnalysis::draw()
|
||||
// cout << "FADE OUT STROBE TIME " << endl;
|
||||
}
|
||||
|
||||
ofDisableAlphaBlending();
|
||||
|
||||
|
||||
} else {
|
||||
_RUN_DONE = true;
|
||||
}
|
||||
|
||||
_frame_cnt++;
|
||||
break;
|
||||
ofDisableAlphaBlending();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case STATE_SYNTHESISING:
|
||||
@ -233,10 +225,16 @@ void CamNoiseAnalysis::save_cb(Timer& timer)
|
||||
_save_cnt++;
|
||||
|
||||
string file_name = ofToString(_save_cnt,2)+"_"+ ofToString(c,2)+"_"+ofToString(_run_cnt,2)+".jpg";
|
||||
saveimage(file_name);
|
||||
string thisLocation = RefractiveIndex::_location;
|
||||
|
||||
//if(_save_cnt >= NUM_SAVE_PER_RUN)
|
||||
// _RUN_DONE = true;
|
||||
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);
|
||||
|
||||
if(_save_cnt >= NUM_SAVE_PER_RUN)
|
||||
_RUN_DONE = true;
|
||||
|
||||
}
|
||||
void CamNoiseAnalysis::display_results_cb(Timer& timer){
|
||||
|
||||
@ -150,11 +150,6 @@ void ColorMultiAnalysis::draw()
|
||||
switch (_state) {
|
||||
case STATE_ACQUIRING:
|
||||
{
|
||||
|
||||
if (_frame_cnt < _frame_cnt_max)
|
||||
{
|
||||
|
||||
|
||||
int _fade_in_frames = _frame_cnt_max/50;
|
||||
|
||||
if (_frame_cnt < _fade_in_frames) {
|
||||
@ -194,12 +189,6 @@ void ColorMultiAnalysis::draw()
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
_RUN_DONE = true;
|
||||
|
||||
}
|
||||
|
||||
_frame_cnt++;
|
||||
|
||||
break;
|
||||
@ -247,14 +236,21 @@ void ColorMultiAnalysis::draw()
|
||||
// this runs at save_cb timer rate = DELTA_T_SAVE
|
||||
void ColorMultiAnalysis::save_cb(Timer& timer)
|
||||
{
|
||||
|
||||
// cout << "COLORMULTIANALYSIS::saving...\n";
|
||||
|
||||
string file_name = ofToString(_save_cnt,2)+"_"+ofToString(c,2)+"_"+ofToString(_run_cnt,2)+".jpg";
|
||||
saveimage(file_name);
|
||||
|
||||
_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";
|
||||
|
||||
// cout<<_whole_file_path<<endl;
|
||||
ofSaveImage(RefractiveIndex::_pixels, _whole_file_path+"/"+file_name, OF_IMAGE_QUALITY_BEST);
|
||||
_saved_filenames.push_back(ofToDataPath("")+_whole_file_path+"/"+file_name);
|
||||
if(_save_cnt >= NUM_SAVE_PER_RUN){
|
||||
_RUN_DONE = true;
|
||||
}
|
||||
}
|
||||
|
||||
void ColorMultiAnalysis::display_results_cb(Timer& timer){
|
||||
|
||||
@ -136,12 +136,8 @@ void ColorSingleAnalysis::draw()
|
||||
switch (_state) {
|
||||
case STATE_ACQUIRING:
|
||||
{
|
||||
|
||||
|
||||
if (_frame_cnt < _frame_cnt_max)
|
||||
{
|
||||
|
||||
float one_third_of_frame_count_max=_frame_cnt_max/3;
|
||||
|
||||
int _fade_in_frames = one_third_of_frame_count_max/10;
|
||||
|
||||
if (_frame_cnt < _fade_in_frames){
|
||||
@ -187,10 +183,6 @@ void ColorSingleAnalysis::draw()
|
||||
fileNameTag = "FADING";
|
||||
}
|
||||
|
||||
} else {
|
||||
_RUN_DONE = true;
|
||||
}
|
||||
|
||||
_frame_cnt++;
|
||||
|
||||
break;
|
||||
@ -236,16 +228,21 @@ 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);
|
||||
|
||||
_save_cnt++;
|
||||
//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);
|
||||
|
||||
//if(_save_cnt >= NUM_SAVE_PER_RUN)
|
||||
// _RUN_DONE = true;
|
||||
//cout<<_whole_file_path+"/"+file_name<<endl;
|
||||
|
||||
if(_save_cnt >= NUM_SAVE_PER_RUN)
|
||||
_RUN_DONE = true;
|
||||
|
||||
}
|
||||
void ColorSingleAnalysis::display_results_cb(Timer& timer){
|
||||
|
||||
@ -126,10 +126,6 @@ void DiffNoiseAnalysis::draw()
|
||||
switch (_state) {
|
||||
case STATE_ACQUIRING:
|
||||
{
|
||||
|
||||
if (_frame_cnt < _frame_cnt_max)
|
||||
{
|
||||
|
||||
ofColor aColour;
|
||||
int rectSize = 5;
|
||||
ofEnableAlphaBlending();
|
||||
@ -191,12 +187,6 @@ void DiffNoiseAnalysis::draw()
|
||||
|
||||
ofDisableAlphaBlending();
|
||||
|
||||
} else {
|
||||
|
||||
_RUN_DONE = true;
|
||||
|
||||
}
|
||||
|
||||
_frame_cnt++;
|
||||
|
||||
break;
|
||||
@ -257,14 +247,22 @@ 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";
|
||||
saveimage(file_name);
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
_save_cnt++;
|
||||
|
||||
//if(_save_cnt >= NUM_SAVE_PER_RUN)
|
||||
// _RUN_DONE = true;
|
||||
if(_save_cnt >= NUM_SAVE_PER_RUN)
|
||||
_RUN_DONE = true;
|
||||
|
||||
}
|
||||
void DiffNoiseAnalysis::display_results_cb(Timer& timer){
|
||||
|
||||
@ -140,8 +140,6 @@ void IResponseAnalysis::draw()
|
||||
ofSetColor(c, c, c);
|
||||
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
||||
c = 255.0 * (_frame_cnt_max*_frame_cnt_max - _frame_cnt*_frame_cnt)/(_frame_cnt_max*_frame_cnt_max);
|
||||
} else {
|
||||
_RUN_DONE = true;
|
||||
}
|
||||
|
||||
_frame_cnt++;
|
||||
@ -192,15 +190,22 @@ void IResponseAnalysis::draw()
|
||||
// this runs at save_cb timer rate = DELTA_T_SAVE
|
||||
void IResponseAnalysis::save_cb(Timer& timer)
|
||||
{
|
||||
//cout << "IResponseAnalysis::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);
|
||||
|
||||
_save_cnt++;
|
||||
|
||||
//if(_save_cnt >= NUM_SAVE_PER_RUN)
|
||||
// _RUN_DONE = true;
|
||||
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
|
||||
// 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);
|
||||
|
||||
if(_save_cnt >= NUM_SAVE_PER_RUN)
|
||||
_RUN_DONE = true;
|
||||
}
|
||||
void IResponseAnalysis::display_results_cb(Timer& timer){
|
||||
_results_cnt++;
|
||||
|
||||
@ -20,7 +20,7 @@ void RelaxRateAnalysis::setup(int camWidth, int camHeight)
|
||||
{
|
||||
DELTA_T_SAVE = 130;
|
||||
NUM_PHASE = 1;
|
||||
NUM_RUN = 3;
|
||||
NUM_RUN = 1;
|
||||
NUM_SAVE_PER_RUN = 100;
|
||||
|
||||
create_dir();
|
||||
@ -61,7 +61,6 @@ void RelaxRateAnalysis::acquire()
|
||||
|
||||
void RelaxRateAnalysis::synthesise()
|
||||
{
|
||||
/*
|
||||
//incrementer to whichMesh
|
||||
speed=0.2;
|
||||
//whichMesh is the index in the vector of meshes
|
||||
@ -101,13 +100,10 @@ void RelaxRateAnalysis::synthesise()
|
||||
index++;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
void RelaxRateAnalysis::display_results(){
|
||||
|
||||
/*
|
||||
|
||||
Timer* display_results_timer;
|
||||
|
||||
TimerCallback<RelaxRateAnalysis> display_results_callback(*this, &RelaxRateAnalysis::display_results_cb);
|
||||
@ -123,7 +119,6 @@ void RelaxRateAnalysis::display_results(){
|
||||
Thread::sleep(3);
|
||||
|
||||
display_results_timer->stop();
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
@ -139,7 +134,7 @@ void RelaxRateAnalysis::draw()
|
||||
// still need to deal with latency frames here - i.e.: there are frames
|
||||
/// *** TODO *** ///
|
||||
|
||||
if (_frame_cnt < _frame_cnt_max)
|
||||
if (_frame_cnt <= _frame_cnt_max)
|
||||
{
|
||||
|
||||
float lightLevel=pow(_level,2);
|
||||
@ -157,8 +152,7 @@ void RelaxRateAnalysis::draw()
|
||||
|
||||
} else {
|
||||
cout << "RELAXRATE RUN COMPLETED" << endl;
|
||||
//_state = STATE_SYNTHESISING;
|
||||
_RUN_DONE = true;
|
||||
_state = STATE_SYNTHESISING;
|
||||
}
|
||||
|
||||
_frame_cnt++;
|
||||
@ -175,7 +169,6 @@ void RelaxRateAnalysis::draw()
|
||||
|
||||
case STATE_DISPLAY_RESULTS:
|
||||
{
|
||||
/*
|
||||
// display results of the synthesis
|
||||
// display results of the synthesis
|
||||
int imageWidth=640;
|
||||
@ -197,7 +190,6 @@ void RelaxRateAnalysis::draw()
|
||||
whichMesh+=speed;
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
break;
|
||||
}
|
||||
@ -214,17 +206,20 @@ void RelaxRateAnalysis::draw()
|
||||
// this runs at save_cb timer rate = DELTA_T_SAVE
|
||||
void RelaxRateAnalysis::save_cb(Timer& timer)
|
||||
{
|
||||
//cout << "RelaxRateAnalysis::saving...\n";
|
||||
_save_cnt++;
|
||||
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;
|
||||
|
||||
saveimage(file_name);
|
||||
string file = _whole_file_path+"/"+file_name;
|
||||
|
||||
_save_cnt++;
|
||||
ofSaveImage(RefractiveIndex::_pixels, file, OF_IMAGE_QUALITY_BEST);
|
||||
|
||||
_saved_filenames.push_back(ofToDataPath("")+file);
|
||||
|
||||
//if(_save_cnt >= NUM_SAVE_PER_RUN)
|
||||
// _RUN_DONE = true;
|
||||
if(_save_cnt >= NUM_SAVE_PER_RUN)
|
||||
_RUN_DONE = true;
|
||||
|
||||
}
|
||||
void RelaxRateAnalysis::display_results_cb(Timer& timer){
|
||||
|
||||
@ -119,14 +119,6 @@ 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());
|
||||
@ -134,9 +126,6 @@ void ShadowScapesAnalysis::synthesise()
|
||||
setMeshFromPixels( calculateListOfZValues(image1,image2, COMPARE_BRIGHTNESS), image2, &meshes[index]);
|
||||
index++;
|
||||
}
|
||||
|
||||
image1.clear();
|
||||
image2.clear();
|
||||
}
|
||||
|
||||
}
|
||||
@ -234,21 +223,21 @@ void ShadowScapesAnalysis::draw()
|
||||
|
||||
if(_dir == V && int(_line) >= (ofGetHeight()+4*_scanLineWidth)){
|
||||
cout << "VERTICAL IS DONE - _line >= (ofGetHeight()+4*_scanLineWidth) is TRUE" << endl;
|
||||
//_state = STATE_SYNTHESISING;
|
||||
_state = STATE_SYNTHESISING;
|
||||
_RUN_DONE = true;
|
||||
}
|
||||
|
||||
if(_dir == H && int(_line) >= (ofGetWidth()+4*_scanLineWidth)) {
|
||||
|
||||
//cout << "HORIZONTAL IS DONE - _line >= (ofGetWidth()+4*_scanLineWidth)) is TRUE" << endl;
|
||||
//_state = STATE_SYNTHESISING;
|
||||
_state = STATE_SYNTHESISING;
|
||||
_RUN_DONE = true;
|
||||
|
||||
}
|
||||
|
||||
if(_dir == D && int(_line) >= (1.5*ofGetHeight()+4*_scanLineWidth)) {
|
||||
//cout << "DIAGONAL IS DONE - _line >= (1.5*ofGetHeight()+4*_scanLineWidth)) is TRUE" << endl;
|
||||
//_state = STATE_SYNTHESISING;
|
||||
_state = STATE_SYNTHESISING;
|
||||
_RUN_DONE = true;
|
||||
}
|
||||
|
||||
@ -299,14 +288,6 @@ 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;
|
||||
|
||||
@ -321,9 +302,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);
|
||||
|
||||
saveimage(file_name);
|
||||
|
||||
ofSaveImage(RefractiveIndex::_pixels, _whole_file_path+"/"+file_name, OF_IMAGE_QUALITY_BEST);
|
||||
_save_cnt++;
|
||||
|
||||
}
|
||||
|
||||
@ -149,7 +149,7 @@ void ShapeFromShadingAnalysis::draw()
|
||||
switch (_state) {
|
||||
case STATE_ACQUIRING:
|
||||
{
|
||||
if (_frame_cnt < _frame_cnt_max)
|
||||
if (_frame_cnt <= _frame_cnt_max)
|
||||
{
|
||||
|
||||
ofEnableAlphaBlending();
|
||||
@ -420,13 +420,13 @@ void ShapeFromShadingAnalysis::save_cb(Timer& timer)
|
||||
//cout << "ShapeFromShadingAnalysis::saving...\n";
|
||||
|
||||
string file_name = ofToString(_save_cnt,2)+"_"+ quad +"_"+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++;
|
||||
|
||||
//if(_save_cnt >= NUM_SAVE_PER_RUN)
|
||||
// _RUN_DONE = true;
|
||||
if(_save_cnt >= NUM_SAVE_PER_RUN)
|
||||
_RUN_DONE = true;
|
||||
|
||||
}
|
||||
void ShapeFromShadingAnalysis::display_results_cb(Timer& timer){
|
||||
|
||||
@ -132,9 +132,6 @@ void StrobeAnalysis::draw()
|
||||
|
||||
switch (_state) {
|
||||
case STATE_ACQUIRING:
|
||||
{
|
||||
|
||||
if (_frame_cnt < _frame_cnt_max)
|
||||
{
|
||||
ofEnableAlphaBlending();
|
||||
ofColor aColour;
|
||||
@ -179,12 +176,8 @@ void StrobeAnalysis::draw()
|
||||
// cout << "FADE OUT STROBE TIME " << endl;
|
||||
}
|
||||
|
||||
ofDisableAlphaBlending();
|
||||
} else {
|
||||
_RUN_DONE = true;
|
||||
}
|
||||
|
||||
_frame_cnt++;
|
||||
ofDisableAlphaBlending();
|
||||
|
||||
break;
|
||||
}
|
||||
@ -232,8 +225,9 @@ void StrobeAnalysis::draw()
|
||||
void StrobeAnalysis::save_cb(Timer& timer)
|
||||
{
|
||||
string file_name = ofToString(_save_cnt,2)+"_"+ ofToString(_strobe_on) +"_"+ofToString(_run_cnt,2)+".jpg";
|
||||
saveimage(file_name);
|
||||
_saved_filenames.push_back(ofToDataPath("")+_whole_file_path+"/"+file_name);
|
||||
|
||||
ofSaveImage(RefractiveIndex::_pixels, _whole_file_path+"/"+file_name, OF_IMAGE_QUALITY_BEST);
|
||||
_save_cnt++;
|
||||
|
||||
cout << "_save_cnt" << _save_cnt << endl;
|
||||
@ -241,9 +235,9 @@ void StrobeAnalysis::save_cb(Timer& timer)
|
||||
cout << "_save_cnt_max" << _save_cnt_max << endl;
|
||||
|
||||
//TODO: something fucked here with my calc of _save_cnt_max - new structure should fix it?
|
||||
//if(_save_cnt >= _save_cnt_max-10) {
|
||||
// _RUN_DONE = true;
|
||||
//}
|
||||
if(_save_cnt >= _save_cnt_max-10) {
|
||||
_RUN_DONE = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user