possible Windows saving greyscale fix (convert to COLOR before saving)

This commit is contained in:
Jamie Allen 2012-02-27 20:23:08 +01:00
parent 1f23d167c2
commit 86769bfc5f
3 changed files with 10 additions and 10 deletions

View File

@ -97,17 +97,15 @@ void AbstractAnalysis::create_dir_allocate_images()
//////////////////////////////ALLOCATE IMAGES //////////////////////////////////////////////////
ofImage myColorImage1;
myColorImage1.clear();
myColorImage1.setUseTexture(false);
myColorImage1.allocate(RefractiveIndex::_vid_w, RefractiveIndex::_vid_h, OF_IMAGE_COLOR);
//ofxCvImage myColorCvImage2;
myColorImage2.clear();
myColorImage2.setUseTexture(false);
myColorImage2.allocate(RefractiveIndex::_vid_w, RefractiveIndex::_vid_h, OF_IMAGE_COLOR);
//ofxCvImage myGrayCvImage1;
myGrayImage1.clear();
myGrayImage1.setUseTexture(false);
myGrayImage1.allocate(RefractiveIndex::_vid_w, RefractiveIndex::_vid_h, OF_IMAGE_GRAYSCALE);
@ -153,11 +151,11 @@ void AbstractAnalysis::saveImageAnalysis(string filename)
void AbstractAnalysis::saveImageSynthesis(string filename, ofxCvImage* newPixels, ofImageType newType)
{
#ifdef TARGET_OSX
//#ifdef TARGET_OSX
// ofSaveImage(newPixels->getPixelsRef(), _whole_file_path_synthesis+"/"+filename, OF_IMAGE_QUALITY_BEST);
// ofSaveImage(newPixels->getPixelsRef(), _whole_file_path_synthesis+"/"+filename, OF_IMAGE_QUALITY_BEST);
#elif defined(TARGET_WIN32)
//#elif defined(TARGET_WIN32)
if (newType == OF_IMAGE_COLOR){
myColorImage2.setUseTexture(false);
@ -171,7 +169,7 @@ 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);
//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);
@ -179,7 +177,7 @@ void AbstractAnalysis::saveImageSynthesis(string filename, ofxCvImage* newPixels
myGrayImage1.saveImage(_whole_file_path_synthesis+"/"+filename);
}
#endif
//#endif
_saved_filenames_synthesis.push_back(_whole_file_path_synthesis+"/"+filename);

View File

@ -139,8 +139,7 @@ void RelaxRateAnalysis::synthesise()
///////////////////////// PROCESS THE SAVED CAMERA IMAGES OF SHIT TO THE IMAGES //////////////////////////
cvColorImage1.setFromPixels(image1.getPixels(), image1.width, image1.height);
cvColorImage1.convertToGrayscalePlanarImage(cvGrayImage1, 1);
cvColorImage1.convertToGrayscalePlanarImage(cvGrayDiff1, 1);
cvGrayDiff1.threshold(_treshold);

View File

@ -143,6 +143,9 @@ void ShadowScapesAnalysis::synthesise()
cvColorImage1.setFromPixels(image1.getPixels(), image1.width, image1.height);
cvColorImage2.setFromPixels(image5.getPixels(), image5.width, image5.height);
//cvGrayImage1 = cvColorImage1;
//cvGrayImage2 = cvColorImage2;
cvColorImage1.convertToGrayscalePlanarImage(cvGrayImage1, 1);
cvColorImage2.convertToGrayscalePlanarImage(cvGrayImage2, 1);