bool ofxLoadImage(ofImage &img, string filename) { if (!ofxFileExists(filename)) { ofxExit("ofxLoadImage: File not found: " + filename); return false; } else { img.load(filename); return true; } }
vector<string> ofxLoadStrings(string url) { //cout << "ofxLoadStrings FIXME" << endl; //exit(1); //return vector<string>(); //empty string filename = url; //uri.getPathAndQuery(); vector<string> lines; filename = ofToDataPath(filename); if (!ofxFileExists(filename)) { ofLogError() << "ofxLoadStrings: File not found: " << filename; return lines; } ifstream f(filename.c_str(),ios::in); string line; while (getline(f,line)) lines.push_back(ofxStringRemoveBOM(ofxTrimStringRight(line))); f.close(); return lines; }
void testApp::setupVideo() { //setup textures rgb = new unsigned char[w*h*3]; rgba = new unsigned char[w*h*4]; // setup openni ni.disableSkeleton(); ni.disableDepth(); if (ini.get("useKinect",true)) { ni.initWithXML(); if (ini.get("recordKinectData",false)) { ni.startRecordingWhenUserIsDetected(); } } else { if (!ofxFileExists("KinectRecording.oni")) { ofLogError("KinectRecording.oni file not found.\nUse useKinect=true in .ini file to use the Kinect camera."); std::exit(1); } ni.initWithRecording("KinectRecording.oni"); } }
void ofxAssertFileExists(string filename, string msg) { ofFile file(filename); ofxAssert(ofxFileExists(filename), msg + ": File not found: " + filename); }