Пример #1
0
 void read(const cv::FileNode &fn, BikeFeatures &bf, const BikeFeatures & default_value) {
   if (fn.empty()) {
     bf = default_value;
   } else {
     bf.read(fn);
   }
 }
Пример #2
0
 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;
 }
Пример #3
0
inline void read(const cv::FileNode& node, LabelInfo& x, const LabelInfo& default_value = LabelInfo())
{
    if(node.empty())
        x = default_value;
    else
        x.read(node);
}
Пример #4
0
void read(const cv::FileNode& node, TrackerSettings& settings,
    const TrackerSettings& default_settings)
{
    if(node.empty())
    settings = default_settings;
    else
    settings.read(node);
}
Пример #5
0
void read(const cv::FileNode& node, MeshLoadingSettings& settings,
    const MeshLoadingSettings& default_settings)
{
    if(node.empty())
    settings = default_settings;
    else
    settings.read(node);
}
Пример #6
0
void read(const cv::FileNode& node, ImageSourceSettings& settings,
    const ImageSourceSettings& default_settings)
{
    if(node.empty())
    settings = default_settings;
    else
    settings.read(node);
}
Пример #7
0
// 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);
}
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);
}
Пример #9
0
void read(const cv::FileNode& node, RFS &f, const RFS& default_value)
{
	if (node.empty())
	{
		f = default_value;
		cout << "! One default Regressor." << endl;
	}
	else
		f.read(node);
}
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"];
	}
}
Пример #11
0
  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++;
    }
  }
Пример #12
0
 void read_from_yaml(cv::FileNode node, double& b)
 {
   ntk_throw_exception_if(node.empty(), "Could not read " + node.name() + " from yaml file.");
   b = cvReadReal(*node, 0);
 }
Пример #13
0
 void read_from_yaml(cv::FileNode node, int& i)
 {
   ntk_throw_exception_if(node.empty(), "Could not read " + node.name() + " from yaml file.");
   i = cvReadInt(*node, -1);
 }