Commit 532103f3def63c955e02a9ce1ea6a7c7b6cbe85c

Authored by Brendan Klare
1 parent b02b39c2

Fixes based on code review

Showing 1 changed file with 4 additions and 7 deletions
openbr/plugins/landmarks.cpp
... ... @@ -169,7 +169,7 @@ class ProcrustesAlignTransform : public Transform
169 169 aspectRatio = 0;
170 170 }
171 171  
172   - MatrixXf getRotation(MatrixXf ref, MatrixXf sample) const {
  172 + static MatrixXf getRotation(MatrixXf ref, MatrixXf sample) {
173 173 MatrixXf R = ref.transpose() * sample;
174 174 JacobiSVD<MatrixXf> svd(R, ComputeFullU | ComputeFullV);
175 175 R = svd.matrixU() * svd.matrixV();
... ... @@ -177,7 +177,7 @@ class ProcrustesAlignTransform : public Transform
177 177 }
178 178  
179 179 //Converts x y points in a single vector to two column matrix
180   - MatrixXf vectorToMatrix(MatrixXf vector) const {
  180 + static MatrixXf vectorToMatrix(MatrixXf vector) {
181 181 int n = vector.rows();
182 182 MatrixXf matrix(n / 2, 2);
183 183 for (int i = 0; i < n / 2; i++) {
... ... @@ -188,7 +188,7 @@ class ProcrustesAlignTransform : public Transform
188 188 return matrix;
189 189 }
190 190  
191   - MatrixXf matrixToVector(MatrixXf matrix) const {
  191 + static MatrixXf matrixToVector(MatrixXf matrix) {
192 192 int n2 = matrix.rows();
193 193 MatrixXf vector(n2 * 2, 1);
194 194 for (int i = 0; i < n2; i++) {
... ... @@ -276,7 +276,7 @@ class ProcrustesAlignTransform : public Transform
276 276 }
277 277 p = vectorToMatrix(p);
278 278  
279   - //Nomralize translation
  279 + //Normalize translation
280 280 p.col(0) = p.col(0) - MatrixXf::Ones(p.rows(),1) * (p.col(0).sum() / p.rows());
281 281 p.col(1) = p.col(1) - MatrixXf::Ones(p.rows(),1) * (p.col(1).sum() / p.rows());
282 282  
... ... @@ -287,9 +287,6 @@ class ProcrustesAlignTransform : public Transform
287 287 MatrixXf R = getRotation(referenceShape, p);
288 288 p = p * R.transpose();
289 289  
290   - for (int i = 0; i < p.rows(); i++) {
291   - }
292   -
293 290 //Translate and scale into output space and store in output list
294 291 QList<QPointF> procrustesPoints;
295 292 for (int i = 0; i < p.rows(); i++)
... ...