Main MRPT website > C++ reference for MRPT 1.9.9
faster_corner_impl.cpp
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 #include "vision-precomp.h" // Precompiled headers
11 
12 #if MRPT_HAS_OPENCV
13 
15 
16 #include <cvd/fast_corner.h>
17 #include <cvd/utility.h>
18 
19 template <void (* F)(const CVD::BasicImage<CVD::byte>& I, std::vector<CVD::ImageRef>& corners, int barrier)>
21  const IplImage* I, TSimpleFeatureList& corners, int barrier, uint8_t octave,
22  std::vector<size_t>* out_feats_index_by_row)
23  {
24  auto ptr = reinterpret_cast<CVD::byte* >(I->imageData);
25  CVD::BasicImage<CVD::byte> img(ptr, {I->width, I->height}, I->widthStep);
26 
27  std::vector<CVD::ImageRef> outputs;
28  //reerve enough corners for every pixel
29  outputs.reserve(I->width * I->height);
30  F(img, outputs, barrier);
31  for(auto & output : outputs)
32  {
33  corners.push_back_fast(output.x << octave, output.y << octave);
34  }
35  if(out_feats_index_by_row)
36  {
37  auto & counters = *out_feats_index_by_row;
38  counters.assign(I->height, 0);
39  for(auto & output : outputs)
40  {
41  counters[output.y]++;
42  }
43  }
44  }
45 
47  const IplImage* I, TSimpleFeatureList& corners, int barrier, uint8_t octave,
48  std::vector<size_t>* out_feats_index_by_row)
49  {
50  fast_corner_detect<CVD::fast_corner_detect_9>(I, corners, barrier, octave, out_feats_index_by_row);
51  }
52 
54  const IplImage* I, TSimpleFeatureList& corners, int barrier, uint8_t octave,
55  std::vector<size_t>* out_feats_index_by_row)
56  {
57  fast_corner_detect<CVD::fast_corner_detect_10>(I, corners, barrier, octave, out_feats_index_by_row);
58 
59  }
60 
62  const IplImage* I, TSimpleFeatureList& corners, int barrier, uint8_t octave,
63  std::vector<size_t>* out_feats_index_by_row)
64  {
65  fast_corner_detect<CVD::fast_corner_detect_12>(I, corners, barrier, octave, out_feats_index_by_row);
66  }
67 #endif
fast_corner_detect_9
void fast_corner_detect_9(const IplImage *I, TSimpleFeatureList &corners, int barrier, uint8_t octave, std::vector< size_t > *out_feats_index_by_row)
Definition: faster_corner_impl.cpp:46
uint8_t
unsigned char uint8_t
Definition: rptypes.h:41
vision-precomp.h
fast_corner_detect_10
void fast_corner_detect_10(const IplImage *I, TSimpleFeatureList &corners, int barrier, uint8_t octave, std::vector< size_t > *out_feats_index_by_row)
Definition: faster_corner_impl.cpp:53
fast_corner_detect
void fast_corner_detect(const IplImage *I, TSimpleFeatureList &corners, int barrier, uint8_t octave, std::vector< size_t > *out_feats_index_by_row)
Definition: faster_corner_impl.cpp:20
faster_corner_prototypes.h
fast_corner_detect_12
void fast_corner_detect_12(const IplImage *I, TSimpleFeatureList &corners, int barrier, uint8_t octave, std::vector< size_t > *out_feats_index_by_row)
Definition: faster_corner_impl.cpp:61
img
GLint GLvoid * img
Definition: glext.h:3763
mrpt::vision::TSimpleFeatureList_templ::push_back_fast
void push_back_fast(const FEATURE &f)
Definition: TSimpleFeature.h:194
mrpt::vision::TSimpleFeatureList_templ
A list of image features using the structure TSimpleFeature for each feature.
Definition: TSimpleFeature.h:114



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