bool ImageDataFloat2ndStageBinaryCombined::WriteImageData(unsigned int iImg) { CImageCacheElement *pImgElem; unsigned int iFeature; char strPostfix[100]; pImgElem = &(vectImageData[iImg]); if (pImgElem->bLoaded==false) { cout<<"Cannot write feature images "<<iImg<<": not loaded"<<endl; return false; } for (iFeature=0; iFeature<pImgElem->vectFeatures.size(); iFeature++) { sprintf(strPostfix, "_%03d.dat", iFeature); if (WriteImageIntOrFloat(pImgElem->vectFeatures[iFeature], (pImgElem->strFeatureImagesPath + strPostfix).c_str())==false) { cout<<"Cannot write feature image ("<<iImg<<","<<iFeature<<") to "<<pImgElem->strFeatureImagesPath + strPostfix<<endl; return false; } } if (bUseIntegralImages==true) { for (iFeature=0; iFeature<pImgElem->vectFeaturesIntegral.size(); iFeature++) { sprintf(strPostfix, "_%03d.dat", iFeature); if (WriteImageIntOrFloat(pImgElem->vectFeaturesIntegral[iFeature], (pImgElem->strFeatureImagesIntegralPath + strPostfix).c_str())==false) { cout<<"Cannot write feature image integral ("<<iImg<<","<<iFeature<<") to "<<pImgElem->strFeatureImagesIntegralPath + strPostfix<<endl; return false; } } } return true; }
bool ImageDataFloat2ndStageCombined::WriteImageData(unsigned int iImg) { CImageCacheElement *pImgElem; unsigned int iLabel, iIntegral; char strLabel[10]; const char strPostfixes[6][10] = {"_one.dat", "_x.dat", "_y.dat", "_xx.dat", "_yy.dat", "_xy.dat"}; string strFilename; pImgElem = &(vectImageData[iImg]); if (pImgElem->bLoaded==false) { cout<<"ImageDataFloat2ndStageCombined: cannot write label integral images "<<iImg<<": not loaded"<<endl; return false; } if (pImgElem->vectFeaturesIntegral.size()!=6*NO_LABELS) { cout<<"ImageDataFloat2ndStageCombined: cannot write label integral images "<<iImg<<": vector does not have the required size"<<endl; return false; } for (iLabel=0; iLabel<NO_LABELS; iLabel++) { sprintf(strLabel, "_%02d", iLabel); for (iIntegral=0; iIntegral<6; iIntegral++) { strFilename = pImgElem->strFeatureImagesIntegralPath + strLabel + strPostfixes[iIntegral]; if (WriteImageIntOrFloat(pImgElem->vectFeaturesIntegral[iLabel*6 + iIntegral], strFilename.c_str())==false) { cout<<"ERROR in ImageDataFloat2ndStageCombined::WriteImageData(...):"; cout<<" failed to write label integral image to "<<strFilename<<endl; return false; } } } return true; }