Exemplo n.º 1
0
/*
Reads image features from file.  The file should be formatted as from
the code provided by the Visual Geometry Group at Oxford:
@param filename location of a file containing image features
@param type determines how features are input.  If \a type is FEATURE_OXFD,
	the input file is treated as if it is from the code provided by the VGG
	at Oxford:http://www.robots.ox.ac.uk:5000/~vgg/research/affine/index.html
	If \a type is FEATURE_LOWE, the input file is treated as if it is from
	David Lowe's SIFT code:http://www.cs.ubc.ca/~lowe/keypoints
@param feat pointer to an array in which to store features
@return Returns the number of features imported from filename or -1 on error
*/
int import_features( char* filename, int type, struct feature** feat )
{
	int n;

    //根据特征点类型,调用不同的函数完成导入功能
	switch( type )
	{
	case FEATURE_OXFD:
        n = import_oxfd_features( filename, feat );//调用函数,导入OXFD格式特征点
		break;
	case FEATURE_LOWE:
        n = import_lowe_features( filename, feat );//调用函数,导入LOWE格式特征点
		break;
    default: //特征点格式无法识别
        fprintf( stderr, "Warning: import_features(): unrecognized feature" \
				"type, %s, line %d\n", __FILE__, __LINE__ );
		return -1;
	}

    //导入失败
    if( n == -1 )
		fprintf( stderr, "Warning: unable to import features from %s,"	\
			" %s, line %d\n", filename, __FILE__, __LINE__ );
	return n;
}
Exemplo n.º 2
0
/* 
Reads image features from file.  The file should be formatted as from 
the code provided by the Visual Geometry Group at Oxford: 
 
 
@param filename location of a file containing image features 
@param type determines how features are input.  If \a type is FEATURE_OXFD, 
    the input file is treated as if it is from the code provided by the VGG 
    at Oxford: 
 
    http://www.robots.ox.ac.uk:5000/~vgg/research/affine/index.html 
 
    If \a type is FEATURE_LOWE, the input file is treated as if it is from 
    David Lowe's SIFT code: 
 
    http://www.cs.ubc.ca/~lowe/keypoints   
@param features pointer to an array in which to store features 
 
@return Returns the number of features imported from filename or -1 on error 
*/  
int import_features( char* filename, int type, struct feature** feat )  
{  
    int n;  
  
    switch( type )  
    {  
    case FEATURE_OXFD:  
        n = import_oxfd_features( filename, feat );  
        break;  
    case FEATURE_LOWE:  
        n = import_lowe_features( filename, feat );  
        break;  
    default:  
        fprintf( stderr, "Warning: import_features(): unrecognized feature type, %s, line %d\n", __FILE__, __LINE__ );  
        return -1;  
    }  
  
    if( n == -1 )  
        fprintf( stderr, "Warning: unable to import features from %s, %s, line %d\n", filename, __FILE__, __LINE__ );  
    return n;  
}