now displays images after saving them out and also fixed maths booboo with analysis

This commit is contained in:
Tom Schofield 2012-04-13 11:16:51 +01:00
parent 706eb9354d
commit a9c8a56850
2 changed files with 10 additions and 7 deletions

View File

@ -19,7 +19,7 @@
#define CAMERA_ACQU_WIDTH 640 #define CAMERA_ACQU_WIDTH 640
#define CAMERA_ACQU_HEIGHT 480 #define CAMERA_ACQU_HEIGHT 480
#define LOCATION "BRADFORD" #define LOCATION "MANCHESTER"
#define ISTATE_UNDEF 0xEEEE #define ISTATE_UNDEF 0xEEEE
#define ISTATE_START 0xAAAA #define ISTATE_START 0xAAAA
@ -216,7 +216,7 @@ void RefractiveIndex::draw()
if(_currentAnalysis){ if(_currentAnalysis){
_currentAnalysis->draw(); _currentAnalysis->draw();
cout<<_currentAnalysis->meshIsComplete<<endl;
if(_currentAnalysis->meshIsComplete){ if(_currentAnalysis->meshIsComplete){
fbo.begin(); fbo.begin();
@ -231,7 +231,7 @@ void RefractiveIndex::draw()
fbo.end(); fbo.end();
ofPixels pixels; ofPixels pixels;
fbo.readToPixels(pixels); fbo.readToPixels(pixels);
cout<<_currentAnalysis->meshFileName<<endl;
ofSaveImage(pixels,_currentAnalysis->meshFileName, OF_IMAGE_QUALITY_BEST); ofSaveImage(pixels,_currentAnalysis->meshFileName, OF_IMAGE_QUALITY_BEST);
//saving jpgs doesn't work maybe because of of_image_quality //saving jpgs doesn't work maybe because of of_image_quality

View File

@ -195,6 +195,8 @@ void IResponseAnalysis::synthesise()
setMeshFromPixels(make3DZmap(image1, image5, _background), image1,image5, aMesh); setMeshFromPixels(make3DZmap(image1, image5, _background), image1,image5, aMesh);
//with jpgs this was refusing to save out //with jpgs this was refusing to save out
meshFileName = _whole_file_path_synthesis+"/"+ofToString(_synth_save_cnt, 2)+"_IResponseSynthesis_"+ofToString(_run_cnt,2)+".png"; meshFileName = _whole_file_path_synthesis+"/"+ofToString(_synth_save_cnt, 2)+"_IResponseSynthesis_"+ofToString(_run_cnt,2)+".png";
_saved_filenames_synthesis.push_back(meshFileName);
//flag that we are finished //flag that we are finished
meshIsComplete=true; meshIsComplete=true;
_synth_save_cnt++; _synth_save_cnt++;
@ -484,9 +486,10 @@ ofPixels IResponseAnalysis::make3DZmap(ofImage &image1, ofImage &image2, ofImage
ofColor colourImage2 = imagePixels2.getColor(x, y); ofColor colourImage2 = imagePixels2.getColor(x, y);
float _distanceToCentre=ofDist(imagePixels1.getWidth()/2, imagePixels1.getHeight()/2, x, y); float _distanceToCentre=ofDist(imagePixels1.getWidth()/2, imagePixels1.getHeight()/2, x, y);
float _presumedBrightness=ofMap( sqrt(_distanceToCentre), 0, sqrt(_maxPossibleDistanceToCentre), 0, 255); float _presumedBrightness=ofMap( sqrt(_maxPossibleDistanceToCentre)-sqrt(_distanceToCentre), 0, sqrt(_maxPossibleDistanceToCentre), 0, 255);
//float _presumedBrightness=255;
int thisDiff=abs(colourImage1.getBrightness()-_presumedBrightness); int thisDiff=abs(colourImage1.getBrightness()-_presumedBrightness);
//cout<<thisDiff<< " thisDiff "<<endl;
thesePixels[i]=thisDiff; thesePixels[i]=thisDiff;
thesePixels[i+1]=thisDiff; thesePixels[i+1]=thisDiff;