Commit 25a94bf18c7083273053d7206714c6f39304e9f7

Authored by Scott Klum
2 parents cfe25dda da83e1c6

Merge branch 'master' into csv

openbr/core/boost.cpp
... ... @@ -582,11 +582,9 @@ void CascadeBoostTrainData::get_ord_var_data( CvDTreeNode* n, int vi, float* ord
582 582  
583 583 // For this feature, have we precalculated all of the feature responses?
584 584 if (vi < numPrecalcVal) {
585   - for (int i = 0; i < nodeSampleCount; i++) {
586   - int idx = (*sortedIndices)[i];
587   - idx = sampleIndices[idx];
588   - ordValuesBuf[i] = valCache.at<float>(vi, idx);
589   - }
  585 + float *p = valCache.ptr<float>(vi);
  586 + for (int i = 0; i < nodeSampleCount; i++)
  587 + ordValuesBuf[i] = p[sampleIndices[(*sortedIndices)[i]]];
590 588 } else {
591 589 for (int i = 0; i < nodeSampleCount; i++) {
592 590 int idx = (*sortedIndices)[i];
... ... @@ -762,7 +760,7 @@ void CascadeBoostTrainData::precalculate()
762 760 parallel_for_(Range(minPrecalc, numPrecalcVal),
763 761 FeaturePrecalc(featureEvaluator, &valCache, sample_count));
764 762  
765   - cout << "Precalculation time (ms): " << time.elapsed() << endl;
  763 + cout << "Precalculation time (min): " << time.elapsed()/1000/60. << endl;
766 764 }
767 765  
768 766 //-------------------------------- CascadeBoostTree ----------------------------------------
... ...
openbr/plugins/imgproc/if.cpp
... ... @@ -22,12 +22,12 @@ class IfTransform : public MetaTransform
22 22 BR_PROPERTY(QString, comparison, "e")
23 23 BR_PROPERTY(bool, projectOnEmpty, false)
24 24  
25   - bool compare(const QString &metadata) const
  25 + bool compare(const QVariant &metadata) const
26 26 {
27 27 bool result, ok1 = true, ok2 = true;
28 28  
29   - if (comparison == "empty")
30   - result = metadata.isEmpty();
  29 + if (comparison == "empty")
  30 + result = metadata.isNull() || (metadata.canConvert<QString>() && metadata.toString().isEmpty());
31 31 else if (comparison == "e")
32 32 result = metadata == value;
33 33 else if (comparison == "ne")
... ... @@ -41,7 +41,7 @@ class IfTransform : public MetaTransform
41 41 else if (comparison == "ge")
42 42 result = metadata.toFloat(&ok1) >= value.toFloat(&ok2);
43 43 else if (comparison == "c") // contains
44   - result = metadata.contains(value);
  44 + result = metadata.toString().contains(value);
45 45 else
46 46 qFatal("Unrecognized comparison string.");
47 47  
... ... @@ -57,14 +57,14 @@ public:
57 57 if (transform->trainable) {
58 58 TemplateList passed;
59 59 for (int i=0; i<data.size(); i++)
60   - if ((data[i].file.contains(key) || projectOnEmpty) && compare(data[i].file.get<QString>(key, QString())))
  60 + if ((data[i].file.contains(key) || projectOnEmpty) && compare(data[i].file.value(key)))
61 61 passed.append(data[i]);
62 62 transform->train(passed);
63 63 }
64 64 }
65 65  
66 66 void project(const Template &src, Template &dst) const {
67   - if ((src.file.contains(key) || projectOnEmpty) && compare(src.file.get<QString>(key, QString())))
  67 + if ((src.file.contains(key) || projectOnEmpty) && compare(src.file.value(key)))
68 68 transform->project(src, dst);
69 69 else
70 70 dst = src;
... ... @@ -73,7 +73,7 @@ public:
73 73 void project(const TemplateList &src, TemplateList &dst) const {
74 74 TemplateList ifTrue, ifFalse;
75 75 foreach (const Template &t, src) {
76   - if ((t.file.contains(key) || projectOnEmpty) && compare(t.file.get<QString>(key, QString())))
  76 + if ((t.file.contains(key) || projectOnEmpty) && compare(t.file.value(key)))
77 77 ifTrue.append(t);
78 78 else
79 79 ifFalse.append(t);
... ...
openbr/plugins/imgproc/pad.cpp
... ... @@ -36,7 +36,7 @@ private:
36 36 int top, bottom, left, right;
37 37 top = percent*src.m().rows; bottom = percent*src.m().rows;
38 38 left = percent*src.m().cols; right = percent*src.m().cols;
39   - OpenCVUtils::pad(src, dst, true, QMargins(top,bottom,left,right), true, true, border, value);
  39 + OpenCVUtils::pad(src, dst, true, QMargins(left, top, right, bottom), true, true, border, value);
40 40 }
41 41 };
42 42  
... ...