38 int resamplingThreshold;
39 float alignmentVariance;
41 vector<float> scaleVariance;
42 vector<float> dynamicsVariance;
43 vector<float> scalingsVariance;
44 vector<float> rotationsVariance;
46 float alignmentSpreadingCenter;
47 float alignmentSpreadingRange;
48 float dynamicsSpreadingCenter;
49 float dynamicsSpreadingRange;
50 float scalingsSpreadingCenter;
51 float scalingsSpreadingRange;
52 float rotationsSpreadingCenter;
53 float rotationsSpreadingRange;
56 vector<float> dimWeights;
63 vector<float> likelihoods;
64 vector<float> alignments;
65 vector<vector<float> > dynamics;
66 vector<vector<float> > scalings;
67 vector<vector<float> > rotations;
74 inline void initMat(vector< vector<T> > & M,
int rows,
int cols){
76 for (
int n=0; n<rows; n++){
84 inline void setMat(vector< vector<T> > & C, vector< vector<float> > & M){
86 int cols = M[0].size();
88 C = vector<vector<T> >(rows);
89 for (
int n=0; n<rows; n++){
91 C[n] = vector<T>(cols);
92 for (
int m=0;m<cols;m++){
100 template <
typename T>
101 inline void setMat(vector< vector<T> > & M, T value,
int rows,
int cols){
103 for (
int n=0; n<rows; n++){
105 for (
int m=0; m<cols; m++){
113 template <
typename T>
114 inline void setMat(vector< vector<T> > & M, T value){
115 for (
int n=0; n<M.size(); n++){
116 for (
int m=0; m<M[n].size(); m++){
123 template <
typename T>
124 inline void printMat(vector< vector<T> > & M){
125 for (
int k=0; k<M.size(); k++){
127 for (
int l=0; l<M[0].size(); l++){
128 cout << M[k][l] <<
" ";
136 template <
typename T>
137 inline void printVec(vector<T> & V){
138 for (
int k=0; k<V.size(); k++){
139 cout << k <<
": " << V[k] << (k == V.size() - 1 ?
"" :
" ,");
145 template <
typename T>
146 inline void initVec(vector<T> & V,
int rows){
151 template <
typename T>
152 inline void setVec(vector<T> & C, vector<int> &V){
156 for (
int n=0; n<rows; n++){
162 template <
typename T>
163 inline void setVec(vector<T> & C, vector<float> & V){
166 for (
int n=0; n<rows; n++){
172 template <
typename T>
173 inline void setVec(vector<T> & V, T value){
174 for (
int n=0; n<V.size(); n++){
180 template <
typename T>
181 inline void setVec(vector<T> & V, T value,
int rows){
187 template <
typename T>
188 inline vector< vector<T> > dotMat(vector< vector<T> > & M1, vector< vector<T> > & M2){
193 template <
typename T>
194 inline vector< vector<T> > multiplyMatf(vector< vector<T> > & M1, T v){
195 vector< vector<T> > multiply;
196 initMat(multiply, M1.size(), M1[0].size());
197 for (
int i=0; i<M1.size(); i++){
198 for (
int j=0; j<M1[i].size(); j++){
199 multiply[i][j] = M1[i][j] * v;
206 template <
typename T>
207 inline vector< vector<T> > multiplyMatf(vector< vector<T> > & M1, vector< vector<T> > & M2){
208 assert(M1[0].size() == M2.size());
209 vector< vector<T> > multiply;
210 initMat(multiply, M1.size(), M2[0].size());
211 for (
int i=0; i<M1.size(); i++){
212 for (
int j=0; j<M2[i].size(); j++){
213 multiply[i][j] = 0.0f;
214 for(
int k=0; k<M1[0].size(); k++){
215 multiply[i][j] += M1[i][k] * M2[k][j];
224 template <
typename T>
225 inline vector<T> multiplyMat(vector< vector<T> > & M1, vector< T> & Vect){
226 assert(Vect.size() == M1[0].size());
228 initVec(multiply, Vect.size());
229 for (
int i=0; i<M1.size(); i++){
231 for (
int j=0; j<M1[i].size(); j++){
232 multiply[i] += M1[i][j] * Vect[j];
239 template <
typename T>
240 inline float getMeanVec(vector<T>& V){
242 for (
int n=0; n<V.size(); n++){
245 return tSum / (float)V.size();
248 template <
typename T>
249 inline vector<vector<float> > getRotationMatrix3d(T phi, T theta, T psi)
251 vector< vector<float> > M;
254 M[0][0] = cos(theta)*cos(psi);
255 M[0][1] = -cos(phi)*sin(psi)+sin(phi)*sin(theta)*cos(psi);
256 M[0][2] = sin(phi)*sin(psi)+cos(phi)*sin(theta)*cos(psi);
258 M[1][0] = cos(theta)*sin(psi);
259 M[1][1] = cos(phi)*cos(psi)+sin(phi)*sin(theta)*sin(psi);
260 M[1][2] = -sin(phi)*cos(psi)+cos(phi)*sin(theta)*sin(psi);
262 M[2][0] = -sin(theta);
263 M[2][1] = sin(phi)*cos(theta);
264 M[2][2] = cos(phi)*cos(theta);
269 template <
typename T>
270 float distance_weightedEuclidean(vector<T> x, vector<T> y, vector<T> w)
272 int count = x.size();
273 if (count <= 0)
return 0;
275 for(
int k = 0; k < count; k++) dist += w[k] * pow((x[k] - y[k]), 2);
float tolerance
Definition: GVFUtils.h:35
int inputDimensions
Definition: GVFUtils.h:25
bool segmentation
Definition: GVFUtils.h:27
bool translate
Definition: GVFUtils.h:26
Definition: GVFUtils.h:33
Definition: GVFUtils.h:60
Definition: GVFUtils.h:23