converting cv images properly (thanks Tom) and possible fix for Windows saving of greyscale images
cvColorImage1.convertToGrayscalePlanarImage(cvGrayImage1, 1); cvColorImage2.convertToGrayscalePlanarImage(cvGrayImage2, 1);
This commit is contained in:
parent
0d62dbd135
commit
1f23d167c2
@ -153,17 +153,16 @@ 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);
|
||||
|
||||
//#elif defined(TARGET_WIN32)
|
||||
#elif defined(TARGET_WIN32)
|
||||
|
||||
if (newType == OF_IMAGE_COLOR){
|
||||
myColorImage2.setUseTexture(false);
|
||||
myColorImage2.setFromPixels(newPixels->getPixels(), newPixels->getWidth(), newPixels->getHeight(), OF_IMAGE_COLOR);
|
||||
myColorImage2.saveImage(_whole_file_path_synthesis+"/"+filename);
|
||||
myColorImage2.clear();
|
||||
}
|
||||
|
||||
if (newType == OF_IMAGE_GRAYSCALE){
|
||||
@ -171,16 +170,16 @@ 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());
|
||||
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.saveImage(_whole_file_path_synthesis+"/"+filename);
|
||||
myGrayImage1.clear();
|
||||
}
|
||||
|
||||
//#endif
|
||||
#endif
|
||||
|
||||
_saved_filenames_synthesis.push_back(_whole_file_path_synthesis+"/"+filename);
|
||||
|
||||
|
||||
@ -146,8 +146,8 @@ void CamNoiseAnalysis::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);
|
||||
|
||||
//cvGrayDiff1.absDiff(cvGrayImage2, cvGrayImage1);
|
||||
cvGrayImage1.erode();
|
||||
|
||||
@ -151,16 +151,6 @@ void ColorSingleAnalysis::synthesise()
|
||||
cvColorImage1.setFromPixels(image1.getPixels(), image1.width, image1.height);
|
||||
//cvColorImage2.setFromPixels(image5.getPixels(), image5.width, image5.height);
|
||||
|
||||
//cvGrayImage1 = cvColorImage1;
|
||||
//cvGrayImage2 = cvColorImage2;
|
||||
|
||||
//cvGrayDiff1.absDiff(cvGrayImage2, cvGrayImage1);
|
||||
//cvGrayDiff1.erode();
|
||||
//cvGrayDiff1.contrastStretch();
|
||||
//cvGrayDiff1.blur(5);
|
||||
//cvGrayDiff1.dilate();
|
||||
//cvGrayDiff1.contrastStretch();
|
||||
|
||||
cvColorImage1.blur(5);
|
||||
cvColorImage1.erode();
|
||||
cvColorImage1.erode();
|
||||
|
||||
@ -146,8 +146,8 @@ void IResponseAnalysis::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);
|
||||
|
||||
cvGrayDiff1.absDiff(cvGrayImage2, cvGrayImage1);
|
||||
cvGrayDiff1.erode();
|
||||
|
||||
@ -139,7 +139,9 @@ void RelaxRateAnalysis::synthesise()
|
||||
///////////////////////// PROCESS THE SAVED CAMERA IMAGES OF SHIT TO THE IMAGES //////////////////////////
|
||||
|
||||
cvColorImage1.setFromPixels(image1.getPixels(), image1.width, image1.height);
|
||||
cvGrayDiff1 = cvColorImage1;
|
||||
|
||||
cvColorImage1.convertToGrayscalePlanarImage(cvGrayImage1, 1);
|
||||
|
||||
cvGrayDiff1.threshold(_treshold);
|
||||
|
||||
rfiCvContourFinder* cf = new rfiCvContourFinder();
|
||||
|
||||
@ -143,8 +143,8 @@ 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);
|
||||
|
||||
cvGrayDiff1.absDiff(cvGrayImage2, cvGrayImage1);
|
||||
cvGrayDiff1.erode();
|
||||
|
||||
@ -165,8 +165,8 @@ void ShapeFromShadingAnalysis::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);
|
||||
|
||||
cvGrayDiff1.absDiff(cvGrayImage2, cvGrayImage1);
|
||||
cvGrayDiff1.erode();
|
||||
|
||||
@ -147,8 +147,8 @@ void StrobeAnalysis::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);
|
||||
|
||||
cvGrayDiff1.absDiff(cvGrayImage2, cvGrayImage1);
|
||||
cvGrayDiff1.dilate();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user