Commit 1436680348d862abafe7499694d708aa508c0a76
1 parent
e37bb529
Helper function to write out a Eigen matrix (useful for matlab debugging)
Showing
1 changed file
with
19 additions
and
0 deletions
openbr/core/eigenutils.cpp
0 → 100644
| 1 | +#include "eigenutils.h" | |
| 2 | +#include <openbr/openbr_plugin.h> | |
| 3 | + | |
| 4 | +using namespace Eigen; | |
| 5 | +using namespace cv; | |
| 6 | + | |
| 7 | +//Helper function to quickly write eigen matrix to disk. Not efficient. | |
| 8 | +void writeEigen(MatrixXf X, QString filename) { | |
| 9 | + Mat m(X.rows(),X.cols(),CV_32FC1); | |
| 10 | + for (int i = 0; i < X.rows(); i++) { | |
| 11 | + for (int j = 0; j < X.cols(); j++) { | |
| 12 | + m.at<float>(i,j) = X(i,j); | |
| 13 | + } | |
| 14 | + } | |
| 15 | + QScopedPointer<br::Format> format(br::Factory<br::Format>::make(filename)); | |
| 16 | + format->write(br::Template(m)); | |
| 17 | +} | |
| 18 | + | |
| 19 | + | ... | ... |