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



Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST