本文整理汇总了C++中cv::FileNode::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ FileNode::empty方法的具体用法?C++ FileNode::empty怎么用?C++ FileNode::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cv::FileNode
的用法示例。
在下文中一共展示了FileNode::empty方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: read
void read(const cv::FileNode &fn, BikeFeatures &bf, const BikeFeatures & default_value) {
if (fn.empty()) {
bf = default_value;
} else {
bf.read(fn);
}
}
示例2: 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;
}
示例3: read
void read(const cv::FileNode& node, TrackerSettings& settings,
const TrackerSettings& default_settings)
{
if(node.empty())
settings = default_settings;
else
settings.read(node);
}
示例4: 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);
}
示例5: 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);
}
示例6: read
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);
}
示例7: 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"];
}
}
示例8: read
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++;
}
}