Image Component Library (ICL)
SQFitter.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 : ICLGeom/src/ICLGeom/SQFitter.h **
10 ** Module : ICLGeom **
11 ** Authors: Sergius Gaulik **
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 <ICLUtils/CompatMacros.h>
34 #include <ICLMath/FixedMatrix.h>
37 #include <vector>
38 
39 namespace icl{
40  namespace geom{
41 
47  std::vector<float> shape;
48 
49  icl::math::FixedMatrix<float,4,4> getTransformationMatrix() const;
50  SQParams () : shape(2, 1.0) {}
51  };
52 
54  public:
56 
57  private:
58 
60  struct shapeError {
61  LM::Matrix operator()(const LM::Params &p, const LM::Matrix &vx);
62  };
63 
65  struct eulerPosError {
67  std::vector<float> shape;
68 
69  LM::Matrix operator()(const LM::Params &p, const LM::Matrix &vx);
70  };
71 
72  public:
75 
77  bool fit(icl::geom::PointCloudObject& pcObj,
78  const std::string& sShapePreference="bsc",
79  size_t maxNumPoints=0);
80 
82  const SQParams& getParams() const {return params;}
83 
85  void setCameraCenter(const Vec &c);
86 
87  private:
89  void fitSQ(LM::Matrix &Mx, math::Vec3 &viewDir, const std::string& sShapePreference);
91  void preProcess(LM::Matrix &Mx, math::Vec3 &viewDir,
92  const std::string& sShapePreference,
94  math::Vec3 &center, math::Vec3 &size, math::Vec3 &origin,
95  float &scale);
97  LM::Result fitShape(int i, icl::math::FixedMatrix<float,3,3> &R,
98  LM::Matrix &Mx, SQParams &params,
99  math::Vec3 &size, math::Vec3 &euler);
100 
101  private:
110  };
112 
113  } // namespace geom
114 }
Powerful and highly flexible matrix class implementation.
Definition: FixedMatrix.h:172
undocument this line if you encounter any issues!
Definition: Any.h:37
LM eulerPosLM
Levenberg-Marquardt for the euler angles and the position.
Definition: SQFitter.h:107
SQFitter::shapeError sError
structure containing an error function
Definition: SQFitter.h:102
math::Vec3 euler
Definition: SQFitter.h:46
#define ICLGeom_API
Definition: CompatMacros.h:179
LM::FunctionMat sErrorFunc
error function for the shape
Definition: SQFitter.h:104
SQParams params
last solution
Definition: SQFitter.h:108
LM shapeLM
Levenberg-Marquardt for the shape.
Definition: SQFitter.h:106
std::vector< float > shape
Definition: SQFitter.h:67
icl::utils::SmartPtr< Vec > camCenter
camera center
Definition: SQFitter.h:109
std::vector< float > shape
Definition: SQFitter.h:47
math::Vec3 size
Definition: SQFitter.h:44
icl::math::LevenbergMarquardtFitter< float > LM
Levenberg-Marquardt.
Definition: SQFitter.h:55
Base implementation of the SceneObjectBase interface for compability with common icl::SceneObjects.
Definition: PointCloudObject.h:52
Definition: SQFitter.h:53
math::Vec3 pos
Definition: SQFitter.h:45
math::Vec3 size
Definition: SQFitter.h:66
SQParams()
Definition: SQFitter.h:50
static void scale(const int deg, xcomplex *P)
Definition: PolynomialSolver.h:133
const SQParams & getParams() const
returns the last calculated parameters
Definition: SQFitter.h:82
LM::FunctionMat ePErrorFunc
error function for the euler angles and the position
Definition: SQFitter.h:105
Utility structure, that represents a superquadric.
Definition: SQFitter.h:43
SQFitter::eulerPosError ePError
structure containing an error function
Definition: SQFitter.h:103
icl::utils::SmartPtr< SQFitter > SQFitterPtr
Definition: SQFitter.h:111
Specialization of the SmartPtrBase class for Pointers.
Definition: SmartPtr.h:75
Structure, that contains the error function for the euler angles and position parameters.
Definition: SQFitter.h:65
Structure, that contains the error function for the shape parameters.
Definition: SQFitter.h:60