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
void fast_corner_detect(const IplImage *I, TSimpleFeatureList &corners, int barrier, uint8_t octave, std::vector< size_t > *out_feats_index_by_row)
void fast_corner_detect_12(const IplImage *I, TSimpleFeatureList &corners, int barrier, uint8_t octave, std::vector< size_t > *out_feats_index_by_row)
unsigned char uint8_t
Definition: rptypes.h:41
GLint GLvoid * img
Definition: glext.h:3763
void fast_corner_detect_9(const IplImage *I, TSimpleFeatureList &corners, int barrier, uint8_t octave, std::vector< size_t > *out_feats_index_by_row)
void fast_corner_detect_10(const IplImage *I, TSimpleFeatureList &corners, int barrier, uint8_t octave, std::vector< size_t > *out_feats_index_by_row)



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020