Commit 98ce65928d7cbf5fd2f3715d0e5cf42ff41f20b3
1 parent
b5c24476
Store back in sliding window
Showing
1 changed file
with
22 additions
and
0 deletions
openbr/plugins/imgproc/slidingwindow.cpp
| ... | ... | @@ -168,6 +168,28 @@ class SlidingWindowTransform : public MetaTransform |
| 168 | 168 | |
| 169 | 169 | classifier->read(fs.getFirstTopLevelNode()); |
| 170 | 170 | } |
| 171 | + | |
| 172 | + void store(QDataStream &stream) const | |
| 173 | + { | |
| 174 | + (void) stream; | |
| 175 | + | |
| 176 | + QString path = Globals->sdkPath + "/share/openbr/models/openbrcascades/" + cascadeDir; | |
| 177 | + QtUtils::touchDir(QDir(path)); | |
| 178 | + | |
| 179 | + QString filename = path + "/cascade.xml"; | |
| 180 | + FileStorage fs(filename.toStdString(), FileStorage::WRITE); | |
| 181 | + | |
| 182 | + if (!fs.isOpened()) { | |
| 183 | + qWarning("Unable to open file: %s", qPrintable(filename)); | |
| 184 | + return; | |
| 185 | + } | |
| 186 | + | |
| 187 | + fs << FileStorage::getDefaultObjectName(filename.toStdString()) << "{"; | |
| 188 | + | |
| 189 | + classifier->write(fs); | |
| 190 | + | |
| 191 | + fs << "}"; | |
| 192 | + } | |
| 171 | 193 | }; |
| 172 | 194 | |
| 173 | 195 | BR_REGISTER(Transform, SlidingWindowTransform) | ... | ... |