Commit 1e15758c630f7fc0ef4f5efe349ca4fe796cf495
1 parent
2478d1bb
Attribute bug fixes
Showing
2 changed files
with
5 additions
and
3 deletions
openbr/plugins/filter.cpp
| @@ -45,7 +45,8 @@ class GammaTransform : public UntrainableTransform | @@ -45,7 +45,8 @@ class GammaTransform : public UntrainableTransform | ||
| 45 | 45 | ||
| 46 | void project(const Template &src, Template &dst) const | 46 | void project(const Template &src, Template &dst) const |
| 47 | { | 47 | { |
| 48 | - LUT(src, lut, dst); | 48 | + if (src.m().depth() == CV_8U) LUT(src, lut, dst); |
| 49 | + else pow(src, gamma, dst); | ||
| 49 | } | 50 | } |
| 50 | }; | 51 | }; |
| 51 | 52 |
openbr/plugins/svm.cpp
| @@ -74,7 +74,7 @@ static void trainSVM(SVM &svm, Mat data, Mat lab, int kernel, int type, float C, | @@ -74,7 +74,7 @@ static void trainSVM(SVM &svm, Mat data, Mat lab, int kernel, int type, float C, | ||
| 74 | svm.train_auto(data, lab, Mat(), Mat(), params, 5); | 74 | svm.train_auto(data, lab, Mat(), Mat(), params, 5); |
| 75 | } catch (...) { | 75 | } catch (...) { |
| 76 | qWarning("Some classes do not contain sufficient examples or are not discriminative enough for accurate SVM classification."); | 76 | qWarning("Some classes do not contain sufficient examples or are not discriminative enough for accurate SVM classification."); |
| 77 | - svm.train(data, lab); | 77 | + svm.train(data, lab, Mat(), Mat(), params); |
| 78 | } | 78 | } |
| 79 | } else { | 79 | } else { |
| 80 | params.C = C; | 80 | params.C = C; |
| @@ -161,7 +161,8 @@ private: | @@ -161,7 +161,8 @@ private: | ||
| 161 | dst.m().at<float>(0, 0) = prediction; | 161 | dst.m().at<float>(0, 0) = prediction; |
| 162 | // positive values ==> first class | 162 | // positive values ==> first class |
| 163 | // negative values ==> second class | 163 | // negative values ==> second class |
| 164 | - prediction = prediction > 0 ? 0 : 1; | 164 | + if (type != EPS_SVR && type != NU_SVR) |
| 165 | + prediction = prediction > 0 ? 0 : 1; | ||
| 165 | } | 166 | } |
| 166 | if (type == EPS_SVR || type == NU_SVR) { | 167 | if (type == EPS_SVR || type == NU_SVR) { |
| 167 | dst.file.set(outputVariable, prediction); | 168 | dst.file.set(outputVariable, prediction); |