Commit a1e8afcf9dfae3775b6c8fd3aaf03c37fcb2b498
1 parent
6e3a2bef
hack to expose underlying SVM
Showing
1 changed file
with
8 additions
and
1 deletions
openbr/plugins/classification/svm.cpp
| ... | ... | @@ -74,6 +74,8 @@ public: |
| 74 | 74 | EPS_SVR = CvSVM::EPS_SVR, |
| 75 | 75 | NU_SVR = CvSVM::NU_SVR}; |
| 76 | 76 | |
| 77 | + SVM svm; | |
| 78 | + | |
| 77 | 79 | private: |
| 78 | 80 | BR_PROPERTY(Kernel, kernel, Linear) |
| 79 | 81 | BR_PROPERTY(Type, type, C_SVC) |
| ... | ... | @@ -86,7 +88,6 @@ private: |
| 86 | 88 | BR_PROPERTY(int, folds, 5) |
| 87 | 89 | BR_PROPERTY(bool, balanceFolds, false) |
| 88 | 90 | |
| 89 | - SVM svm; | |
| 90 | 91 | QHash<QString, int> labelMap; |
| 91 | 92 | QHash<int, QVariant> reverseLookup; |
| 92 | 93 | |
| ... | ... | @@ -185,6 +186,12 @@ private: |
| 185 | 186 | |
| 186 | 187 | BR_REGISTER(Transform, SVMTransform) |
| 187 | 188 | |
| 189 | +// Hack to expose the underlying SVM as it is difficult to expose this data structure through the Qt property system | |
| 190 | +BR_EXPORT const cv::SVM *GetSVM(const br::Transform *t) | |
| 191 | +{ | |
| 192 | + return &reinterpret_cast<const SVMTransform&>(*t).svm; | |
| 193 | +} | |
| 194 | + | |
| 188 | 195 | } // namespace br |
| 189 | 196 | |
| 190 | 197 | #include "classification/svm.moc" | ... | ... |