Commit a166fe5d9974c69cef0e7911eb978eb0a784307e

Authored by Scott Klum
1 parent cfa577b5

Added newFormat to EmptyGallery

openbr/openbr_plugin.cpp
@@ -433,22 +433,11 @@ TemplateList TemplateList::fromGallery(const br::File &gallery) @@ -433,22 +433,11 @@ TemplateList TemplateList::fromGallery(const br::File &gallery)
433 // of target images to every partition 433 // of target images to every partition
434 newTemplates[i].file.set("Partition", -1); 434 newTemplates[i].file.set("Partition", -1);
435 } else { 435 } else {
436 - const QByteArray md5 = QCryptographicHash::hash(newTemplates[i].file.get<QString>("Subject").toLatin1(), QCryptographicHash::Md5);  
437 - // Select the right 8 hex characters so that it can be represented as a 64 bit integer without overflow  
438 - newTemplates[i].file.set("Partition", md5.toHex().right(8).toULongLong(0, 16) % crossValidate);  
439 - }  
440 -<<<<<<< HEAD  
441 -=======  
442 - } else if (newTemplates[i].file.getBool("allPartitions")) {  
443 - // The allPartitions flag is used to add an extended set  
444 - // of target images to every partition  
445 - newTemplates[i].file.set("Partition", -1);  
446 - } else {  
447 // Direct use of "Label" is not general -cao 436 // Direct use of "Label" is not general -cao
448 const QByteArray md5 = QCryptographicHash::hash(newTemplates[i].file.get<QString>("Label").toLatin1(), QCryptographicHash::Md5); 437 const QByteArray md5 = QCryptographicHash::hash(newTemplates[i].file.get<QString>("Label").toLatin1(), QCryptographicHash::Md5);
449 // Select the right 8 hex characters so that it can be represented as a 64 bit integer without overflow 438 // Select the right 8 hex characters so that it can be represented as a 64 bit integer without overflow
450 newTemplates[i].file.set("Partition", md5.toHex().right(8).toULongLong(0, 16) % crossValidate); 439 newTemplates[i].file.set("Partition", md5.toHex().right(8).toULongLong(0, 16) % crossValidate);
451 ->>>>>>> c2b1835e05d3b229db72d8829fb9ebf7e3cf31d8 440 + }
452 } 441 }
453 } 442 }
454 } 443 }
openbr/plugins/cascade.cpp
@@ -84,6 +84,7 @@ class CascadeTransform : public UntrainableMetaTransform @@ -84,6 +84,7 @@ class CascadeTransform : public UntrainableMetaTransform
84 foreach (const Template &t, src) { 84 foreach (const Template &t, src) {
85 const bool enrollAll = t.file.getBool("enrollAll"); 85 const bool enrollAll = t.file.getBool("enrollAll");
86 86
  87 + qDebug() << enrollAll;
87 for (int i=0; i<t.size(); i++) { 88 for (int i=0; i<t.size(); i++) {
88 const Mat &m = t[i]; 89 const Mat &m = t[i];
89 vector<Rect> rects; 90 vector<Rect> rects;
openbr/plugins/format.cpp
@@ -236,6 +236,7 @@ class DefaultFormat : public Format @@ -236,6 +236,7 @@ class DefaultFormat : public Format
236 videoWriter.file = file; 236 videoWriter.file = file;
237 videoWriter.write(t); 237 videoWriter.write(t);
238 } else if (t.size() == 1) { 238 } else if (t.size() == 1) {
  239 + QtUtils::touchDir(QDir(file.path()));
239 imwrite(file.name.toStdString(), t); 240 imwrite(file.name.toStdString(), t);
240 } 241 }
241 } 242 }
openbr/plugins/gallery.cpp
@@ -135,7 +135,7 @@ class EmptyGallery : public Gallery @@ -135,7 +135,7 @@ class EmptyGallery : public Gallery
135 { 135 {
136 Q_OBJECT 136 Q_OBJECT
137 Q_PROPERTY(QString regexp READ get_regexp WRITE set_regexp RESET reset_regexp STORED false) 137 Q_PROPERTY(QString regexp READ get_regexp WRITE set_regexp RESET reset_regexp STORED false)
138 - BR_PROPERTY(QString, regexp, "") 138 + BR_PROPERTY(QString, regexp, QString())
139 139
140 void init() 140 void init()
141 { 141 {
@@ -184,7 +184,10 @@ class EmptyGallery : public Gallery @@ -184,7 +184,10 @@ class EmptyGallery : public Gallery
184 // Enrolling a null file is used as an idiom to initialize an algorithm 184 // Enrolling a null file is used as an idiom to initialize an algorithm
185 if (file.name.isEmpty()) return; 185 if (file.name.isEmpty()) return;
186 186
187 - const QString destination = file.name + "/" + (file.getBool("preservePath") ? t.file.name : t.file.fileName()); 187 + const QString newFormat = file.get<QString>("newFormat",QString());
  188 + QString destination = file.name + "/" + (file.getBool("preservePath") ? t.file.path()+"/" : QString());
  189 + destination += (newFormat.isEmpty() ? t.file.fileName() : t.file.baseName()+newFormat);
  190 +
188 QMutexLocker diskLocker(&diskLock); // Windows prefers to crash when writing to disk in parallel 191 QMutexLocker diskLocker(&diskLock); // Windows prefers to crash when writing to disk in parallel
189 if (t.isNull()) { 192 if (t.isNull()) {
190 QtUtils::copyFile(t.file.resolved(), destination); 193 QtUtils::copyFile(t.file.resolved(), destination);