From 0dc006af449bf3a089dd818c393dffcaaf6bf603 Mon Sep 17 00:00:00 2001 From: Jamie Allen Date: Fri, 11 May 2012 17:15:24 +0200 Subject: [PATCH] fixes in preparation for Future Everything renders tonight --- example/RefractiveIndex.cpp | 15 ++++++++------- src/CamNoiseAnalysis.cpp | 2 +- src/ColorMultiAnalysis.cpp | 16 ++++++++-------- src/ColorSingleAnalysis.cpp | 33 +++++++++++++++----------------- src/DiffNoiseAnalysis.cpp | 4 ++-- src/RelaxRateAnalysis.cpp | 4 ++-- src/ShapeFromShadingAnalysis.cpp | 4 ++-- src/StrobeAnalysis.cpp | 6 +++--- 8 files changed, 41 insertions(+), 43 deletions(-) diff --git a/example/RefractiveIndex.cpp b/example/RefractiveIndex.cpp index 7db8f9e..7afb8c2 100644 --- a/example/RefractiveIndex.cpp +++ b/example/RefractiveIndex.cpp @@ -46,8 +46,6 @@ void RefractiveIndex::setup() ofBackground(0, 0, 0); ofSetBackgroundAuto(false); - - //camera.setOrientation(ofVec3f(1,-1,1)); bool save_config = false; cout << "Loading configuration..." << endl; @@ -155,8 +153,11 @@ void RefractiveIndex::start_analysis() //allocate fbo for HD fbo.allocate(1920,1080); -// fbo.allocate( _currentAnalysis->_mesh_size_multiplier *_vid_w,_currentAnalysis->_mesh_size_multiplier * _vid_h); - camera.setPosition(fbo.getWidth()/2, fbo.getHeight()/2,_currentAnalysis->_mesh_size_multiplier *500); + // fbo.allocate( _currentAnalysis->_mesh_size_multiplier *_vid_w,_currentAnalysis->_mesh_size_multiplier * _vid_h); + //camera.setPosition((fbo.getWidth()/2), fbo.getHeight()/2,_currentAnalysis->_mesh_size_multiplier *500); + camera.setPosition(0, (fbo.getHeight()/2)+250, _currentAnalysis->_mesh_size_multiplier*500); + camera.setFov(65.0); + camera.setOrientation(ofVec3f(-2,0,0)); _meshRotation=0; } @@ -245,12 +246,12 @@ void RefractiveIndex::draw() ofPopMatrix(); ofSetColor(255); */ - + //float xDiff= (fbo.getWidth()- 1.55*(_currentAnalysis->_mesh_size_multiplier * _vid_w))/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; + float yDiff= (fbo.getHeight()-(_currentAnalysis->_mesh_size_multiplier * _vid_h))/2; ofTranslate(xDiff,yDiff,-_currentAnalysis->zPlaneAverage ); - ofScale(1.33333,1.0,1.0); + //ofScale(1.33333,1.0,1.0); //_currentAnalysis->aMesh.drawVertices(); // TODO: tom - why do you have the vertices drawing here? _currentAnalysis->aMesh.drawFaces(); _currentAnalysis->aMesh.draw(); diff --git a/src/CamNoiseAnalysis.cpp b/src/CamNoiseAnalysis.cpp index cfff8a0..ff653db 100755 --- a/src/CamNoiseAnalysis.cpp +++ b/src/CamNoiseAnalysis.cpp @@ -25,7 +25,7 @@ void CamNoiseAnalysis::setup(int camWidth, int camHeight) //flag for main sketch meshIsComplete=false; _gotFirstImage=false; - _mesh_size_multiplier = 15; + _mesh_size_multiplier = 8; vertexSubsampling = 1; chooseColour = 5; multiplier = 4.0; diff --git a/src/ColorMultiAnalysis.cpp b/src/ColorMultiAnalysis.cpp index 37bd861..f1e86bf 100755 --- a/src/ColorMultiAnalysis.cpp +++ b/src/ColorMultiAnalysis.cpp @@ -24,7 +24,7 @@ void ColorMultiAnalysis::setup(int camWidth, int camHeight) meshIsComplete=false; _gotFirstImage=false; - _mesh_size_multiplier=5; + _mesh_size_multiplier=8; vertexSubsampling = 1; chooseColour=1; @@ -170,8 +170,8 @@ void ColorMultiAnalysis::synthesise() //cvFloatImage1 = cvColorImage1; //cvGrayImage1 = cvColorImage1; - cvSmooth( cvColorImage1.getCvImage(), cvColorImage1.getCvImage(), CV_GAUSSIAN, 9, 9); - cvXorS( cvColorImage1.getCvImage(), cvScalarAll(1), cvColorImage1.getCvImage(), 0 ); + cvSmooth( cvColorImage1.getCvImage(), cvColorImage1.getCvImage(), CV_GAUSSIAN, 15, 15); + cvXorS( cvColorImage1.getCvImage(), cvScalarAll(2), cvColorImage1.getCvImage(), 0 ); //cvCanny(cvGrayImage1.getCvImage(), cvGrayImage1.getCvImage(), 100, 100, 3); //cvLaplace(cvGrayImage1.getCvImage(), cvGrayImage1.getCvImage(), 0); @@ -596,21 +596,21 @@ vector ColorMultiAnalysis::_returnDepthsAtEachPixel(ofImage &image1, ofIm if(chooseComparison==1){ //for each pixel... - float _maxPossibleDistanceToCentre=ofDist(0,0,imagePixels1.getWidth()/2, imagePixels1.getHeight()/2); + //float _maxPossibleDistanceToCentre=ofDist(0,0,imagePixels1.getWidth()/2, imagePixels1.getHeight()/2); for(int i=0;i ColorMultiAnalysis::_returnDepthsAtEachPixel(ofImage &image1, ofIm //green hue: 120 //blue hue: 240 - float multiplier=5.0; + float multiplier=15.0*((thisDiff)/255.0); differences.push_back(multiplier* thisDiff); diff --git a/src/ColorSingleAnalysis.cpp b/src/ColorSingleAnalysis.cpp index 0be3978..568c92d 100755 --- a/src/ColorSingleAnalysis.cpp +++ b/src/ColorSingleAnalysis.cpp @@ -26,12 +26,10 @@ void ColorSingleAnalysis::setup(int camWidth, int camHeight) //flag for main sketch meshIsComplete=false; _gotFirstImage=false; - _mesh_size_multiplier=4; - vertexSubsampling = 5; + _mesh_size_multiplier=8; + vertexSubsampling = 1; chooseColour=1; - - int acq_run_time; // 10 seconds of acquiring per run acq_run_time = RefractiveIndex::XML.getValue("config:analysis_time:acquiretime_colorsingle", ACQUIRE_TIME); cout << "ACQUIRE_TIME ColorSingleAnalysis " << acq_run_time << endl; @@ -190,9 +188,8 @@ void ColorSingleAnalysis::synthesise() cvColorImage1.blur(1); - cvSmooth( cvGrayImage1.getCvImage(), cvGrayImage1.getCvImage(), CV_GAUSSIAN, 3, 3 ); + //cvSmooth( cvGrayImage1.getCvImage(), cvGrayImage1.getCvImage(), CV_GAUSSIAN, 9, 9 ); - cvColorImage1.erode(); cvSmooth( cvGrayImage1.getCvImage(), cvGrayImage1.getCvImage(), CV_GAUSSIAN, 3, 3 ); @@ -327,9 +324,9 @@ void ColorSingleAnalysis::draw() glEnable(GL_DEPTH_TEST); - //ofSetLineWidth(1.0f); - glPointSize(4.0f); - + ofSetLineWidth(1.0f); + // glPointSize(4.0f); + ofEnableBlendMode ( OF_BLENDMODE_ADD ); //ofEnableBlendMode ( OF_BLENDMODE_MULTIPLY ); //ofEnableBlendMode ( OF_BLENDMODE_SUBTRACT ); @@ -545,10 +542,10 @@ void ColorSingleAnalysis::setMeshFromPixels(vector sPixels, ofImage curre //mesh.setMode(OF_PRIMITIVE_TRIANGLES); //mesh.setMode(OF_PRIMITIVE_TRIANGLE_STRIP); //mesh.setMode(OF_PRIMITIVE_TRIANGLE_FAN); - //mesh.setMode(OF_PRIMITIVE_LINES); + mesh.setMode(OF_PRIMITIVE_LINES); //mesh.setMode(OF_PRIMITIVE_LINE_STRIP); //mesh.setMode(OF_PRIMITIVE_LINE_LOOP); - mesh.setMode(OF_PRIMITIVE_POINTS); + //mesh.setMode(OF_PRIMITIVE_POINTS); /* OF_PRIMITIVE_TRIANGLES, @@ -661,21 +658,21 @@ void ColorSingleAnalysis::setMeshFromPixels(vector sPixels, ofImage curre if(fileNameColor=="RED") { currentSecondImageColor.r=255; - currentSecondImageColor.g=75; - currentSecondImageColor.b=75; + currentSecondImageColor.g=0; + currentSecondImageColor.b=0; currentSecondImageColor.a=255; } else if(fileNameColor=="GREEN") { - currentSecondImageColor.r=75; + currentSecondImageColor.r=0; currentSecondImageColor.g=255; - currentSecondImageColor.b=75; + currentSecondImageColor.b=0; currentSecondImageColor.a=255; } else if(fileNameColor=="BLUE") { - currentSecondImageColor.r=75; - currentSecondImageColor.g=75; + currentSecondImageColor.r=0; + currentSecondImageColor.g=0; currentSecondImageColor.b=255; currentSecondImageColor.a=255; @@ -792,7 +789,7 @@ vector ColorSingleAnalysis::_returnDepthsAtEachPixel(ofImage &image1, ofI //green hue: 120 //blue hue: 240 - float multiplier=2.0; + float multiplier=3.0; differences.push_back(multiplier* thisDiff); diff --git a/src/DiffNoiseAnalysis.cpp b/src/DiffNoiseAnalysis.cpp index 8d5d12e..b91eff5 100755 --- a/src/DiffNoiseAnalysis.cpp +++ b/src/DiffNoiseAnalysis.cpp @@ -25,10 +25,10 @@ void DiffNoiseAnalysis::setup(int camWidth, int camHeight) //flag for main sketch meshIsComplete=false; _gotFirstImage=false; - _mesh_size_multiplier = 2; + _mesh_size_multiplier = 10; vertexSubsampling = 1; chooseColour = 5; - multiplier = 0.8; + multiplier = 4.0; blendMode = OF_BLENDMODE_ADD; //blendMode = OF_BLENDMODE_MULTIPLY; diff --git a/src/RelaxRateAnalysis.cpp b/src/RelaxRateAnalysis.cpp index 0ac85fc..7b32d63 100755 --- a/src/RelaxRateAnalysis.cpp +++ b/src/RelaxRateAnalysis.cpp @@ -26,11 +26,11 @@ void RelaxRateAnalysis::setup(int camWidth, int camHeight) //flag for main sketch meshIsComplete=false; _gotFirstImage=false; - _mesh_size_multiplier = 2; + _mesh_size_multiplier = 8; vertexSubsampling_x = 1; //must be at least '1' vertexSubsampling_y = 7; //must be at least '1' chooseColour = 2; - multiplier = 1; + multiplier = 3.0; //blendMode = OF_BLENDMODE_ADD; //blendMode = OF_BLENDMODE_MULTIPLY; diff --git a/src/ShapeFromShadingAnalysis.cpp b/src/ShapeFromShadingAnalysis.cpp index 70c1cc8..0c61527 100755 --- a/src/ShapeFromShadingAnalysis.cpp +++ b/src/ShapeFromShadingAnalysis.cpp @@ -24,10 +24,10 @@ void ShapeFromShadingAnalysis::setup(int camWidth, int camHeight) //flag for main sketch meshIsComplete=false; _gotFirstImage=false; - _mesh_size_multiplier = 15; + _mesh_size_multiplier = 8; vertexSubsampling = 1; chooseColour = 5; - multiplier = 4.0; + multiplier = 3.0; ofSetLineWidth(5.0f); glPointSize(5.0f); diff --git a/src/StrobeAnalysis.cpp b/src/StrobeAnalysis.cpp index 65ffa2c..49e9bda 100755 --- a/src/StrobeAnalysis.cpp +++ b/src/StrobeAnalysis.cpp @@ -24,10 +24,10 @@ void StrobeAnalysis::setup(int camWidth, int camHeight) //flag for main sketch meshIsComplete=false; _gotFirstImage=false; - _mesh_size_multiplier = 1; - vertexSubsampling = 2; + _mesh_size_multiplier = 8; + vertexSubsampling = 3; chooseColour = 2; - multiplier = 0.5; + multiplier = 2.0; //blendMode = OF_BLENDMODE_ADD; //blendMode = OF_BLENDMODE_MULTIPLY;