| 49 | } |
| 50 | |
| 51 | void project(const Template &src, Template &dst) const |
| 52 | { |
| 53 | dst = src; |
| 54 | |
| 55 | float response; |
| 56 | if (classification && returnConfidence) { |
| 57 | // Fuzzy class label |
| 58 | response = forest.predict_prob(src.m().reshape(1,1)); |
| 59 | } else { |
| 60 | response = forest.predict(src.m().reshape(1,1)); |
| 61 | } |
| 62 | |
| 63 | if (overwriteMat) { |
| 64 | dst.m() = Mat(1, 1, CV_32F); |
| 65 | dst.m().at<float>(0, 0) = response; |
| 66 | } else { |
| 67 | dst.file.set(outputVariable, response); |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | void load(QDataStream &stream) |
| 72 | { |