Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
clfTrimmedICP.hh
1 /*
2 This file is part of the BIAS library (Basic ImageAlgorithmS).
3 
4 Copyright (C) 2003, 2004 (see file CONTACTS for details)
5  Multimediale Systeme der Informationsverarbeitung
6  Institut fuer Informatik
7  Christian-Albrechts-Universitaet Kiel
8 
9 
10 BIAS is free software; you can redistribute it and/or modify
11 it under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
14 
15 BIAS is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU Lesser General Public License for more details.
19 
20 You should have received a copy of the GNU Lesser General Public License
21 along with BIAS; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */
24 
25 #ifndef CLFTRIMMEDICP_HH_
26 #define CLFTRIMMEDICP_HH_
27 
28 #include <Base/Common/BIASpragmaStart.hh>
29 #include <Base/Debug/Debug.hh>
30 #include <Base/Image/Image.hh>
31 #include <Image/Camera.hh>
32 #include <OpenGLFramework/Base/glfVertexBuffer.hh>
33 #include <OpenGLFramework/Base/glfBatch.hh>
34 #include <OpenGLFramework/Base/glfFramebufferObject.hh>
35 #include <OpenGLFramework/Base/glfTexture2D.hh>
36 #include <OpenCLFramework/clfContext.hh>
37 #include <OpenCLFramework/Algorithm/clfRadixSort.hh>
38 
39 namespace BIAS {
40 
41  struct icppair {
44  float distance;
45  };
46 
47  struct icpvecandval {
49  float value;
50  };
51 
52  class BIASOpenCLFramework_EXPORT clfTrimmedICP : public BIAS::Debug {
53 
54  public:
55  clfTrimmedICP(int w = 640, int h = 480);
56 
57  ~clfTrimmedICP();
58 
59  unsigned int SetModelFromDepthMap(const BIAS::Camera<float> depthMap, const BIAS::Camera<unsigned char> ampImage);
60  unsigned int SetDataFromDepthMap(const BIAS::Camera<float> depthMap, const BIAS::Camera<unsigned char> ampImage);
61 
62  int Compute(float nearestDistance, unsigned int numberOfPoints);
63 
65  return &dataPoints_;
66  }
68  return &modelPoints_;
69  }
70 
72  return dataParams_;
73  }
74 
75  inline void SetMaxIterations(unsigned int maxiterations) {
76  maxIterations_ = maxiterations;
77  }
78 
80  return a.distance < b.distance;
81  }
82 
84  return a.value < b.value;
85  }
86  int Fuse(float nearestDistance);
87  protected:
88  int ComputeNearestPoints_(float nearestDistance, unsigned int numberOfPoints, float &res);
89  int ComputeOptimalMotion_(BIAS::Vector3<double> &c, BIAS::RMatrix &R);
90 
91  unsigned int setFromDepthMap_(BIAS::glfVertexBuffer &buffer, const BIAS::Camera<float> depthMap, const BIAS::Camera<unsigned char> ampImage, bool keep = false, bool padData = false);
92 
96  unsigned int modelpointcnt_, datapointcnt_;
97 
98 
100  std::vector<icppair> pairs_;
104 
105  unsigned int iterationCounter_, maxIterations_, sizeofvertex_;
106 
107  float lasterror_;
108  int w_, h_;
109 
111 
113 
117 
118  unsigned int numberOfPoints_;
119 
120  unsigned int *sortedidx_;
121  float *distToSort_;
122 
124 
126  };
127 }
128 #include <Base/Common/BIASpragmaEnd.hh>
129 #endif /* CLFTRIMMEDICP_HH_ */
BIAS::ProjectionParametersBase * GetParams()
BIAS::Camera< float > inDepth_
unsigned int sizeofvertex_
OpenCL Program wrapper.
Definition: clfProgram.hh:53
BIAS::glfVertexBuffer modelPoints_
BIAS::glfVertexBuffer dataPoints_
BIAS::Vector< double > vector
OpenCL Buffer wrapper.
Definition: clfBuffer.hh:43
clfBuffer * dataBuffer_
BIAS::glfVertexBuffer * GetModel()
BIAS::glfVertexFormat vertexFormat_
A vertex buffer contains an array of vertices that can be used for rendering.
BIAS::Vector3< double > centerB_
3D rotation matrix
Definition: RMatrix.hh:49
clfRadixSort radixsort_
static bool compareVectorByValue(icpvecandval a, icpvecandval b)
static bool comparePairByDistance(icppair a, icppair b)
BIAS::Vector3< double > modelpoint
OpenCL Context wrapper.
Definition: clfContext.hh:49
clfProgram * programCL_
BIAS::Vector3< double > inputpoint
BIAS::Camera< unsigned char > inTex_
void SetMaxIterations(unsigned int maxiterations)
unsigned int numberOfPoints_
BIAS::ProjectionParametersBase * modelParams_
unsigned int * sortedidx_
A vertex format describes the attributes of a vertex.
unsigned int modelpointcnt_
clfBuffer * outBuffer_
Camera parameters which define the mapping between rays in the camera coordinate system and pixels in...
clfBuffer * modelBuffer_
std::vector< icppair > pairs_
BIAS::glfVertexBuffer * GetData()