Image Component Library (ICL)
CurvatureExtractor.h
Go to the documentation of this file.
1 /********************************************************************
2 ** Image Component Library (ICL) **
3 ** **
4 ** Copyright (C) 2006-2013 CITEC, University of Bielefeld **
5 ** Neuroinformatics Group **
6 ** Website: www.iclcv.org and **
7 ** http://opensource.cit-ec.de/projects/icl **
8 ** **
9 ** File : ICLCV/src/ICLCV/CurvatureExtractor.h **
10 ** Module : ICLCV **
11 ** Authors: Tobias Röhlig **
12 ** **
13 ** **
14 ** GNU LESSER GENERAL PUBLIC LICENSE **
15 ** This file may be used under the terms of the GNU Lesser General **
16 ** Public License version 3.0 as published by the **
17 ** **
18 ** Free Software Foundation and appearing in the file LICENSE.LGPL **
19 ** included in the packaging of this file. Please review the **
20 ** following information to ensure the license requirements will **
21 ** be met: http://www.gnu.org/licenses/lgpl-3.0.txt **
22 ** **
23 ** The development of this software was supported by the **
24 ** Excellence Cluster EXC 277 Cognitive Interaction Technology. **
25 ** The Excellence Cluster EXC 277 is a grant of the Deutsche **
26 ** Forschungsgemeinschaft (DFG) in the context of the German **
27 ** Excellence Initiative. **
28 ** **
29 ********************************************************************/
30 
31 #pragma once
32 
33 #include <ICLCore/Core.h>
34 #include <ICLUtils/Uncopyable.h>
35 #include <ICLMath/DynMatrix.h>
36 #include <ICLCV/ImageRegion.h>
37 #include <stdint.h>
38 
39 namespace icl {
40  namespace cv {
41 
49 
50  public:
51 
55  typedef std::vector<float> FloatHist;
57  typedef std::vector<utils::Point> PointVector;
59  typedef std::vector<int> IndexVector;
60 
67  CurvatureExtractor(const uint32_t curv_radius, const uint32_t steps = 1,
68  const bool thinned_contour = true);
69 
83  void extractContourCurvature(const PointVector &contour,
84  const core::Img8u &insideLookup,
85  const uint32_t regionLookupId,
86  std::vector<int> &indices,
87  FloatHist &hist,
88  DMatF &dist, DMatF &curvature);
89 
97  void extractRegionCurvature(const std::vector<ImageRegion> &regions,
98  const core::Img8u &insideLookup,
99  const std::vector<uint32_t> &regionLookupIds,
100  std::vector<FloatHist> &curvatureHists);
101 
106  const std::vector< DMatF > &getDistanceMatrices() { return m_distances; }
107 
112  const std::vector< DMatF > &getCurvatureMatrices() { return m_curvatures; }
113 
118  const std::vector< IndexVector > &getUsedIndices() { return m_used_indices; }
119 
124  uint32_t getCurvatureRadius() { return m_curv_radius; }
129  void setCurvatureRadius(const uint32_t radius) { m_curv_radius = radius; }
130 
135  uint32_t getStepSize() { return m_steps; }
140  void setStepSize(const uint32_t steps) { m_steps = steps; }
141 
146  bool getUseThinnedContour() { return m_thinned_contour; }
151  void setUseThinnedContour(const bool thinned_contour) { m_thinned_contour = thinned_contour; }
152 
153  protected:
154 
160  uint32_t m_curv_radius;
165  uint32_t m_steps;
166 
169 
171  std::vector< DMatF > m_distances;
173  std::vector< DMatF > m_curvatures;
175  std::vector< IndexVector > m_used_indices;
176 
183  inline
184  int restOp(int x, int y) {
185  int r = x%y;
186  return r<0 ? y+r : r;
187  }
188 
189  };
190 
191  } //cv
192 } //icl
undocument this line if you encounter any issues!
Definition: Any.h:37
Class interface for un-copyable classes.
Definition: Uncopyable.h:64
ICLCore_API std::vector< std::vector< int > > hist(const ImgBase *image, int levels=256, bool roiOnly=false)
computes the color histogramm of given image
int restOp(int x, int y)
restOp for circle-like rest operations (int only):
Definition: CurvatureExtractor.h:184
std::vector< int > IndexVector
Internal used index vector.
Definition: CurvatureExtractor.h:59
const std::vector< DMatF > & getDistanceMatrices()
getDistanceMatrices
Definition: CurvatureExtractor.h:106
void setStepSize(const uint32_t steps)
setStepSize
Definition: CurvatureExtractor.h:140
bool m_thinned_contour
Whether use thinned contour of ImageRegions or not.
Definition: CurvatureExtractor.h:168
void setUseThinnedContour(const bool thinned_contour)
setUseThinnedContour
Definition: CurvatureExtractor.h:151
std::vector< float > FloatHist
Histogram type.
Definition: CurvatureExtractor.h:55
const std::vector< IndexVector > & getUsedIndices()
getUsedIndicesMatrices
Definition: CurvatureExtractor.h:118
std::vector< utils::Point > PointVector
Array of points.
Definition: CurvatureExtractor.h:57
#define ICLCV_API
Definition: CompatMacros.h:177
uint32_t m_curv_radius
m_curv_radius Curvature of a point p_i is the sum of relations between the direct distance and geodes...
Definition: CurvatureExtractor.h:160
std::vector< DMatF > m_curvatures
Curvature matrices for each region.
Definition: CurvatureExtractor.h:173
bool getUseThinnedContour()
getUseThinnedContour
Definition: CurvatureExtractor.h:146
uint32_t getCurvatureRadius()
getCurvatureRadius
Definition: CurvatureExtractor.h:124
std::vector< DMatF > m_distances
Distance matrices for each region.
Definition: CurvatureExtractor.h:171
void setCurvatureRadius(const uint32_t radius)
setCurvatureRadius
Definition: CurvatureExtractor.h:129
std::vector< IndexVector > m_used_indices
Indices used for each region. See m_steps.
Definition: CurvatureExtractor.h:175
const std::vector< DMatF > & getCurvatureMatrices()
getCurvatureMatrices
Definition: CurvatureExtractor.h:112
uint32_t m_steps
m_steps Steps between points the curvature is computed for. Used for auto-fill indices in extractCont...
Definition: CurvatureExtractor.h:165
math::DynMatrix< float > DMatF
Internal used matrix type.
Definition: CurvatureExtractor.h:53
The RegionCurvature class.
Definition: CurvatureExtractor.h:48
uint32_t getStepSize()
getStepSize
Definition: CurvatureExtractor.h:135