MVE - Multi-View Environment mve-devel
Loading...
Searching...
No Matches
surf.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2015, Simon Fuhrmann
3 * TU Darmstadt - Graphics, Capture and Massively Parallel Computing
4 * All rights reserved.
5 *
6 * This software may be modified and distributed under the terms
7 * of the BSD 3-Clause license. See the LICENSE.txt file for details.
8 *
9 * Some useful references:
10 * - "Resolving Implementation Ambiguity and Improving SURF" by Peter Abeles
11 * - SURF Article at http://www.ipol.im/pub/pre/H2/
12 *
13 * TODO:
14 * - N9 Neighborhood is implemented twice. Re-use code.
15 */
16#ifndef SFM_SURF_HEADER
17#define SFM_SURF_HEADER
18
19#include <sys/types.h>
20#include <vector>
21
22#include "math/vector.h"
23#include "mve/image.h"
24
25#include "defines.h"
26
28
40class Surf
41{
42public:
46 struct Options
47 {
48 Options (void);
49
52
55
60
65 };
66
70 struct Keypoint
71 {
72 int octave;
73 float sample;
74 float x;
75 float y;
76 };
77
84 {
86 float x;
88 float y;
90 float scale;
95 };
96
97public:
98 typedef std::vector<Keypoint> Keypoints;
99 typedef std::vector<Descriptor> Descriptors;
100
101public:
102 explicit Surf (Options const& options);
103
105 void set_image (mve::ByteImage::ConstPtr image);
106
108 void process (void);
109
111 Keypoints const& get_keypoints (void) const;
113 Descriptors const& get_descriptors (void) const;
114
115protected:
116 /*
117 * Representation of a SURF octave.
118 */
119 struct Octave
120 {
121 typedef float RespType;
123 typedef std::vector<RespImage::Ptr> RespImages;
125 };
126
127protected:
128 typedef int64_t SatType;
130 typedef std::vector<Octave> Octaves;
131
132protected:
133 void create_octaves (void);
134
135 void create_response_map (int o, int k);
136 SatType filter_dxx (int fs, int x, int y);
137 SatType filter_dyy (int fs, int x, int y);
138 SatType filter_dxy (int fs, int x, int y);
139
140 void extrema_detection (void);
141 void check_maximum (int o, int s, int x, int y);
142
143 void keypoint_localization_and_filtering (void);
144 bool keypoint_localization (Surf::Keypoint* kp);
145
146 void descriptor_assignment (void);
147 bool descriptor_orientation (Descriptor* descr);
148 bool descriptor_computation (Descriptor* descr, bool upright);
149 void filter_dx_dy(int x, int y, int fs, float* dx, float* dy);
150
151private:
152 Options options;
153 SatImage::Ptr sat;
154 Octaves octaves;
155 Keypoints keypoints;
156 Descriptors descriptors;
157};
158
159/* ---------------------------------------------------------------- */
160
161inline
162Surf::Options::Options (void)
163 : contrast_threshold(500.0f)
164 , use_upright_descriptor(false)
165 , verbose_output(false)
166 , debug_output(false)
167{
168}
169
170inline Surf::Keypoints const&
172{
173 return this->keypoints;
174}
175
176inline Surf::Descriptors const&
178{
179 return this->descriptors;
180}
181
183
184#endif /* SFM_SURF_HEADER */
Vector class for arbitrary dimensions and types.
Definition vector.h:87
Multi-channel image class of arbitrary but homogenous data type.
Definition image.h:40
std::shared_ptr< Image< T > > Ptr
Definition image.h:42
std::shared_ptr< Image< T > const > ConstPtr
Definition image.h:43
Implementation of the SURF feature detector and descriptor as described in:
Definition surf.h:41
std::vector< Keypoint > Keypoints
Definition surf.h:98
Descriptors const & get_descriptors(void) const
Returns the list of descriptors.
Definition surf.h:177
int64_t SatType
Signed type for the SAT image values.
Definition surf.h:128
std::vector< Descriptor > Descriptors
Definition surf.h:99
mve::Image< SatType > SatImage
SAT image type.
Definition surf.h:129
Keypoints const & get_keypoints(void) const
Returns the list of keypoints.
Definition surf.h:171
std::vector< Octave > Octaves
Definition surf.h:130
#define SFM_NAMESPACE_END
Definition defines.h:14
#define SFM_NAMESPACE_BEGIN
Definition defines.h:13
Representation of a SURF descriptor.
Definition surf.h:84
float scale
The scale (or sigma value) of the keypoint.
Definition surf.h:90
float orientation
The orientation of the image keypoint in [-PI, PI].
Definition surf.h:92
float y
The sub-pixel y-coordinate of the image keypoint.
Definition surf.h:88
math::Vector< float, 64 > data
The descriptor data, elements are signed in [-1.0, 1.0].
Definition surf.h:94
float x
The sub-pixel x-coordinate of the image keypoint.
Definition surf.h:86
Representation of a SURF keypoint.
Definition surf.h:71
int octave
Octave index of the keypoint.
Definition surf.h:72
float x
Detected keypoint X coordinate.
Definition surf.h:74
float y
Detected keypoint Y coordinate.
Definition surf.h:75
float sample
Scale space sample index within octave in [0, 3].
Definition surf.h:73
RespImages imgs
Definition surf.h:124
std::vector< RespImage::Ptr > RespImages
Vector of response images.
Definition surf.h:123
mve::Image< RespType > RespImage
Hessian response map type.
Definition surf.h:122
float RespType
Type for the Hessian response value.
Definition surf.h:121
SURF options.
Definition surf.h:47
bool verbose_output
Produce status messages on the console.
Definition surf.h:59
float contrast_threshold
Sets the hessian threshold, defaults to 500.0.
Definition surf.h:51
bool debug_output
Produce even more messages on the console.
Definition surf.h:64
bool use_upright_descriptor
Trade rotation invariance for speed.
Definition surf.h:54