当前位置: 首页>>代码示例>>C++>>正文


C++ FileNode::type方法代码示例

本文整理汇总了C++中FileNode::type方法的典型用法代码示例。如果您正苦于以下问题:C++ FileNode::type方法的具体用法?C++ FileNode::type怎么用?C++ FileNode::type使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FileNode的用法示例。


在下文中一共展示了FileNode::type方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: deserialize

void ImageMolecule::deserialize(const cv::FileNode& fn)
{
  FileNode atoms = fn["atoms"];
  CV_Assert(atoms.type() == FileNode::SEQ);

  std::map<int, Ptr<ImageAtom> > a_map;
  for (size_t i = 0; i < atoms.size(); i++)
  {
    Ptr<ImageAtom> atom(new ImageAtom);
    atom->deserialize(atoms[i]);
    a_map[atom->uid()] = atom;
    //we will insert from pairs...
    insertAtom(atom);
  }

  FileNode pairs = fn["pairs"];
  CV_Assert(pairs.type() == FileNode::SEQ);
  vector<AtomPair> pairs_temp;
  pairs_temp.resize(pairs.size());
  for (size_t i = 0; i < pairs.size(); i++)
  {
    pairs_temp[i].deserialize(pairs[i]);

    pairs_temp[i].setAtom1(a_map[pairs_temp[i].atom1()->uid()]);
    pairs_temp[i].setAtom2(a_map[pairs_temp[i].atom2()->uid()]);

  }

  insertPairs(pairs_temp);

}
开发者ID:LuisServin,项目名称:catkin_ws,代码行数:31,代码来源:ImageMolecule.cpp

示例2: fs

OpticalMusic& OpticalMusic::unpackFileStorage(string inPath) {
	OpticalMusic *result = new OpticalMusic();
	FileStorage fs(inPath, FileStorage::READ);
	int lineHeight = (int) fs["lineHeight"];
	int spaceHeight = (int) fs["spaceHeight"];
	int perStaff = (int) fs["perStaff"];

	// overwrite default relative anchor position if it is defined in the file
	float anchorRelX = anchorRelXDefault;
	FileNode anchorRelXField = fs["anchorRelX"];
	if (anchorRelXField.type() == FileNode::FLOAT) anchorRelX = (float) anchorRelXField;
	float anchorRelY = anchorRelYDefault;
	FileNode anchorRelYField = fs["anchorRelY"];
	if (anchorRelYField.type() == FileNode::FLOAT) anchorRelY = (float) anchorRelYField;

	string fileName = (string) fs["fileName"];

	result->image = imread(fileName, OpticalMusic::FILE_LOAD_FLAGS);
	result->sp.thickness = lineHeight;
	result->sp.interval = spaceHeight;
	result->sp.perStaff = perStaff;
	result->fileName = fileName;
	result->anchorRel = Point2f(anchorRelX, anchorRelY);

	return *result;
}
开发者ID:carlwitt,项目名称:CW_BSc_OMR,代码行数:26,代码来源:OpticalMusic.cpp

示例3: readModelViews

static bool readModelViews( const string& filename, vector<Point3f>& box,
                            vector<string>& imagelist,
                            vector<Rect>& roiList, vector<Vec6f>& poseList )
{
    imagelist.resize(0);
    roiList.resize(0);
    poseList.resize(0);
    box.resize(0);
    
    FileStorage fs(filename, FileStorage::READ);
    if( !fs.isOpened() )
        return false;
    fs["box"] >> box;
    
    FileNode all = fs["views"];
    if( all.type() != FileNode::SEQ )
        return false;
    FileNodeIterator it = all.begin(), it_end = all.end();
    
    for(; it != it_end; ++it)
    {
        FileNode n = *it;
        imagelist.push_back((string)n["image"]);
        FileNode nr = n["rect"];
        roiList.push_back(Rect((int)nr[0], (int)nr[1], (int)nr[2], (int)nr[3]));
        FileNode np = n["pose"];
        poseList.push_back(Vec6f((float)np[0], (float)np[1], (float)np[2],
                                 (float)np[3], (float)np[4], (float)np[5]));
    }
    
    return true;
}
开发者ID:,项目名称:,代码行数:32,代码来源:

示例4: p

//==============================================================================
void
ft_data::
read(const FileNode& node)
{
    assert(node.type() == FileNode::MAP);
    int n; node["n_connections"] >> n; connections.resize(n);
    for(int i = 0; i < n; i++){
        char str[256]; const char* ss;
        sprintf(str,"connections %d 0",i); ss = str; node[ss] >> connections[i][0];
        sprintf(str,"connections %d 1",i); ss = str; node[ss] >> connections[i][1];
    }
    node["n_symmetry"] >> n; symmetry.resize(n);
    for(int i = 0; i < n; i++){
        char str[256]; const char* ss;
        sprintf(str,"symmetry %d",i); ss = str; node[ss] >> symmetry[i];
    }
    node["n_images"] >> n; imnames.resize(n);
    for(int i = 0; i < n; i++){
        char str[256]; const char* ss;
        sprintf(str,"image %d",i); ss = str; node[ss] >> imnames[i];
    }
    Mat X; node["shapes"] >> X; int N = X.cols; n = X.rows/2; 
    points.resize(N);
    for(int i = 0; i < N; i++){
        points[i].clear();
        for(int j = 0; j < n; j++){
            Point2f p(X.at<float>(2*j,i),X.at<float>(2*j+1,i));
            if((p.x >= 0) && (p.y >= 0))points[i].push_back(p);
        }
    }
    
}
开发者ID:chrischensy,项目名称:eye-tracking,代码行数:33,代码来源:ft_data.cpp

示例5: readVectorOrMat

 static inline void readVectorOrMat(const FileNode & node, std::vector<T> & v)
 {
     if (node.type() == FileNode::MAP)
     {
         Mat m;
         node >> m;
         m.copyTo(v);
     }
开发者ID:ernest-galbrun,项目名称:opencv,代码行数:8,代码来源:precomp.hpp

示例6: assert

//==============================================================================
void
shape_model::
read(const FileNode& node)
{
    assert(node.type() == FileNode::MAP);
    node["V"] >> V; node["e"] >> e; node["C"] >> C;
    node["Y"] >> Y;
    p = Mat::zeros(e.rows,1,CV_32F);
}
开发者ID:chrischensy,项目名称:ios_facedetect_1_0,代码行数:10,代码来源:shape_model.cpp

示例7: readFileNodeList

inline void readFileNodeList(const FileNode& fn, vector<_Tp>& result) {
    if (fn.type() == FileNode::SEQ) {
        for (FileNodeIterator it = fn.begin(); it != fn.end();) {
            _Tp item;
            it >> item;
            result.push_back(item);
        }
    }
}
开发者ID:MTolba,项目名称:libfacerec,代码行数:9,代码来源:helper.hpp

示例8: assert

//==============================================================================
void 
face_tracker::
read(const FileNode& node)
{
  assert(node.type() == FileNode::MAP);
  node["detector"] >> detector;
  node["smodel"]   >> smodel;
  node["pmodel"]   >> pmodel;
  node["annotations"] >> annotations;
}
开发者ID:chrischensy,项目名称:ios_facedetect_1_0,代码行数:11,代码来源:face_tracker.cpp

示例9: loadTex

void loadTex(vector<float>& out){
  FileStorage fs("txtDict.xml", FileStorage::READ);

  FileNode n = fs["TextonDictionary"];
  if(n.type() != FileNode::SEQ){
    cout << "incorrect filetype: " << n.type() << endl;
    fs.release();
    return;
  }

  FileNodeIterator it = n.begin(), it_end = n.end();
  int cnt =0;
  for(;it != it_end;++it){
    out.push_back((float)*it);
    cnt++;
  }
  cout << "finished reading Textons..\n\n";
  fs.release();
}
开发者ID:albertJ32,项目名称:MR8Filterbank-old,代码行数:19,代码来源:mainTextureFilters.cpp

示例10: loadBins

void loadBins(float* out){
  FileStorage fs("txtDict.xml", FileStorage::READ);

  FileNode n = fs["binArray"];
  if(n.type() != FileNode::SEQ){
    cout << "incorrect filetype: " << n.type() << endl;
    fs.release();
    return;
  }

  FileNodeIterator it = n.begin(), it_end = n.end();
  int cnt =0;
  for(;it != it_end;++it){
    out[cnt] = (float)*it;
    cnt++;
  }
  cout << "finished reading Bins..\n\n";
  fs.release();
}
开发者ID:albertJ32,项目名称:MR8Filterbank-old,代码行数:19,代码来源:mainTextureFilters.cpp

示例11: assert

//==============================================================================
void 
face_detector::
read(const FileNode& node)
{
  assert(node.type() == FileNode::MAP);
  node["fname"]     >> detector_fname;
  node["x offset"]  >> detector_offset[0];
  node["y offset"]  >> detector_offset[1];
  node["z offset"]  >> detector_offset[2];
  node["reference"] >> reference;
  detector.load(detector_fname.c_str());
}
开发者ID:Letractively,项目名称:cplusplus4java,代码行数:13,代码来源:face_detector.cpp

示例12: assert

//==============================================================================
void 
patch_models::
read(const FileNode& node)
{
  assert(node.type() == FileNode::MAP); 
  node["reference"] >> reference;
  int n; node["n_patches"] >> n; patches.resize(n);
  for(int i = 0; i < n; i++){
    char str[256]; const char* ss;
    sprintf(str,"patch %d",i); ss = str; node[ss] >> patches[i];
  }
}
开发者ID:chrischensy,项目名称:ios_facedetect_1_0,代码行数:13,代码来源:patch_model.cpp

示例13: readStringList

static bool readStringList( const string& filename, vector<string>& l )
{
    l.resize(0);
    FileStorage fs(filename, FileStorage::READ);
    if( !fs.isOpened() )
        return false;
    FileNode n = fs.getFirstTopLevelNode();
    if( n.type() != FileNode::SEQ )
        return false;
    FileNodeIterator it = n.begin(), it_end = n.end();
    for( ; it != it_end; ++it )
        l.push_back((string)*it);
    return true;
}
开发者ID:112000,项目名称:opencv,代码行数:14,代码来源:calibration.cpp

示例14: getMapFromFile

	int Map::getMapFromFile(string filename)
	{
		FileStorage fs;
		fs.open(filename, FileStorage::READ);
		FileNode n = fs["Map"];
		if (n.type() != FileNode::SEQ)
			return -1;										// Map n'est pas une séquence

		FileNodeIterator it = n.begin(), it_end = n.end();  // Itérateur pour lire la séquence
		for (; it != it_end; ++it)
			cout << (string)*it << endl;

		fs.release();										// énoncer la fermeture
		return 0;
	}
开发者ID:bmetge,项目名称:sokaris,代码行数:15,代码来源:Map.cpp

示例15: readStringList

static bool readStringList(const string &filename, vector<string> &l)
{
    l.resize(0);
    FileStorage fs(filename, FileStorage::READ);
    if (!fs.isOpened())
        return false;
    FileNode n = fs.getFirstTopLevelNode();
    if (n.type() != FileNode::SEQ)
        return false;
    FileNodeIterator it = n.begin(), it_end = n.end();

    string temp = filename;
    int pos = temp.find_last_of('/') + 1;
    temp = temp.substr(0, pos);
    for (; it != it_end; ++it)
        l.push_back(temp + (string)*it);
    return true;
}
开发者ID:Jimmymiji,项目名称:calibrationTool,代码行数:18,代码来源:calibration.cpp


注:本文中的FileNode::type方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。