diff --git a/example/RefractiveIndex.cpp b/example/RefractiveIndex.cpp index 51c0797..e84d88c 100644 --- a/example/RefractiveIndex.cpp +++ b/example/RefractiveIndex.cpp @@ -15,7 +15,7 @@ #include "ofxXmlSettings.h" -#define CAMERA_ID 1 +#define CAMERA_ID 0 #define CAMERA_ACQU_WIDTH 640 #define CAMERA_ACQU_HEIGHT 480 @@ -99,9 +99,10 @@ void RefractiveIndex::setup() _analysisVector.push_back(new ShadowScapesAnalysis(V)); _analysisVector.push_back(new ShadowScapesAnalysis(H)); _analysisVector.push_back(new ShadowScapesAnalysis(D)); - + _analysisVector.push_back(new RelaxRateAnalysis()); + _analysisVector.push_back(new IResponseAnalysis()); _analysisVector.push_back(new ShapeFromShadingAnalysis()); @@ -114,7 +115,7 @@ void RefractiveIndex::setup() _analysisVector.push_back(new ColorMultiAnalysis()); - _analysisVector.push_back(new DiffNoiseAnalysis()); + _analysisVector.push_back(new DiffNoiseAnalysis()); //_currentAnalysisIndx = 0; diff --git a/src/AbstractAnalysis.cpp b/src/AbstractAnalysis.cpp index ae8c9b5..15e3056 100644 --- a/src/AbstractAnalysis.cpp +++ b/src/AbstractAnalysis.cpp @@ -153,6 +153,7 @@ void AbstractAnalysis::saveImageSynthesis(string filename, ofxCvImage* newPixels #ifdef TARGET_OSX + ofSaveImage(newPixels->getPixelsRef(), _whole_file_path_synthesis+"/"+filename, OF_IMAGE_QUALITY_BEST); #elif defined(TARGET_WIN32) @@ -168,13 +169,10 @@ void AbstractAnalysis::saveImageSynthesis(string filename, ofxCvImage* newPixels // THIS IS HOW YOU HAVE TO SAVE OUT THE GREYSCALE IMAGES on WINDOWS FOR SOME REASON --> i.e.: as an OF_IMAGE_COLOR // But they don't save properly - they're spatially translated and generally f'd up - myGrayImage1.setFromPixels(newPixels->getPixels(), newPixels->getWidth(), newPixels->getHeight(), OF_IMAGE_GRAYSCALE); - myGrayImage1.setImageType(OF_IMAGE_COLOR); - - // THIS DOESN' SEEM TO SAVE OUT IMAGES AT ALL ON WINDOWS - //myGrayImage1.setFromPixels(newPixels->getPixels(), newPixels->getWidth(), newPixels->getHeight(), OF_IMAGE_GRAYSCALE); - + myGrayImage1.setFromPixels(newPixels->getPixels(), newPixels->getWidth(), newPixels->getHeight(), OF_IMAGE_COLOR); + myGrayImage1.setImageType(OF_IMAGE_COLOR); myGrayImage1.saveImage(_whole_file_path_synthesis+"/"+filename); + //myGrayImage1.clear(); } #endif diff --git a/src/CamNoiseAnalysis.cpp b/src/CamNoiseAnalysis.cpp index 76d2ec0..c846854 100755 --- a/src/CamNoiseAnalysis.cpp +++ b/src/CamNoiseAnalysis.cpp @@ -80,6 +80,8 @@ void CamNoiseAnalysis::setup(int camWidth, int camHeight) cvGrayImage2.clear(); cvGrayDiff2.clear(); + cvConvertorImage.clear(); + cvColorImage1.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h); cvGrayImage1.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h); cvGrayDiff1.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h); @@ -87,6 +89,8 @@ void CamNoiseAnalysis::setup(int camWidth, int camHeight) cvColorImage2.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h); cvGrayImage2.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h); cvGrayDiff2.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h); + + cvConvertorImage.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h); } @@ -179,7 +183,9 @@ void CamNoiseAnalysis::synthesise() //_saved_filenames_synthesis.push_back(_whole_file_path_synthesis+"/"+file_name); // <--- REALLY NEW SAVING METHOD --- 26 feb 2012 --- consolidated the save function into Abstract Analysis> /// - saveImageSynthesis(file_name, &cvGrayImage1, OF_IMAGE_GRAYSCALE); + cvConvertorImage.setFromGrayscalePlanarImages(cvGrayDiff1,cvGrayDiff1,cvGrayDiff1); + + saveImageSynthesis(file_name, &cvConvertorImage, OF_IMAGE_GRAYSCALE); _synth_save_cnt++; diff --git a/src/CamNoiseAnalysis.h b/src/CamNoiseAnalysis.h index d50d31b..1d598fd 100755 --- a/src/CamNoiseAnalysis.h +++ b/src/CamNoiseAnalysis.h @@ -60,4 +60,8 @@ protected: ofxCvGrayscaleImage cvGrayImage4; ofxCvContourFinder cvContourFinder1; + + //this is the temporary container to allow us to convert and save out greyscale images + ofxCvColorImage cvConvertorImage; + }; diff --git a/src/ColorMultiAnalysis.cpp b/src/ColorMultiAnalysis.cpp index 650f043..ab2b8a0 100755 --- a/src/ColorMultiAnalysis.cpp +++ b/src/ColorMultiAnalysis.cpp @@ -77,6 +77,8 @@ void ColorMultiAnalysis::setup(int camWidth, int camHeight) cvGrayImage2.clear(); cvGrayDiff2.clear(); + cvConvertorImage.clear(); + cvColorImage1.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h); cvGrayImage1.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h); cvGrayDiff1.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h); @@ -84,6 +86,8 @@ void ColorMultiAnalysis::setup(int camWidth, int camHeight) cvColorImage2.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h); cvGrayImage2.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h); cvGrayDiff2.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h); + + cvConvertorImage.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h); } diff --git a/src/ColorMultiAnalysis.h b/src/ColorMultiAnalysis.h index b8fc504..b70c77e 100755 --- a/src/ColorMultiAnalysis.h +++ b/src/ColorMultiAnalysis.h @@ -54,5 +54,9 @@ protected: ofxCvGrayscaleImage cvGrayImage4; ofxCvContourFinder cvContourFinder1; + + //this is the temporary container to allow us to convert and save out greyscale images + ofxCvColorImage cvConvertorImage; + }; diff --git a/src/ColorSingleAnalysis.cpp b/src/ColorSingleAnalysis.cpp index a9e4d30..aa00795 100755 --- a/src/ColorSingleAnalysis.cpp +++ b/src/ColorSingleAnalysis.cpp @@ -84,6 +84,8 @@ void ColorSingleAnalysis::setup(int camWidth, int camHeight) cvGrayImage2.clear(); cvGrayDiff2.clear(); + cvConvertorImage.clear(); + cvColorImage1.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h); cvGrayImage1.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h); cvGrayDiff1.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h); @@ -91,6 +93,9 @@ void ColorSingleAnalysis::setup(int camWidth, int camHeight) cvColorImage2.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h); cvGrayImage2.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h); cvGrayDiff2.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h); + + cvConvertorImage.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h); + } @@ -184,6 +189,7 @@ void ColorSingleAnalysis::synthesise() //_saved_filenames_synthesis.push_back(_whole_file_path_synthesis+"/"+file_name); // <--- REALLY NEW SAVING METHOD --- 26 feb 2012 --- consolidated the save function into Abstract Analysis> /// + saveImageSynthesis(file_name, &cvColorImage1, OF_IMAGE_COLOR); _synth_save_cnt++; diff --git a/src/ColorSingleAnalysis.h b/src/ColorSingleAnalysis.h index 034701c..6a9a8dd 100755 --- a/src/ColorSingleAnalysis.h +++ b/src/ColorSingleAnalysis.h @@ -61,5 +61,9 @@ protected: ofxCvGrayscaleImage cvGrayImage4; ofxCvContourFinder cvContourFinder1; + + //this is the temporary container to allow us to convert and save out greyscale images + ofxCvColorImage cvConvertorImage; + }; diff --git a/src/DiffNoiseAnalysis.cpp b/src/DiffNoiseAnalysis.cpp index 55701c0..596e8ea 100755 --- a/src/DiffNoiseAnalysis.cpp +++ b/src/DiffNoiseAnalysis.cpp @@ -78,6 +78,8 @@ void DiffNoiseAnalysis::setup(int camWidth, int camHeight) cvGrayImage2.clear(); cvGrayDiff2.clear(); + cvConvertorImage.clear(); + cvColorImage1.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h); cvGrayImage1.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h); cvGrayDiff1.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h); @@ -85,6 +87,9 @@ void DiffNoiseAnalysis::setup(int camWidth, int camHeight) cvColorImage2.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h); cvGrayImage2.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h); cvGrayDiff2.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h); + + cvConvertorImage.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h); + } diff --git a/src/DiffNoiseAnalysis.h b/src/DiffNoiseAnalysis.h index 64e428f..1f4efa0 100755 --- a/src/DiffNoiseAnalysis.h +++ b/src/DiffNoiseAnalysis.h @@ -59,4 +59,8 @@ protected: ofxCvGrayscaleImage cvGrayImage4; ofxCvContourFinder cvContourFinder1; + + //this is the temporary container to allow us to convert and save out greyscale images + ofxCvColorImage cvConvertorImage; + }; diff --git a/src/IResponseAnalysis.cpp b/src/IResponseAnalysis.cpp index 937519a..16a377a 100755 --- a/src/IResponseAnalysis.cpp +++ b/src/IResponseAnalysis.cpp @@ -78,6 +78,8 @@ void IResponseAnalysis::setup(int camWidth, int camHeight) cvGrayImage2.clear(); cvGrayDiff2.clear(); + cvConvertorImage.clear(); + cvColorImage1.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h); cvGrayImage1.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h); cvGrayDiff1.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h); @@ -86,6 +88,7 @@ void IResponseAnalysis::setup(int camWidth, int camHeight) cvGrayImage2.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h); cvGrayDiff2.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h); + cvConvertorImage.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h); } @@ -178,9 +181,10 @@ void IResponseAnalysis::synthesise() // <--- REALLY NEW SAVING METHOD --- 26 feb 2012 --- consolidated the save function into Abstract Analysis> /// - saveImageSynthesis(file_name, &cvGrayDiff1, OF_IMAGE_GRAYSCALE); - _synth_save_cnt++; + cvConvertorImage.setFromGrayscalePlanarImages(cvGrayDiff1,cvGrayDiff1,cvGrayDiff1); + saveImageSynthesis(file_name, &cvConvertorImage, OF_IMAGE_GRAYSCALE); + _synth_save_cnt++; } } } diff --git a/src/IResponseAnalysis.h b/src/IResponseAnalysis.h index ca7a41d..ebd471f 100755 --- a/src/IResponseAnalysis.h +++ b/src/IResponseAnalysis.h @@ -58,4 +58,8 @@ protected: ofxCvGrayscaleImage cvGrayImage4; ofxCvContourFinder cvContourFinder1; + + //this is the temporary container to allow us to convert and save out greyscale images + ofxCvColorImage cvConvertorImage; + }; diff --git a/src/ShadowScapesAnalysis.cpp b/src/ShadowScapesAnalysis.cpp index f85b517..f68da29 100755 --- a/src/ShadowScapesAnalysis.cpp +++ b/src/ShadowScapesAnalysis.cpp @@ -86,6 +86,8 @@ void ShadowScapesAnalysis::setup(int camWidth, int camHeight) cvGrayImage2.clear(); cvGrayDiff2.clear(); + cvConvertorImage.clear(); + cvColorImage1.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h); cvGrayImage1.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h); cvGrayDiff1.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h); @@ -93,6 +95,9 @@ void ShadowScapesAnalysis::setup(int camWidth, int camHeight) cvColorImage2.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h); cvGrayImage2.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h); cvGrayDiff2.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h); + + cvConvertorImage.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h); + } void ShadowScapesAnalysis::acquire() @@ -189,7 +194,9 @@ void ShadowScapesAnalysis::synthesise() //_saved_filenames_synthesis.push_back(_whole_file_path_synthesis+"/"+file_name); // <--- REALLY NEW SAVING METHOD --- 26 feb 2012 --- consolidated the save function into Abstract Analysis> /// - saveImageSynthesis(file_name, &cvGrayDiff1, OF_IMAGE_GRAYSCALE); + cvConvertorImage.setFromGrayscalePlanarImages(cvGrayDiff1,cvGrayDiff1,cvGrayDiff1); + + saveImageSynthesis(file_name, &cvConvertorImage, OF_IMAGE_GRAYSCALE); _synth_save_cnt++; } } diff --git a/src/ShadowScapesAnalysis.h b/src/ShadowScapesAnalysis.h index ed3256a..9a3b89a 100755 --- a/src/ShadowScapesAnalysis.h +++ b/src/ShadowScapesAnalysis.h @@ -65,5 +65,8 @@ protected: ofxCvGrayscaleImage cvGrayImage4; ofxCvContourFinder cvContourFinder1; + + //this is the temporary container to allow us to convert and save out greyscale images + ofxCvColorImage cvConvertorImage; }; \ No newline at end of file diff --git a/src/ShapeFromShadingAnalysis.cpp b/src/ShapeFromShadingAnalysis.cpp index b5d085e..1780ad7 100755 --- a/src/ShapeFromShadingAnalysis.cpp +++ b/src/ShapeFromShadingAnalysis.cpp @@ -78,6 +78,8 @@ void ShapeFromShadingAnalysis::setup(int camWidth, int camHeight) cvGrayImage2.clear(); cvGrayDiff2.clear(); + cvConvertorImage.clear(); + cvColorImage1.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h); cvGrayImage1.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h); cvGrayDiff1.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h); @@ -85,6 +87,8 @@ void ShapeFromShadingAnalysis::setup(int camWidth, int camHeight) cvColorImage2.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h); cvGrayImage2.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h); cvGrayDiff2.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h); + + cvConvertorImage.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h); } @@ -198,7 +202,9 @@ void ShapeFromShadingAnalysis::synthesise() // <--- REALLY NEW SAVING METHOD --- 26 feb 2012 --- consolidated the save function into Abstract Analysis> /// - saveImageSynthesis(file_name, &cvGrayDiff1, OF_IMAGE_GRAYSCALE); + cvConvertorImage.setFromGrayscalePlanarImages(cvGrayDiff1,cvGrayDiff1,cvGrayDiff1); + + saveImageSynthesis(file_name, &cvConvertorImage, OF_IMAGE_GRAYSCALE); _synth_save_cnt++; } diff --git a/src/ShapeFromShadingAnalysis.h b/src/ShapeFromShadingAnalysis.h index 31c5fed..4c94812 100755 --- a/src/ShapeFromShadingAnalysis.h +++ b/src/ShapeFromShadingAnalysis.h @@ -78,4 +78,8 @@ protected: ofxCvGrayscaleImage cvGrayImage4; ofxCvContourFinder cvContourFinder1; + + //this is the temporary container to allow us to convert and save out greyscale images + ofxCvColorImage cvConvertorImage; + }; diff --git a/src/StrobeAnalysis.cpp b/src/StrobeAnalysis.cpp index b671893..d96b1a9 100755 --- a/src/StrobeAnalysis.cpp +++ b/src/StrobeAnalysis.cpp @@ -79,6 +79,8 @@ void StrobeAnalysis::setup(int camWidth, int camHeight) cvGrayImage2.clear(); cvGrayDiff2.clear(); + cvConvertorImage.clear(); + cvColorImage1.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h); cvGrayImage1.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h); cvGrayDiff1.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h); @@ -86,6 +88,8 @@ void StrobeAnalysis::setup(int camWidth, int camHeight) cvColorImage2.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h); cvGrayImage2.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h); cvGrayDiff2.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h); + + cvConvertorImage.allocate(RefractiveIndex::_vid_w,RefractiveIndex::_vid_h); } @@ -180,7 +184,9 @@ void StrobeAnalysis::synthesise() // <--- REALLY NEW SAVING METHOD --- 26 feb 2012 --- consolidated the save function into Abstract Analysis> /// - saveImageSynthesis(file_name, &cvGrayDiff1, OF_IMAGE_GRAYSCALE); + cvConvertorImage.setFromGrayscalePlanarImages(cvGrayDiff1,cvGrayDiff1,cvGrayDiff1); + + saveImageSynthesis(file_name, &cvConvertorImage, OF_IMAGE_GRAYSCALE); _synth_save_cnt++; diff --git a/src/StrobeAnalysis.h b/src/StrobeAnalysis.h index dfb4fd7..90d64d2 100755 --- a/src/StrobeAnalysis.h +++ b/src/StrobeAnalysis.h @@ -64,5 +64,8 @@ protected: ofxCvGrayscaleImage cvGrayImage4; ofxCvContourFinder cvContourFinder1; + + //this is the temporary container to allow us to convert and save out greyscale images + ofxCvColorImage cvConvertorImage; };