本文整理汇总了C++中FileNode::name方法的典型用法代码示例。如果您正苦于以下问题:C++ FileNode::name方法的具体用法?C++ FileNode::name怎么用?C++ FileNode::name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileNode
的用法示例。
在下文中一共展示了FileNode::name方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: read_from_yaml
void read_from_yaml(FileNode node, cv::Vec2f& v)
{
CvMat* c_m;
c_m = (CvMat*)node.readObj();
ntk_throw_exception_if(!c_m, std::string("Could not read field ") + node.name() + " from yml file.");
cv::Mat1f m (c_m);
ntk_assert(m.cols == 2, "Bad vector.");
std::copy(m.ptr<float>(), m.ptr<float>()+2, &v[0]);
}
示例2: read
void Object::read(const FileNode& node) {
if (node.isNamed())
name_ = node.name();
else
cout << "Warning : no name for this object." << endl;
node["number_views"] >> number_views_;
node["features_type"] >> features_type_;
views_.resize(number_views_);
for ( int i = 0; i < number_views_; ++i ) {
ostringstream view_stream;
view_stream << "view_" << i;
node[view_stream.str()] >> views_[i];
}
}
示例3: loadDescriptorsFromOpenCVFilestorage
void loadDescriptorsFromOpenCVFilestorage( Mat& descriptors, string& filePath )
{
VerboseOutput::println(string("train"), "Loading descriptors from OpenCV Filestorage");
try
{
VerboseOutput::println(string("train"), "...open filestorage");
FileStorage fs1(filePath, FileStorage::READ);
VerboseOutput::println(string("train"), "...filestorage opened");
try
{
VerboseOutput::println(string("train"), "...read root node");
FileNode features1 = fs1.root();
VerboseOutput::println(string("train"), "...find SIFTComparison node");
for( FileNodeIterator it = features1.begin() ; it != features1.end(); ++it )
{
FileNode node = *it;
if (node.name().compare(SIFTComparison::TASK_NAME) == 0)
{
read(node["descriptors"], descriptors);
}
}
}
catch (exception& e)
{
stringstream ss;
ss << "*** WARNING: failed to load descriptors from OpenCV FileStorage: " << e.what();
VerboseOutput::println(string("train"), ss.str() );
}
if (fs1.isOpened())
{
fs1.release();
}
}
catch(exception& e)
{
stringstream ss;
ss << "*** WARNING: failed to close Filestorage: " << e.what();
VerboseOutput::println(string("train"), ss.str() );
}
}