fixes in preparation for Future Everything renders tonight

This commit is contained in:
Jamie Allen 2012-05-11 17:15:24 +02:00
parent 357573f81a
commit 0dc006af44
8 changed files with 41 additions and 43 deletions

View File

@ -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();

View File

@ -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;

View File

@ -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<float> 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<imagePixels1.size();i+=3){
ofColor imageColor1 = imagePixels1.getColor(x, y);
//ofColor colourImage2 = imagePixels2.getColor(x, y);
float _distanceToCentre=ofDist(imagePixels1.getWidth()/2, imagePixels1.getHeight()/2, x, y);
float _presumedBrightness=ofMap(sqrt(_maxPossibleDistanceToCentre)-sqrt(_distanceToCentre), 0, sqrt(_maxPossibleDistanceToCentre), 0, 255);
//float _distanceToCentre=ofDist(imagePixels1.getWidth()/2, imagePixels1.getHeight()/2, x, y);
//float _presumedBrightness=ofMap(sqrt(_maxPossibleDistanceToCentre)-sqrt(_distanceToCentre), 0, sqrt(_maxPossibleDistanceToCentre), 0, 255);
//int thisDiff=abs(imageColor1.getHue());
//int thisDiff=abs(imageColor1.getBrightness());
//int thisDiff=abs(imageColor1.getBrightness()-_presumedBrightness);
int thisDiff=255-abs(imageColor1.getHue());
int thisDiff=-abs(imageColor1.getHue());
//int thisDiff=abs(imageColor1.getLightness());
//cout<<thisDiff<< " thisDiff "<<endl;
@ -619,7 +619,7 @@ vector<float> 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);

View File

@ -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<float> 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<float> 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<float> ColorSingleAnalysis::_returnDepthsAtEachPixel(ofImage &image1, ofI
//green hue: 120
//blue hue: 240
float multiplier=2.0;
float multiplier=3.0;
differences.push_back(multiplier* thisDiff);

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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;