diff --git a/config.refindx b/config.refindx index 8f73c79..09078e1 100644 --- a/config.refindx +++ b/config.refindx @@ -1,45 +1,45 @@ - - 1 - 640 - 480 - - - 30 - - - SWANSEA - + +1 +640 +480 + + +30 + + +SWANSEA + - - 3 - 3 - 3 - 3 - 5 - 5 - 5 - 5 - 3 - + + 3 + 3 + 3 + 3 + 5 + 5 + 5 + 5 + 3 + + + + 30 + 30 + 30 + 30 + 30 + 30 + 40 + 40 + 30 + + + +51 +25 + - - 30 - 30 - 30 - 30 - 30 - 30 - 40 - 40 - 30 - - - - 51 - 25 - - \ No newline at end of file diff --git a/src/CamNoiseAnalysis.cpp b/src/CamNoiseAnalysis.cpp index b2fd2b5..078e3a8 100755 --- a/src/CamNoiseAnalysis.cpp +++ b/src/CamNoiseAnalysis.cpp @@ -151,17 +151,17 @@ void CamNoiseAnalysis::synthesise() //cvColorImage2.setFromPixels(image5.getPixels(), image5.width, image5.height); cvColorImage1.convertToGrayscalePlanarImage(cvGrayImage1, 1); - // cvColorImage2.convertToGrayscalePlanarImage(cvGrayImage2, 1); + // cvColorImage2.convertToGrayscalePlanarImage(cvGrayImage2, 1); //added by tom we weren't actually setting cvgrayimage1 anywhere // cvGrayImage1.setFromPixels(cvColorImage1.getPixels(),cvColorImage1.width,cvColorImage1.height); //cvGrayDiff1.absDiff(cvGrayImage2, cvGrayImage1); -//cvGrayImage1=cvColorImage1; - +//cvGrayImage1=cvColorImage1; + cvGrayImage1.erode(); cvGrayImage1.erode(); cvGrayImage1.erode(); cvGrayImage1.blur(); - cvGrayImage1.contrastStretch(); + cvGrayImage1.contrastStretch(); /* cvColorImage1.erode(); cvColorImage1.erode(); cvColorImage1.erode(); diff --git a/src/ColorMultiAnalysis.cpp b/src/ColorMultiAnalysis.cpp index ab2b8a0..df52677 100755 --- a/src/ColorMultiAnalysis.cpp +++ b/src/ColorMultiAnalysis.cpp @@ -246,8 +246,6 @@ void ColorMultiAnalysis::draw() //cout << "FADING IN..." << endl; } - - if (_frame_cnt >= _fade_in_frames && _frame_cnt < _frame_cnt_max-_fade_in_frames){ aColor.setHsb(c, 255, 255); diff --git a/src/ColorSingleAnalysis.cpp b/src/ColorSingleAnalysis.cpp index aa00795..ec056f8 100755 --- a/src/ColorSingleAnalysis.cpp +++ b/src/ColorSingleAnalysis.cpp @@ -105,7 +105,7 @@ void ColorSingleAnalysis::acquire() Timer* save_timer; TimerCallback save_callback(*this, &ColorSingleAnalysis::save_cb); - + _run_cnt++; _frame_cnt = 0; _save_cnt = 0; _anim_cnt = 0, _synth_save_cnt = 0; _RUN_DONE = false; @@ -124,7 +124,6 @@ void ColorSingleAnalysis::acquire() save_timer->stop(); - // } } @@ -135,13 +134,108 @@ void ColorSingleAnalysis::synthesise() if(_state == STATE_STOP) return; for(float i=1;i<_saved_filenames_analysis.size()-1;i++){ - + //cout << "ColorSingleAnalysis::synthesis FOR LOOP...\n"; - //cout << "_saved_filenames_analysis[i]" << _saved_filenames_analysis[i] << endl; if(_state == STATE_STOP) return; + image1.loadImage("Mar_02_19_00_47_2/194_9.72_1.jpg"); + image1.resize(image1.width/20, image1.height/20); + + int width = image1.width; + int height = image1.height; + + // get the pixels from the image + imagePixels = image1.getPixels(); + + // ------------------- create the vector field ------------------------------------ + + vectorCount = width * height; + + // create a 2d vector field + vectorField = new ofVec2f[vectorCount]; + + // set all values in vector field to 0.0 + for(int i=0; i maxMagX) maxMagX = fabs(vectorField[i].x); + if(fabs(vectorField[i].y) > maxMagY) maxMagY = fabs(vectorField[i].y); + } + + // loop through the vector field to normalize the values + for(int i=0; i< vectorCount; i++){ + + vectorField[i].x /= maxMagX; + vectorField[i].y /= maxMagY; + } + + + + + // COMMENTING OUT THE FILLER SYNTH ALGORITHM + /* if(!image1.loadImage(_saved_filenames_analysis[i])){ //couldn't load image cout << "didn't load image" << endl; @@ -180,7 +274,7 @@ void ColorSingleAnalysis::synthesise() //ofImage image; //image.allocate(cvColorImage1.width, cvColorImage1.height, OF_IMAGE_COLOR); - //*** This needs to be here for OSX of we get a BAD ACCESS ERROR. DOES IT BREAK WINDOWS? ***// + // This needs to be here for OSX of we get a BAD ACCESS ERROR. DOES IT BREAK WINDOWS? //image.setUseTexture(false); //image.setFromPixels(cvColorImage1.getPixels(), cvColorImage1.width, cvColorImage1.height,OF_IMAGE_COLOR); @@ -192,9 +286,12 @@ void ColorSingleAnalysis::synthesise() saveImageSynthesis(file_name, &cvColorImage1, OF_IMAGE_COLOR); _synth_save_cnt++; - + // } - } + + } + */ + } // _saved_filenames_synthesis has processed all the files in the analysis images folder @@ -238,8 +335,6 @@ void ColorSingleAnalysis::draw() switch (_state) { case STATE_ACQUIRING: { - - if (_frame_cnt < _frame_cnt_max) { @@ -385,8 +480,42 @@ void ColorSingleAnalysis::draw() case STATE_DISPLAY_RESULTS: { - //cout << "STATE_DISPLAY_RESULTS...\n" << endl; + cout << "case STATE_DISPLAY_RESULTS = true" << endl; + + int width = image1.width; + int height = image1.height; + float spacing = 10; + if (_frame_cnt > 2) + { + _image_shown = true; + _frame_cnt=0; + } + + _frame_cnt++; + + if (_show_image) + { + cout << "_show_image = true" << endl; + + for(int x=0; x 2) { @@ -402,9 +531,9 @@ void ColorSingleAnalysis::draw() ofEnableAlphaBlending(); - ofSetColor(255, 255, 255); - image2.setFromPixels(image3.getPixels(),image3.width,image3.height, OF_IMAGE_COLOR); - image2.draw(0,0, ofGetWidth(), ofGetHeight()); + ofSetColor(255, 255, 255); + image2.setFromPixels(image3.getPixels(),image3.width,image3.height, OF_IMAGE_COLOR); + image2.draw(0,0, ofGetWidth(), ofGetHeight()); ofDisableAlphaBlending(); } @@ -412,12 +541,11 @@ void ColorSingleAnalysis::draw() // display results of the synthesis _RUN_DONE = true; break; - - - } + */ + } default: - break; + break; } } diff --git a/src/ColorSingleAnalysis.h b/src/ColorSingleAnalysis.h index 6a9a8dd..6e43992 100755 --- a/src/ColorSingleAnalysis.h +++ b/src/ColorSingleAnalysis.h @@ -65,5 +65,8 @@ protected: //this is the temporary container to allow us to convert and save out greyscale images ofxCvColorImage cvConvertorImage; - + unsigned char * imagePixels; + int vectorCount; + ofVec2f * vectorField; + }; diff --git a/src/RelaxRateAnalysis.cpp b/src/RelaxRateAnalysis.cpp index 9329a77..9fbdf2a 100755 --- a/src/RelaxRateAnalysis.cpp +++ b/src/RelaxRateAnalysis.cpp @@ -12,7 +12,7 @@ using Poco::Thread; #define NUMBER_RUNS 1 #define ACQUIRE_TIME 20 -#define TRESHOLD 80 +#define THRESHOLD 80 #define MAXBLOBS 15 void RelaxRateAnalysis::setup(int camWidth, int camHeight) @@ -25,8 +25,8 @@ void RelaxRateAnalysis::setup(int camWidth, int camHeight) acq_run_time = RefractiveIndex::XML.getValue("config:analysis_time:acquiretime_relaxrate", ACQUIRE_TIME); cout << "ACQUIRE_TIME RelaxRateAnalysis " << acq_run_time << endl; - _treshold = RefractiveIndex::XML.getValue("config:relaxrate:treshold", TRESHOLD); - cout << "TRESHOLD RelaxRateAnalysis " << _treshold << endl; + _threshold = RefractiveIndex::XML.getValue("config:relaxrate:threshold", THRESHOLD); + cout << "THRESHOLD RelaxRateAnalysis " << _threshold << endl; _maxblobs = RefractiveIndex::XML.getValue("config:relaxrate:maxblobs", MAXBLOBS); cout << "MAXBLOBS RelaxRateAnalysis " << _maxblobs << endl; @@ -116,7 +116,7 @@ void RelaxRateAnalysis::synthesise() cvColorImage1.setFromPixels(image1.getPixels(), image1.width, image1.height); cvColorImage1.convertToGrayscalePlanarImage(cvGrayDiff1, 1); - cvGrayDiff1.threshold(_treshold); + cvGrayDiff1.threshold(_threshold); rfiCvContourFinder* cf = new rfiCvContourFinder(); diff --git a/src/RelaxRateAnalysis.h b/src/RelaxRateAnalysis.h index f354d3d..7b03f18 100755 --- a/src/RelaxRateAnalysis.h +++ b/src/RelaxRateAnalysis.h @@ -39,7 +39,7 @@ protected: int _run_cnt, _save_cnt, _synth_save_cnt, _anim_cnt; float c, _frame_cnt, _frame_cnt_max, _anim_cnt_max; - int _treshold; + int _threshold; int _maxblobs; bool _show_image, _image_shown;