Commit ef0d1dae2de0046682e847e56b6fa05e0fb6e565
1 parent
3537050f
dropped RowWisePCATransform
Showing
1 changed file
with
0 additions
and
44 deletions
openbr/plugins/classification/lda.cpp
| ... | ... | @@ -224,50 +224,6 @@ BR_REGISTER(Transform, PCATransform) |
| 224 | 224 | |
| 225 | 225 | /*! |
| 226 | 226 | * \ingroup transforms |
| 227 | - * \brief PCA on each row. | |
| 228 | - * \author Josh Klontz \cite jklontz | |
| 229 | - */ | |
| 230 | -class RowWisePCATransform : public PCATransform | |
| 231 | -{ | |
| 232 | - Q_OBJECT | |
| 233 | - | |
| 234 | - void train(const TemplateList &trainingSet) | |
| 235 | - { | |
| 236 | - if (trainingSet.first().m().type() != CV_32FC1) | |
| 237 | - qFatal("Requires single channel 32-bit floating point matrices."); | |
| 238 | - | |
| 239 | - originalRows = trainingSet.first().m().rows; | |
| 240 | - const int dimsIn = trainingSet.first().m().cols; | |
| 241 | - int instances = 0; | |
| 242 | - foreach (const Template &t, trainingSet) | |
| 243 | - instances += t.m().rows; | |
| 244 | - | |
| 245 | - // Map into 64-bit Eigen matrix | |
| 246 | - Eigen::MatrixXd data(dimsIn, instances); | |
| 247 | - int index = 0; | |
| 248 | - foreach (const Template &t, trainingSet) | |
| 249 | - for (int i=0; i<t.m().rows; i++) | |
| 250 | - data.col(index++) = Eigen::Map<const Eigen::MatrixXf>(t.m().ptr<float>(i), dimsIn, 1).cast<double>(); | |
| 251 | - | |
| 252 | - PCATransform::trainCore(data); | |
| 253 | - } | |
| 254 | - | |
| 255 | - void project(const Template &src, Template &dst) const | |
| 256 | - { | |
| 257 | - dst = cv::Mat(src.m().rows, keep, CV_32FC1); | |
| 258 | - | |
| 259 | - for (int i=0; i<src.m().rows; i++) { | |
| 260 | - Eigen::Map<const Eigen::MatrixXf> inMap(src.m().ptr<float>(i), src.m().cols, 1); | |
| 261 | - Eigen::Map<Eigen::MatrixXf> outMap(dst.m().ptr<float>(i), keep, 1); | |
| 262 | - outMap = eVecs.transpose() * (inMap - mean); | |
| 263 | - } | |
| 264 | - } | |
| 265 | -}; | |
| 266 | - | |
| 267 | -BR_REGISTER(Transform, RowWisePCATransform) | |
| 268 | - | |
| 269 | -/*! | |
| 270 | - * \ingroup transforms | |
| 271 | 227 | * \brief Computes Distance From Feature Space (DFFS) |
| 272 | 228 | * \br_paper Moghaddam, Baback, and Alex Pentland. |
| 273 | 229 | * "Probabilistic visual learning for object representation." | ... | ... |