Commit a6c456b4e21011b112f50024acd6919a447ac5ce
1 parent
7a2db13c
Create dir for slidingwindow if it doesn't exist
Showing
1 changed file
with
9 additions
and
3 deletions
openbr/plugins/imgproc/slidingwindow.cpp
| ... | ... | @@ -157,11 +157,17 @@ class SlidingWindowTransform : public Transform |
| 157 | 157 | { |
| 158 | 158 | (void) stream; |
| 159 | 159 | |
| 160 | - QString filename = Globals->sdkPath + "/share/openbr/models/openbrcascades/" + cascadeDir + "/cascade.xml"; | |
| 160 | + QString path = Globals->sdkPath + "/share/openbr/models/openbrcascades/" + cascadeDir; | |
| 161 | + QtUtils::touchDir(QDir(path)); | |
| 162 | + | |
| 163 | + QString filename = path + "/cascade.xml"; | |
| 161 | 164 | FileStorage fs(filename.toStdString(), FileStorage::WRITE); |
| 162 | - if ( !fs.isOpened() ) | |
| 163 | - return; | |
| 164 | 165 | |
| 166 | + if (!fs.isOpened()) { | |
| 167 | + qWarning("Unable to open file: %s", qPrintable(filename)); | |
| 168 | + return; | |
| 169 | + } | |
| 170 | + | |
| 165 | 171 | fs << FileStorage::getDefaultObjectName(filename.toStdString()) << "{"; |
| 166 | 172 | |
| 167 | 173 | classifier->write(fs); | ... | ... |