问题
I've been tearing my hair over this problem for some weeks, but I can't quite figure it out. Entering the example code used for cv::FileStorage:
FileStorage fs("test.yml", FileStorage::WRITE);
Mat cameraMatrix = (Mat_<double>(3,3) << 1000, 0, 320, 0, 1000, 240, 0, 0, 1);
fs << "cameraMatrix" << cameraMatrix;
fs.release();
in Visual Studio produces the file test.yml just fine. However, reproducing the code in XCode4 with the latest build of OpenCV(2.4.1) doesn't seem to output any file whatsoever. It runs just fine though. Any ideas as to why this is would be great.
回答1:
I tried your code and it works fine. You're probably just looking in the wrong place for test.yml. It's not going to be in the same folder as your source code. It's in the folder with your executable file under the derived data path. By default, this is ~/Library/Developer/Xcode/DerivedData. From there, look for a folder with your project name. Under that, look for build/Products/Debug or build/Products/Release to find your executable (and your test.yml file).
If you want, you can change the derived data folder by going to Xcode Preferences -> Location.
来源:https://stackoverflow.com/questions/11783839/problems-with-opencv-filestorage-in-xcode-4