Commit 20b03ecdd7ef1b0438585018344b4bfdd56527e6

Authored by Josh Klontz
1 parent 71df2249

remove shapeaxisratio

openbr/plugins/imgproc/shapeaxisratio.cpp deleted
1 -#include "openbr/plugins/openbr_internal.h"  
2 -#include "openbr/core/opencvutils.h"  
3 -#include "openbr/core/eigenutils.h"  
4 -  
5 -#include <Eigen/Dense>  
6 -  
7 -using namespace Eigen;  
8 -using namespace cv;  
9 -  
10 -namespace br  
11 -{  
12 -  
13 -class ShapeAxisRatioTransform : public UntrainableTransform  
14 -{  
15 - Q_OBJECT  
16 -  
17 - void project(const Template &src, Template &dst) const  
18 - {  
19 - dst = src;  
20 -  
21 - Mat indices;  
22 - findNonZero(src,indices);  
23 -  
24 - dst.m() = Mat(1,1,CV_32FC1);  
25 -  
26 - if (indices.total() > 0) {  
27 - MatrixXd data(indices.total(),2);  
28 -  
29 - for (size_t i=0; i<indices.total(); i++) {  
30 - data(i,0) = indices.at<Point>(i).y;  
31 - data(i,1) = indices.at<Point>(i).x;  
32 - }  
33 -  
34 - MatrixXd centered = data.rowwise() - data.colwise().mean();  
35 - MatrixXd cov = (centered.adjoint() * centered) / double(data.rows() - 1);  
36 -  
37 - SelfAdjointEigenSolver<Eigen::MatrixXd> eSolver(cov);  
38 - MatrixXd D = eSolver.eigenvalues();  
39 -  
40 - if (eSolver.info() == Success)  
41 - dst.m().at<float>(0,0) = D(0)/D(1);  
42 - else  
43 - dst.file.fte = true;  
44 - } else {  
45 - dst.file.fte = true;  
46 - qWarning("No mask content for %s.",qPrintable(src.file.baseName()));  
47 - }  
48 - }  
49 -};  
50 -  
51 -BR_REGISTER(Transform, ShapeAxisRatioTransform)  
52 -  
53 -} // namespace br  
54 -  
55 -#include "imgproc/shapeaxisratio.moc"