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,6 +74,8 @@ public: | ||
| 74 | EPS_SVR = CvSVM::EPS_SVR, | 74 | EPS_SVR = CvSVM::EPS_SVR, |
| 75 | NU_SVR = CvSVM::NU_SVR}; | 75 | NU_SVR = CvSVM::NU_SVR}; |
| 76 | 76 | ||
| 77 | + SVM svm; | ||
| 78 | + | ||
| 77 | private: | 79 | private: |
| 78 | BR_PROPERTY(Kernel, kernel, Linear) | 80 | BR_PROPERTY(Kernel, kernel, Linear) |
| 79 | BR_PROPERTY(Type, type, C_SVC) | 81 | BR_PROPERTY(Type, type, C_SVC) |
| @@ -86,7 +88,6 @@ private: | @@ -86,7 +88,6 @@ private: | ||
| 86 | BR_PROPERTY(int, folds, 5) | 88 | BR_PROPERTY(int, folds, 5) |
| 87 | BR_PROPERTY(bool, balanceFolds, false) | 89 | BR_PROPERTY(bool, balanceFolds, false) |
| 88 | 90 | ||
| 89 | - SVM svm; | ||
| 90 | QHash<QString, int> labelMap; | 91 | QHash<QString, int> labelMap; |
| 91 | QHash<int, QVariant> reverseLookup; | 92 | QHash<int, QVariant> reverseLookup; |
| 92 | 93 | ||
| @@ -185,6 +186,12 @@ private: | @@ -185,6 +186,12 @@ private: | ||
| 185 | 186 | ||
| 186 | BR_REGISTER(Transform, SVMTransform) | 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 | } // namespace br | 195 | } // namespace br |
| 189 | 196 | ||
| 190 | #include "classification/svm.moc" | 197 | #include "classification/svm.moc" |