• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ cv::FileNode类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中cv::FileNode的典型用法代码示例。如果您正苦于以下问题:C++ FileNode类的具体用法?C++ FileNode怎么用?C++ FileNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: read_from_yaml

 void read_from_yaml(cv::FileNode node, bool& b)
 {
   ntk_throw_exception_if(node.empty(), "Could not read " + node.name() + " from yaml file.");
   int i = cvReadInt(*node, -1);
   ntk_assert(i >= 0 && i <= 1, "Invalid boolean value");
   b = i;
 }
开发者ID:gpodevijn,项目名称:nestk,代码行数:7,代码来源:opencv_utils.cpp


示例2: read

void RFS::read(const cv::FileNode &fn)
{
	rtrees.clear();
	for (auto it = fn.begin(); it != fn.end(); ++it)
	{
		RTree rfs;
		*it >> rfs;
		rtrees.push_back(rfs);
	}
}
开发者ID:sc2h6o,项目名称:Face-LBF,代码行数:10,代码来源:rfs.cpp


示例3:

 cv::Ptr<Camera> Camera::read( const cv::FileNode& node )
 {
   std::string myName=node.name( );
   if( myName != "Camera" )
   {
     std::string error = "Camera FileNode is not correct!\nExpected \"Camera\", got ";
     error += node.name();
     CV_Error( CV_StsError, error.c_str() );
   }
   //nothing to do as we are a fake camera...
   return cv::Ptr<Camera>( NULL );
 }
开发者ID:Nikitot,项目名称:gsoc2011sfm,代码行数:12,代码来源:Camera.cpp


示例4: loadConfigurationFromFileNode

bool ConfigurationDataReader::loadConfigurationFromFileNode(const cv::FileNode &dataFileNode)
{
    bool success = true;
    
    cv::FileNodeIterator itEnd = dataFileNode.end();
    for (cv::FileNodeIterator it = dataFileNode.begin(); it != itEnd && success; it++)
    {
        const char *newDataValueName = (*it).name().c_str();
        success = success && loadNodeFromFileNode(dataFileNode, newDataValueName);
    }
    
    return success;
}
开发者ID:wishchin,项目名称:SlamWishG2O,代码行数:13,代码来源:ConfigurationDataReader.cpp


示例5: read

 void read(const cv::FileNode &fn, BikeFeatures &bf, const BikeFeatures & default_value) {
   if (fn.empty()) {
     bf = default_value;
   } else {
     bf.read(fn);
   }
 }
开发者ID:nvasilakis,项目名称:wheresmobike,代码行数:7,代码来源:bike_features.cpp


示例6: read

void read(const cv::FileNode& node, ImageSourceSettings& settings,
    const ImageSourceSettings& default_settings)
{
    if(node.empty())
    settings = default_settings;
    else
    settings.read(node);
}
开发者ID:caomw,项目名称:PangaeaTracking,代码行数:8,代码来源:settings.cpp


示例7: read

// Following must be defined for the serialization in FileStorage to work
static void read(
    const cv::FileNode &node, FeatureTrackerOptions &x,
    const FeatureTrackerOptions &default_value = FeatureTrackerOptions()) {
  if (node.empty())
    x = default_value;
  else
    x.read(node);
}
开发者ID:goneflash,项目名称:vio,代码行数:9,代码来源:feature_tracker_options.hpp


示例8: read

void read(const cv::FileNode& node, Regressor& r, const Regressor& default_value)
{
	if (node.empty())
	{
		r = default_value;
		cout << "One default Regressor. Model file is corrupt!" << endl;
	}
	else
		r.read(node);
}
开发者ID:pby5,项目名称:Intensity-Depth-Face-Alignment,代码行数:10,代码来源:regressor.cpp


示例9: read

static void read(const cv::FileNode& node, observation& x,
		const observation& default_value = observation()) {
	if (node.empty()) {
		x = default_value;
	} else {

		x.cam_id = (int) node["cam_id"];
		x.point_id = (int) node["point_id"];
		x.coord[0] = (float) node["coord0"];
		x.coord[1] = (float) node["coord1"];
	}
}
开发者ID:DevasenaInupakutika,项目名称:rapyuta-mapping,代码行数:12,代码来源:keypoint_map.cpp


示例10: read

bool AnnotationRect::read(cv::FileNode& obj) {
	if (!obj.isMap())
		return false;

	cv::FileNodeIterator it;

	cv::Point2f center;
	cv::Size2f size;
	float angle;

	obj["targetWidth"] >> targetWidth;
	obj["targetHeight"] >> targetHeight;
	obj["targetHeight"] >> targetHeight;
	obj["annotationAngle"] >> angle;
	it = obj["annotationCenter"].begin();
	it >> center.x >> center.y;
	it = obj["annotationSize"].begin();
	it >> size.width >> size.height;
	obj["id"] >> id;

	annotation = cv::RotatedRect(center, size, angle);

	return true;
}
开发者ID:erkang,项目名称:PictorialStructures,代码行数:24,代码来源:annotationRect.cpp


示例11: read

 void read ( const cv::FileNode& node, map< string, V >&result)
 {
   bool node_type_ok = (node.type() & FileNode::MAP) > 0;
   if(!node_type_ok)
   {
     cout << node.type() << endl;
     cout << (node.type() & FileNode::MAP) << endl;
     cout << ((node.type() & FileNode::MAP) > 0) << endl;
     assert(node_type_ok);
   }
   
   for(FileNodeIterator iter = node.begin(); iter != node.end(); ++iter)
   {
     string node_name = (*iter).name();
     V value;
     //iter >> value; 
     deformable_depth::read_in_map(*iter,value);
     result[node_name] = value;
   }
 }
开发者ID:jsupancic,项目名称:AStar_Dual_Tree_HandPose,代码行数:20,代码来源:util_file.hpp


示例12: CV_Error

  void SequenceAnalyzer::read( const cv::FileNode& node, SequenceAnalyzer& me )
  {
    std::string myName=node.name( );
    if( myName != "SequenceAnalyzer" )
    {
      std::string error = "FileNode is not correct!\nExpected \"SequenceAnalyzer\", got ";
      error += node.name();
      CV_Error( CV_StsError, error.c_str() );
    }
    if( node.empty( ) || !node.isMap( ) )
      CV_Error( CV_StsError, "SequenceAnalyzer FileNode is not correct!" );

    int nb_pictures = ( int ) node[ "nbPictures" ];
    //initialisation of all empty vectors
    for( int i=0; i<nb_pictures; i++ )
    {
      Ptr<PointsToTrack> ptt;
      if( i<me.images_.size() )
      {
        ptt = Ptr<PointsToTrack>( 
          new PointsToTrackWithImage( i, me.images_[i] ));
      }
      else
      {
        ptt = Ptr<PointsToTrack>( new PointsToTrack( i ));
      }
      me.points_to_track_.push_back( ptt );

      Ptr<PointsMatcher> p_m = Ptr<PointsMatcher>( new PointsMatcher(
        *me.match_algorithm_ ) );
      p_m->add( ptt );

      me.matches_.push_back( p_m );
    }

    cv::FileNode node_TrackPoints = node[ "TrackPoints" ];

    //tracks are stored in the following form:
    //list of track where a track is stored like this:
    // nbPoints idImage1 point1  idImage2 point2 ...
    if( node_TrackPoints.empty( ) || !node_TrackPoints.isSeq() )
      CV_Error( CV_StsError, "SequenceAnalyzer FileNode is not correct!" );
    cv::FileNodeIterator it = node_TrackPoints.begin( ),
      it_end = node_TrackPoints.end( );
    while( it != it_end )
    {
      cv::FileNode it_track = ( *it )[ 0 ];
      int nbPoints,track_consistance;
      it_track[ "nbPoints" ] >> nbPoints;
      it_track[ "track_consistance" ] >> track_consistance;
      bool has_3d_point = false;
      it_track[ "has_3d_position" ] >> has_3d_point;
      TrackOfPoints track;
      if( has_3d_point )
      {
        cv::Vec3d point;
        point[ 0 ] = it_track[ "point3D_triangulated" ][ 0 ];
        point[ 1 ] = it_track[ "point3D_triangulated" ][ 1 ];
        point[ 2 ] = it_track[ "point3D_triangulated" ][ 2 ];
        track.point3D = Ptr<cv::Vec3d>( new cv::Vec3d( point ) );
      }
      int color;
      it_track[ "color" ] >> color;
      track.setColor( *((unsigned int*)&color) );
      cv::FileNodeIterator itPoints = it_track[ "list_of_points" ].begin( ),
        itPoints_end = it_track[ "list_of_points" ].end( );
      while( itPoints != itPoints_end )
      {
        int idImage;
        cv::KeyPoint kpt;
        idImage = ( *itPoints )[ 0 ];
        itPoints++;
        kpt.pt.x = ( *itPoints )[ 0 ];
        kpt.pt.y = ( *itPoints )[ 1 ];
        kpt.size = ( *itPoints )[ 2 ];
        kpt.angle = ( *itPoints )[ 3 ];
        kpt.response = ( *itPoints )[ 4 ];
        kpt.octave = ( *itPoints )[ 5 ];
        kpt.class_id = ( *itPoints )[ 6 ];

        unsigned int point_index = me.points_to_track_[ idImage ]->
          addKeypoint( kpt );
        track.addMatch( idImage,point_index );

        itPoints++;
      }
      track.track_consistance = track_consistance;
      me.tracks_.push_back( track );
      it++;
    }
  }
开发者ID:Nikitot,项目名称:gsoc2011sfm,代码行数:91,代码来源:SequenceAnalyzer.cpp


示例13: persistStore

	persistStore();
}

void ViolenceModel::storeInit(cv::FileStorage &file, std::string exampleStoreName, cv::Mat &exampleStore,
													 std::string classStoreName, cv::Mat &classStore,
													 std::string indexCacheName, std::map<std::string, time_t> &indexCache)
{
	// Read the data structures in from the training store.
	file[exampleStoreName] >> exampleStore;
	std::cout << exampleStoreName << " loaded. size: " << exampleStore.size() << "\n";

	file[classStoreName] >> classStore;
	std::cout << classStoreName << " loaded. size: " << classStore.size() << "\n";

	cv::FileNode indexedFilePaths = file[indexCacheName];
	cv::FileNodeIterator iter = indexedFilePaths.begin(), end = indexedFilePaths.end();
	while ( iter != end )
	{
		std::string path = (*iter)[VIOLENCE_MODEL_TRAINING_EXAMPLE_PATH];
		//std::cout << "found path: " << path << "\n";
		int modTime = (int)(*iter)[VIOLENCE_MODEL_TRAINING_EXAMPLE_MOD_DATE];
		indexCache[path] = (time_t)modTime;
		iter++;
	}

	// Ensure we go no further the height (rows) are not equivalent.
	std::cout << "classes: " << classStore.size().height << " examples: " << exampleStore.size().height << " indices: " << indexCache.size() << "\n";
	assert(classStore.size().height == exampleStore.size().height && classStore.size().height == indexCache.size());
}
开发者ID:meneim,项目名称:VSD,代码行数:29,代码来源:ViolenceModel.cpp


示例14: ASSERT_EQ

void Regression::verify(cv::FileNode node, cv::InputArray array, double eps, ERROR_TYPE err)
{
    int expected_kind = (int)node["kind"];
    int expected_type = (int)node["type"];
    ASSERT_EQ(expected_kind, array.kind()) << "  Argument \"" << node.name() << "\" has unexpected kind";
    ASSERT_EQ(expected_type, array.type()) << "  Argument \"" << node.name() << "\" has unexpected type";

    cv::FileNode valnode = node["val"];
    if (isVector(array))
    {
        int expected_length = (int)node["len"];
        ASSERT_EQ(expected_length, (int)array.total()) << "  Vector \"" << node.name() << "\" has unexpected length";
        int idx = node["idx"];

        cv::Mat actual = array.getMat(idx);

        if (valnode.isNone())
        {
            ASSERT_LE((size_t)26, actual.total() * (size_t)actual.channels())
                    << "  \"" << node.name() << "[" <<  idx << "]\" has unexpected number of elements";
            verify(node, actual, eps, cv::format("%s[%d]", node.name().c_str(), idx), err);
        }
        else
        {
            cv::Mat expected;
            valnode >> expected;

            if(expected.empty())
            {
                ASSERT_TRUE(actual.empty())
                    << "  expected empty " << node.name() << "[" <<  idx<< "]";
            }
            else
            {
                ASSERT_EQ(expected.size(), actual.size())
                        << "  " << node.name() << "[" <<  idx<< "] has unexpected size";

                cv::Mat diff;
                cv::absdiff(expected, actual, diff);

                if (err == ERROR_ABSOLUTE)
                {
                    if (!cv::checkRange(diff, true, 0, 0, eps))
                    {
                        if(expected.total() * expected.channels() < 12)
                            std::cout << " Expected: " << std::endl << expected << std::endl << " Actual:" << std::endl << actual << std::endl;

                        double max;
                        cv::minMaxIdx(diff.reshape(1), 0, &max);

                        FAIL() << "  Absolute difference (=" << max << ") between argument \""
                               << node.name() << "[" <<  idx << "]\" and expected value is greater than " << eps;
                    }
                }
                else if (err == ERROR_RELATIVE)
                {
                    double maxv, maxa;
                    int violations = countViolations(expected, actual, diff, eps, &maxv, &maxa);
                    if (violations > 0)
                    {
                        FAIL() << "  Relative difference (" << maxv << " of " << maxa << " allowed) between argument \""
                               << node.name() << "[" <<  idx << "]\" and expected value is greater than " << eps << " in " << violations << " points";
                    }
                }
            }
        }
    }
    else
    {
        if (valnode.isNone())
开发者ID:Belial2010,项目名称:opencv,代码行数:70,代码来源:ts_perf.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ cv::InputArray类代码示例发布时间:2022-05-31
下一篇:
C++ cv::CascadeClassifier类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap