Main MRPT website > C++ reference for MRPT 1.5.9
imgfeatures.h
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2017, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +---------------------------------------------------------------------------+ */
9 
10 #ifndef IMGFEATURES_H
11 #define IMGFEATURES_H
12 
13 //#include "cxcore.h"
14 // Universal include for all versions of OpenCV
15 #include <mrpt/otherlibs/do_opencv_includes.h>
16 
17 #ifdef __cplusplus
18  extern "C" {
19 #endif
20 
21 
22 /** FEATURE_OXFD <BR> FEATURE_LOWE */
24 {
27 };
28 
29 /** FEATURE_FWD_MATCH <BR> FEATURE_BCK_MATCH <BR> FEATURE_MDL_MATCH */
31 {
35 };
36 
37 
38 /* colors in which to display different feature types */
39 #define FEATURE_OXFD_COLOR CV_RGB(255,255,0)
40 #define FEATURE_LOWE_COLOR CV_RGB(255,0,255)
41 
42 /** max feature descriptor length */
43 #define FEATURE_MAX_D 128
44 
45 
46 /**
47 Structure to represent an affine invariant image feature. The fields
48 x, y, a, b, c represent the affine region around the feature:
49 
50 a(x-u)(x-u) + 2b(x-u)(y-v) + c(y-v)(y-v) = 1
51 */
52 struct feature
53 {
54  double x; /**< x coord */
55  double y; /**< y coord */
56  double a; /**< Oxford-type affine region parameter */
57  double b; /**< Oxford-type affine region parameter */
58  double c; /**< Oxford-type affine region parameter */
59  double scl; /**< scale of a Lowe-style feature */
60  double ori; /**< orientation of a Lowe-style feature */
61  int d; /**< descriptor length */
62  double descr[FEATURE_MAX_D]; /**< descriptor */
63  int type; /**< feature type, OXFD or LOWE */
64  int category; /**< all-purpose feature category */
65  struct feature* fwd_match; /**< matching feature from forward image */
66  struct feature* bck_match; /**< matching feature from backmward image */
67  struct feature* mdl_match; /**< matching feature from model */
68  CvPoint2D64f img_pt; /**< location in image */
69  CvPoint2D64f mdl_pt; /**< location in model */
70  void* feature_data; /**< user-definable data */
71 };
72 
73 
74 /**
75 Reads image features from file. The file should be formatted as from
76 the code provided by the Visual Geometry Group at Oxford or from the
77 code provided by David Lowe.
78 
79 
80 @param filename location of a file containing image features
81 @param type determines how features are input. If \a type is FEATURE_OXFD,
82  the input file is treated as if it is from the code provided by the VGG
83  at Oxford: http://www.robots.ox.ac.uk:5000/~vgg/research/affine/index.html
84  <BR><BR>
85  If \a type is FEATURE_LOWE, the input file is treated as if it is from
86  David Lowe's SIFT code: http://www.cs.ubc.ca/~lowe/keypoints
87 @param feat pointer to an array in which to store imported features
88 
89 @return Returns the number of features imported from filename or -1 on error
90 */
91 extern int import_features( char* filename, int type, struct feature** feat );
92 
93 
94 /**
95 Exports a feature set to a file formatted depending on the type of
96 features, as specified in the feature struct's type field.
97 
98 @param filename name of file to which to export features
99 @param feat feature array
100 @param n number of features
101 
102 @return Returns 0 on success or 1 on error
103 */
104 extern int export_features( char* filename, struct feature* feat, int n );
105 
106 
107 /**
108 Displays a set of features on an image
109 
110 @param img image on which to display features
111 @param feat array of Oxford-type features
112 @param n number of features
113 */
114 extern void draw_features( IplImage* img, struct feature* feat, int n );
115 
116 
117 /**
118 Calculates the squared Euclidian distance between two feature descriptors.
119 
120 @param f1 first feature
121 @param f2 second feature
122 
123 @return Returns the squared Euclidian distance between the descriptors of
124 \a f1 and \a f2.
125 */
126 extern double descr_dist_sq( struct feature* f1, struct feature* f2 );
127 
128 #ifdef __cplusplus
129  }
130 #endif
131 
132 #endif
double scl
scale of a Lowe-style feature
Definition: imgfeatures.h:59
double a
Oxford-type affine region parameter.
Definition: imgfeatures.h:56
struct feature * mdl_match
matching feature from model
Definition: imgfeatures.h:67
void * feature_data
user-definable data
Definition: imgfeatures.h:70
double x
x coord
Definition: imgfeatures.h:54
GLenum GLsizei n
Definition: glext.h:4618
CvPoint2D64f img_pt
location in image
Definition: imgfeatures.h:68
double ori
orientation of a Lowe-style feature
Definition: imgfeatures.h:60
void draw_features(IplImage *img, struct feature *feat, int n)
Displays a set of features on an image
double b
Oxford-type affine region parameter.
Definition: imgfeatures.h:57
double descr_dist_sq(struct feature *f1, struct feature *f2)
Calculates the squared Euclidian distance between two feature descriptors.
int d
descriptor length
Definition: imgfeatures.h:61
struct feature * bck_match
matching feature from backmward image
Definition: imgfeatures.h:66
GLint GLvoid * img
Definition: glext.h:3645
struct feature * fwd_match
matching feature from forward image
Definition: imgfeatures.h:65
int category
all-purpose feature category
Definition: imgfeatures.h:64
double descr[FEATURE_MAX_D]
descriptor
Definition: imgfeatures.h:62
int export_features(char *filename, struct feature *feat, int n)
Exports a feature set to a file formatted depending on the type of features, as specified in the fea...
feature_type
FEATURE_OXFD FEATURE_LOWE.
Definition: imgfeatures.h:23
Structure to represent an affine invariant image feature.
Definition: imgfeatures.h:52
int type
feature type, OXFD or LOWE
Definition: imgfeatures.h:63
feature_match_type
FEATURE_FWD_MATCH FEATURE_BCK_MATCH FEATURE_MDL_MATCH.
Definition: imgfeatures.h:30
CvPoint2D64f mdl_pt
location in model
Definition: imgfeatures.h:69
double y
y coord
Definition: imgfeatures.h:55
int import_features(char *filename, int type, struct feature **feat)
Reads image features from file.
double c
Oxford-type affine region parameter.
Definition: imgfeatures.h:58
#define FEATURE_MAX_D
max feature descriptor length
Definition: imgfeatures.h:43
GLuint GLuint GLsizei GLenum type
Definition: glext.h:3512



Page generated by Doxygen 1.8.14 for MRPT 1.5.9 Git: 690a4699f Wed Apr 15 19:29:53 2020 +0200 at miƩ abr 15 19:30:12 CEST 2020