【发布时间】:2017-04-19 19:11:00
【问题描述】:
我正在尝试从在 VisualStudio 项目中运行良好的教程中读取“classifications.xml”和“images.xml”。我现在如何将 Swift XCode 项目中的 C++ 库指向文件?将它们拖放到项目中不起作用。
这是原始代码。如何将 cv::Filestorage 类指向我项目中的文件?现在它返回一个错误
cv::Mat matClassificationInts; // we will read the classification numbers into this variable as though it is a vector
cv::FileStorage fsClassifications("classifications.xml", cv::FileStorage::READ); // open the classifications file
if (fsClassifications.isOpened() == false) { // if the file was not opened successfully
std::cout << "error, unable to open training classifications file, exiting program\n\n"; // show error message
return(0); // and exit program
}
fsClassifications["classifications"] >> matClassificationInts; // read classifications section into Mat classifications variable
fsClassifications.release(); // close the classifications file
【问题讨论】: