/* Draws a set of features on an image @param img image on which to draw features @param feat array of Oxford-type features @param n number of features */ void draw_features( IplImage* img, struct feature* feat, int n ) { int type; if( n <= 0 || ! feat ) { fprintf( stderr, "Warning: no features to draw, %s line %d\n", __FILE__, __LINE__ ); return; } type = feat[0].type; switch( type ) { case FEATURE_OXFD: draw_oxfd_features( img, feat, n ); break; case FEATURE_LOWE: draw_lowe_features( img, feat, n ); break; default: fprintf( stderr, "Warning: draw_features(): unrecognized feature" \ " type, %s, line %d\n", __FILE__, __LINE__ ); break; } }
/* Draws a set of features on an image @param img image on which to draw features @param feat array of features @param n number of features */ void draw_features( IplImage* img, struct feature* feat, int n ) { int type; //参数合法性检查 if( n <= 0 || ! feat ) { fprintf( stderr, "Warning: no features to draw, %s line %d\n", __FILE__, __LINE__ ); return; } type = feat[0].type;//特征点的类型 //根据特征点类型,调用不同的函数完成绘图功能 switch( type ) { case FEATURE_OXFD: draw_oxfd_features( img, feat, n );//调用函数,在图像上画OXFD格式特征点 break; case FEATURE_LOWE: draw_lowe_features( img, feat, n );//调用函数,在图像上画LOWE格式特征点 break; default: fprintf( stderr, "Warning: draw_features(): unrecognized feature" \ " type, %s, line %d\n", __FILE__, __LINE__ ); break; } }