diff --git a/example/RefractiveIndex.cpp b/example/RefractiveIndex.cpp index 2164bcf..b2cc791 100644 --- a/example/RefractiveIndex.cpp +++ b/example/RefractiveIndex.cpp @@ -222,13 +222,29 @@ void RefractiveIndex::draw() ofBackground(0, 0, 0); if(_currentAnalysis){ + _currentAnalysis->draw(); - if(_currentAnalysis->meshIsComplete){ fbo.begin(); - glShadeModel(GL_SMOOTH); + glShadeModel(GL_SMOOTH); + glEnable(GL_NORMALIZE); + //glEnable(GL_DEPTH_TEST); + //light.enable(); + //ofEnableSeparateSpecularLight(); + + ofEnableSmoothing(); + + //ofSetLineWidth(1.0f); + //glPointSize(5.0f); + + //glHint(GL_NICEST); + ofEnableBlendMode ( OF_BLENDMODE_ADD ); + //ofEnableBlendMode ( OF_BLENDMODE_MULTIPLY ); + //ofEnableBlendMode ( OF_BLENDMODE_SUBTRACT ); + //ofEnableBlendMode ( OF_BLENDMODE_ALPHA ); + //ofEnableBlendMode ( OF_BLENDMODE_SCREEN ); ofClear(0,0,0); @@ -243,19 +259,17 @@ void RefractiveIndex::draw() ofPopMatrix(); ofSetColor(255); - float xDiff= (fbo.getWidth()- (_currentAnalysis->_mesh_size_multiplier * _vid_w))/2; - float yDiff= (fbo.getHeight()- (_currentAnalysis->_mesh_size_multiplier * _vid_h))/2; + float xDiff= (fbo.getWidth()- 1.33333*(_currentAnalysis->_mesh_size_multiplier * _vid_w))/2; + float yDiff= (fbo.getHeight()- 1.0*(_currentAnalysis->_mesh_size_multiplier * _vid_h))/2; ofTranslate(xDiff,yDiff,-_currentAnalysis->zPlaneAverage ); - - ofEnableBlendMode ( OF_BLENDMODE_ADD ) ; + ofScale(1.33333,1.0,1.0); + _currentAnalysis->aMesh.drawVertices(); _currentAnalysis->aMesh.draw(); - ofDisableBlendMode( ) ; - camera.end(); fbo.end(); - + ofPixels pixels; fbo.readToPixels(pixels); @@ -263,6 +277,7 @@ void RefractiveIndex::draw() //saving jpgs doesn't work - pngs only! // PNG is fine - better for Final Cut anyway! + ofDisableBlendMode( ) ; } } } diff --git a/src/AbstractAnalysis.h b/src/AbstractAnalysis.h index 3e5352c..5537acb 100755 --- a/src/AbstractAnalysis.h +++ b/src/AbstractAnalysis.h @@ -64,6 +64,7 @@ public: bool meshIsComplete; bool imageForContourAvailable; ofMesh aMesh; + ofLight light; string meshFileName; //difference between our image size and the size of the fbo diff --git a/src/CamNoiseAnalysis.h b/src/CamNoiseAnalysis.h index 1d598fd..b2831e5 100755 --- a/src/CamNoiseAnalysis.h +++ b/src/CamNoiseAnalysis.h @@ -64,4 +64,7 @@ protected: //this is the temporary container to allow us to convert and save out greyscale images ofxCvColorImage cvConvertorImage; + bool _gotFirstImage; + ofImage _background; + }; diff --git a/src/DiffNoiseAnalysis.cpp b/src/DiffNoiseAnalysis.cpp index 5a48dad..b43a896 100755 --- a/src/DiffNoiseAnalysis.cpp +++ b/src/DiffNoiseAnalysis.cpp @@ -21,6 +21,14 @@ void DiffNoiseAnalysis::setup(int camWidth, int camHeight) cout << "NUM_RUN DiffNoiseAnalysis " << NUM_RUN << endl; //NUM_RUN = 5; + //flag for main sketch + meshIsComplete=false; + _gotFirstImage=false; + + _mesh_size_multiplier=4; + + + int acq_run_time; // 10 seconds of acquiring per run acq_run_time = RefractiveIndex::XML.getValue("config:analysis_time:acquiretime_diffnoise", ACQUIRE_TIME); cout << "ACQUIRE_TIME DiffNoiseAnalysis " << acq_run_time << endl; diff --git a/src/DiffNoiseAnalysis.h b/src/DiffNoiseAnalysis.h index 1f4efa0..7f124f1 100755 --- a/src/DiffNoiseAnalysis.h +++ b/src/DiffNoiseAnalysis.h @@ -63,4 +63,7 @@ protected: //this is the temporary container to allow us to convert and save out greyscale images ofxCvColorImage cvConvertorImage; + bool _gotFirstImage; + ofImage _background; + }; diff --git a/src/IResponseAnalysis.cpp b/src/IResponseAnalysis.cpp index d5e24da..3f83462 100755 --- a/src/IResponseAnalysis.cpp +++ b/src/IResponseAnalysis.cpp @@ -20,6 +20,12 @@ void IResponseAnalysis::setup(int camWidth, int camHeight) NUM_RUN = RefractiveIndex::XML.getValue("config:analysis_NUM_RUN:NUM_RUN_iresponse", NUMBER_RUNS); cout << "NUM_RUN IResponseAnalysis " << NUM_RUN << endl; //NUM_RUN = 5; + + //flag for main sketch + meshIsComplete=false; + _gotFirstImage=false; + + _mesh_size_multiplier=4; int acq_run_time; // 10 seconds of acquiring per run acq_run_time = RefractiveIndex::XML.getValue("config:analysis_time:acquiretime_iresponse", ACQUIRE_TIME); @@ -463,7 +469,7 @@ void IResponseAnalysis::setMeshFromPixels(vector sPixels, ofImage current x=0; y++; //something is going badly wrong with my maths for me to need this HELP TODO fix this - why am I running over the end of the vector? - if(y>=479){ + if(y>=currentSecondImage.getHeight()-1){ break; } } diff --git a/src/RelaxRateAnalysis.h b/src/RelaxRateAnalysis.h index f354d3d..c785eda 100755 --- a/src/RelaxRateAnalysis.h +++ b/src/RelaxRateAnalysis.h @@ -50,5 +50,8 @@ protected: vector cvContourFinderVect; vector cvContourFinderVectDisplay; + + bool _gotFirstImage; + ofImage _background; }; diff --git a/src/ShadowScapesAnalysis.cpp b/src/ShadowScapesAnalysis.cpp index 3d41da2..8154070 100755 --- a/src/ShadowScapesAnalysis.cpp +++ b/src/ShadowScapesAnalysis.cpp @@ -25,6 +25,14 @@ void ShadowScapesAnalysis::setup(int camWidth, int camHeight) cout << "NUM_RUN ShadowScapesAnalysis " << NUM_RUN << endl; //NUM_RUN = 5; + //flag for main sketch + meshIsComplete=false; + _gotFirstImage=false; + + _mesh_size_multiplier=4; + + + int acq_run_time; // 10 seconds of acquiring per run acq_run_time = RefractiveIndex::XML.getValue("config:analysis_time:acquiretime_shadowscapes", ACQUIRE_TIME); cout << "ACQUIRE_TIME ShadowScapesAnalysis " << acq_run_time << endl; diff --git a/src/ShadowScapesAnalysis.h b/src/ShadowScapesAnalysis.h index 9a3b89a..c1c77c4 100755 --- a/src/ShadowScapesAnalysis.h +++ b/src/ShadowScapesAnalysis.h @@ -67,6 +67,9 @@ protected: ofxCvContourFinder cvContourFinder1; //this is the temporary container to allow us to convert and save out greyscale images - ofxCvColorImage cvConvertorImage; + ofxCvColorImage cvConvertorImage; + + bool _gotFirstImage; + ofImage _background; }; \ No newline at end of file diff --git a/src/ShapeFromShadingAnalysis.h b/src/ShapeFromShadingAnalysis.h index 4c94812..c4b16e6 100755 --- a/src/ShapeFromShadingAnalysis.h +++ b/src/ShapeFromShadingAnalysis.h @@ -82,4 +82,6 @@ protected: //this is the temporary container to allow us to convert and save out greyscale images ofxCvColorImage cvConvertorImage; + bool _gotFirstImage; + ofImage _background; }; diff --git a/src/StrobeAnalysis.h b/src/StrobeAnalysis.h index 90d64d2..b86c79a 100755 --- a/src/StrobeAnalysis.h +++ b/src/StrobeAnalysis.h @@ -67,5 +67,8 @@ protected: //this is the temporary container to allow us to convert and save out greyscale images ofxCvColorImage cvConvertorImage; + + bool _gotFirstImage; + ofImage _background; };