Commit 2b9685aeb3dcb3ca43049ac2b0eb953b7b6b461d

Authored by Scott Klum
1 parent 3b89cb25

Updated if to consider the condition false if no metadata exists

Showing 1 changed file with 3 additions and 4 deletions
openbr/plugins/imgproc/if.cpp
... ... @@ -51,14 +51,14 @@ public:
51 51 if (transform->trainable) {
52 52 TemplateList passed;
53 53 for (int i=0; i<data.size(); i++)
54   - if (compare(data[i].file.get<QString>(key)))
  54 + if (data[i].file.contains(key) && compare(data[i].file.get<QString>(key)))
55 55 passed.append(data[i]);
56 56 transform->train(passed);
57 57 }
58 58 }
59 59  
60 60 void project(const Template &src, Template &dst) const {
61   - if (compare(src.file.get<QString>(key)))
  61 + if (src.file.contains(key) && compare(src.file.get<QString>(key)))
62 62 transform->project(src,dst);
63 63 else
64 64 dst = src;
... ... @@ -67,7 +67,7 @@ public:
67 67 void project(const TemplateList &src, TemplateList &dst) const {
68 68 TemplateList ifTrue, ifFalse;
69 69 foreach (const Template &t, src) {
70   - if (compare(t.file.get<QString>(key)))
  70 + if (t.file.contains(key) && compare(t.file.get<QString>(key)))
71 71 ifTrue.append(t);
72 72 else
73 73 ifFalse.append(t);
... ... @@ -83,4 +83,3 @@ BR_REGISTER(Transform, IfTransform)
83 83 } // namespace br
84 84  
85 85 #include "imgproc/if.moc"
86   -
... ...