MRPT  1.9.9
faster_corner_impl.cpp
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2019, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://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)(
20  const CVD::BasicImage<CVD::byte>& I, std::vector<CVD::ImageRef>& corners,
21  int barrier)>
23  const cv::Mat& I, TKeyPointList& corners, int barrier, uint8_t octave,
24  std::vector<size_t>* out_feats_index_by_row)
25 {
26  auto ptr = I.data;
27  CVD::BasicImage<CVD::byte> img(ptr, {I.cols, I.rows}, I.step[0]);
28 
29  std::vector<CVD::ImageRef> outputs;
30  // reerve enough corners for every pixel
31  outputs.reserve(I.cols * I.rows);
32  F(img, outputs, barrier);
33  corners.reserve(corners.size() + outputs.size());
34  for (auto& output : outputs)
35  corners.emplace_back(output.x << octave, output.y << octave);
36  if (out_feats_index_by_row)
37  {
38  auto& counters = *out_feats_index_by_row;
39  counters.assign(I.rows, 0);
40  for (auto& output : outputs) counters[output.y]++;
41  }
42 }
43 
45  const cv::Mat& I, TKeyPointList& corners, int barrier, uint8_t octave,
46  std::vector<size_t>* out_feats_index_by_row)
47 {
48  fast_corner_detect<CVD::fast_corner_detect_9>(
49  I, corners, barrier, octave, out_feats_index_by_row);
50 }
51 
53  const cv::Mat& I, TKeyPointList& corners, int barrier, uint8_t octave,
54  std::vector<size_t>* out_feats_index_by_row)
55 {
56  fast_corner_detect<CVD::fast_corner_detect_10>(
57  I, corners, barrier, octave, out_feats_index_by_row);
58 }
59 
61  const cv::Mat& I, TKeyPointList& corners, int barrier, uint8_t octave,
62  std::vector<size_t>* out_feats_index_by_row)
63 {
64  fast_corner_detect<CVD::fast_corner_detect_12>(
65  I, corners, barrier, octave, out_feats_index_by_row);
66 }
67 #endif
void fast_corner_detect_10(const cv::Mat &I, TKeyPointList &corners, int barrier, uint8_t octave, std::vector< size_t > *out_feats_index_by_row)
void emplace_back(const int x, const int y)
Definition: TKeyPoint.h:176
void fast_corner_detect_9(const cv::Mat &I, TKeyPointList &corners, int barrier, uint8_t octave, std::vector< size_t > *out_feats_index_by_row)
GLint GLvoid * img
Definition: glext.h:3769
typedef void(APIENTRYP PFNGLBLENDCOLORPROC)(GLclampf red
void fast_corner_detect(const cv::Mat &I, TKeyPointList &corners, int barrier, uint8_t octave, std::vector< size_t > *out_feats_index_by_row)
void fast_corner_detect_12(const cv::Mat &I, TKeyPointList &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: ce444d842 Fri Dec 6 19:35:10 2019 +0100 at vie dic 6 19:45:12 CET 2019