34 const std::vector<unsigned int>& left,
35 const std::vector<unsigned int>& right)
37 return left[1] < right[1];
46 const unsigned int nDesiredFeatures,
const TImageROI& ROI)
const 48 switch (options.featsType)
52 "Refactor: check if OpenCV's tile method can be directly " 53 "called to save space here?")
54 if (options.harrisOptions.tile_image)
60 std::cout <<
"Warning: Image ROI is not taken into " 61 "account, as harrisOptions.tile is set to YES" 66 unsigned int wd =
img.getWidth();
67 unsigned int hg =
img.getHeight();
71 std::vector<std::vector<unsigned int>> tam(8);
72 std::vector<CFeatureList> aux_feats(
75 for (
unsigned int k = 0; k < 4;
83 newROI.
xMin = k * wd / 4.f;
85 newROI.
xMax = wd / 4.f + k * wd / 4.f - 1;
86 newROI.
yMax = hg / 2.f - 1;
90 img, aux_feats[k], init_ID, nDesiredFeatures, newROI);
91 cout <<
"Tiempo en extraer una tile: " 92 << tictac.
Tac() * 1000.0f << endl;
95 tam[k][1] = aux_feats[k].size();
98 newROI.
xMin = k * wd / 4;
100 newROI.
xMax = wd / 4 + k * wd / 4 - 1;
101 newROI.
yMax = hg - 1;
105 img, aux_feats[k + 4], init_ID, nDesiredFeatures,
107 cout <<
"Tiempo en extraer una tile: " 108 << tictac.
Tac() * 1000.0f << endl;
110 tam[k + 4][0] = k + 4;
111 tam[k + 4][1] = aux_feats[k + 4].size();
113 tt += aux_feats[k].size() + aux_feats[k + 4].size();
117 unsigned int new_nDesiredFeatures =
118 nDesiredFeatures <= 0 ? 300 : nDesiredFeatures;
119 unsigned int o_n_per_tile = floor(new_nDesiredFeatures / 8.0f);
121 if (tt > new_nDesiredFeatures)
126 std::sort(tam.begin(), tam.end(),
sort_pred());
128 if (tam[0][1] > o_n_per_tile)
132 for (
unsigned int m = 0; m < 8; m++)
133 for (
unsigned int k = 0; k < o_n_per_tile; k++)
138 std::vector<std::vector<unsigned int>>
::iterator 140 unsigned int n_per_tile = o_n_per_tile;
142 for (itVector = tam.begin(); itVector != tam.end();
150 for (
unsigned int k = 0; k < (*itVector)[1];
154 aux_feats[(*itVector)[0]][k]);
155 n_per_tile += (n_per_tile - (*itVector)[1]);
160 for (
unsigned int k = 0; k < n_per_tile; k++)
163 aux_feats[(*itVector)[0]][k]);
164 n_per_tile = o_n_per_tile;
173 for (
unsigned int m = 0; m < 8; m++)
174 for (itList = aux_feats[m].
begin();
175 itList != aux_feats[m].end(); itList++)
183 extractFeaturesKLT(
img, feats, init_ID, nDesiredFeatures, ROI);
187 extractFeaturesKLT(
img, feats, init_ID, nDesiredFeatures, ROI);
191 extractFeaturesSIFT(
img, feats, init_ID, nDesiredFeatures, ROI);
195 extractFeaturesBCD(
img, feats, init_ID, nDesiredFeatures, ROI);
199 extractFeaturesSURF(
img, feats, init_ID, nDesiredFeatures, ROI);
203 extractFeaturesFAST(
img, feats, init_ID, nDesiredFeatures, ROI);
207 extractFeaturesFASTER_N(
208 9,
img, feats, init_ID, nDesiredFeatures, ROI);
211 extractFeaturesFASTER_N(
212 10,
img, feats, init_ID, nDesiredFeatures, ROI);
215 extractFeaturesFASTER_N(
216 12,
img, feats, init_ID, nDesiredFeatures, ROI);
220 extractFeaturesORB(
img, feats, init_ID, nDesiredFeatures, ROI);
225 extractFeaturesAKAZE(
img, feats, init_ID, nDesiredFeatures, ROI);
228 extractFeaturesLSD(
img, feats, init_ID, nDesiredFeatures, ROI);
246 int nDescComputed = 0;
248 if ((in_descriptor_list &
descSIFT) != 0)
250 this->internal_computeSiftDescriptors(in_img, inout_features);
253 if ((in_descriptor_list &
descSURF) != 0)
255 this->internal_computeSurfDescriptors(in_img, inout_features);
260 this->internal_computeSpinImageDescriptors(in_img, inout_features);
265 this->internal_computePolarImageDescriptors(in_img, inout_features);
270 this->internal_computeLogPolarImageDescriptors(in_img, inout_features);
273 if ((in_descriptor_list &
descORB) != 0)
275 this->internal_computeORBDescriptors(in_img, inout_features);
279 if ((in_descriptor_list &
descBLD) != 0)
281 this->internal_computeBLDLineDescriptors(in_img, inout_features);
284 if ((in_descriptor_list &
descLATCH) != 0)
286 this->internal_computeLATCHDescriptors(in_img, inout_features);
291 "No known descriptor value found in in_descriptor_list=%u",
292 (
unsigned)in_descriptor_list)
302 unsigned int nDesiredFeatures,
const TImageROI& ROI)
const 317 : featsType(_featsType)
413 "\n----------- [CFeatureExtraction::TOptions] ------------ \n\n");
491 featsType = iniFile.
read_enum(section,
"featsType", featsType);
530 SpinImagesOptions.hist_size_distance,
int, iniFile, section)
532 SpinImagesOptions.hist_size_intensity,
int, iniFile, section)
536 SpinImagesOptions.std_intensity,
float, iniFile, section)
540 PolarImagesOptions.bins_distance,
int, iniFile, section)
545 LogPolarImagesOptions.num_angles,
int, iniFile, section)
547 LogPolarImagesOptions.rho_scale,
double, iniFile, section)
553 AKAZEOptions.descriptor_channels,
int, iniFile, section)
569 LATCHOptions.rotationInvariance,
bool, iniFile, section)
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
#define MRPT_LOAD_CONFIG_VAR_CAST( variableName, variableType, variableTypeCast, configFileObject, sectionNameStr)
LSD detector, OpenCV's implementation.
This namespace provides a OS-independent interface to many useful functions: filenames manipulation...
FASTER-9 detector, Edward Rosten's libcvd implementation optimized for SSE2.
A class for storing images as grayscale or RGB bitmaps.
#define THROW_EXCEPTION(msg)
#define THROW_EXCEPTION_FMT(_FORMAT_STRING,...)
#define LOADABLEOPTS_DUMP_VAR(variableName, variableType)
Macro for dumping a variable to a stream, within the method "dumpToTextStream(out)" (Variable types a...
EIGEN_STRONG_INLINE iterator begin()
void Tic()
Starts the stopwatch.
bool operator()(const std::vector< unsigned int > &left, const std::vector< unsigned int > &right)
This class allows loading and storing values and vectors of different types from a configuration text...
float yMin
Y coordinate limits [0,imageHeight)
FAST feature detector, OpenCV's implementation ("Faster and better: A machine learning approac...
A structure for defining a ROI within an image.
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
#define MRPT_UNUSED_PARAM(a)
Can be used to avoid "not used parameters" warnings from the compiler.
Harris border and corner detector [HARRIS].
Scale Invariant Feature Transform [LOWE'04].
This class implements a high-performance stopwatch.
FASTER-9 detector, Edward Rosten's libcvd implementation optimized for SSE2.
Classes for computer vision, detectors, features, etc.
FASTER-9 detector, Edward Rosten's libcvd implementation optimized for SSE2.
Bit-based feature descriptor.
GLsizei const GLchar ** string
A list of visual features, to be used as output by detectors, as input/output by trackers, etc.
ENUMTYPE read_enum(const std::string §ion, const std::string &name, const ENUMTYPE &defaultValue, bool failIfNotFound=false) const
Reads an "enum" value, where the value in the config file can be either a numerical value or the symb...
TDescriptorType
The bitwise OR combination of values of TDescriptorType are used in CFeatureExtraction::computeDescri...
float xMin
X coordinate limits [0,imageWidth)
TFeatureType
Types of features - This means that the point has been detected with this algorithm, which is independent of additional descriptors a feature may also have.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Log-Polar image descriptor.
Speeded Up Robust Feature [BAY'06].
double Tac()
Stops the stopwatch.
TInternalFeatList::iterator iterator
Intensity-domain spin image descriptors.
AKAZE detector, OpenCV's implementation.
ORB detector and descriptor, OpenCV's implementation ("ORB: an efficient alternative to SIFT o...
#define MRPT_LOAD_CONFIG_VAR( variableName, variableType, configFileObject, sectionNameStr)
An useful macro for loading variables stored in a INI-like file under a key with the same name that t...
Kanade-Lucas-Tomasi feature [SHI'94].
virtual int printf(const char *fmt,...) MRPT_printf_format_check(2
Writes a string to the stream in a textual form.
void push_back(const CFeature::Ptr &f)