Commit d7b5330188118f2f87a6fbc879895b53b0dfb831
Merge branch 'master' of https://github.com/biometrics/openbr
Showing
2 changed files
with
11 additions
and
12 deletions
openbr/core/bee.cpp
| ... | ... | @@ -99,6 +99,7 @@ void BEE::writeSigset(const QString &sigset, const br::FileList &files, bool ign |
| 99 | 99 | QStringList metadata; |
| 100 | 100 | if (!ignoreMetadata) |
| 101 | 101 | foreach (const QString &key, file.localKeys()) { |
| 102 | + if ((key == "Index") || (key == "Label")) continue; | |
| 102 | 103 | metadata.append(key+"=\""+QtUtils::toString(file.value(key))+"\""); |
| 103 | 104 | } |
| 104 | 105 | lines.append("\t<biometric-signature name=\"" + file.subject() +"\">"); | ... | ... |
openbr/openbr_plugin.cpp
| ... | ... | @@ -132,25 +132,23 @@ QVariant File::parse(const QString &value) |
| 132 | 132 | if (ok) return point; |
| 133 | 133 | const QRectF rect = QtUtils::toRect(value, &ok); |
| 134 | 134 | if (ok) return rect; |
| 135 | - const float f = value.toFloat(&ok); | |
| 136 | - if (ok) return f; | |
| 135 | + | |
| 136 | + /* We assume that if the value starts with '0' | |
| 137 | + then it was probably intended to be a string UID | |
| 138 | + and that it's numerical value is not relevant. */ | |
| 139 | + if (!value.startsWith('0') || (value == "0")) { | |
| 140 | + const float f = value.toFloat(&ok); | |
| 141 | + if (ok) return f; | |
| 142 | + } | |
| 143 | + | |
| 137 | 144 | return value; |
| 138 | 145 | } |
| 139 | 146 | |
| 140 | 147 | void File::set(const QString &key, const QVariant &value) |
| 141 | 148 | { |
| 142 | 149 | if (key == "Label") { |
| 143 | - bool ok = false; | |
| 144 | 150 | const QString valueString = value.toString(); |
| 145 | - | |
| 146 | - /* We assume that if the value starts with '0' | |
| 147 | - then it was probably intended to be a string UID | |
| 148 | - and that it's numerical value is not relevant. */ | |
| 149 | - if (value.canConvert(QVariant::Double) && | |
| 150 | - (!valueString.startsWith('0') || (valueString == "0"))) | |
| 151 | - value.toFloat(&ok); | |
| 152 | - | |
| 153 | - if (!ok && !Globals->classes.contains(valueString)) | |
| 151 | + if (!Globals->classes.contains(valueString)) | |
| 154 | 152 | Globals->classes.insert(valueString, Globals->classes.size()); |
| 155 | 153 | } |
| 156 | 154 | ... | ... |