Commit acb45104ff872568c3acb5674eaa6550764adafa

Authored by Josh Klontz
1 parent e32b434d

minor improvements

openbr/plugins/algorithms.cpp
@@ -50,7 +50,7 @@ class AlgorithmsInitializer : public Initializer @@ -50,7 +50,7 @@ class AlgorithmsInitializer : public Initializer
50 Globals->abbreviations.insert("SmallSIFT", "Open+LimitSize(512)+KeyPointDetector(SIFT)+KeyPointDescriptor(SIFT):KeyPointMatcher(BruteForce)"); 50 Globals->abbreviations.insert("SmallSIFT", "Open+LimitSize(512)+KeyPointDetector(SIFT)+KeyPointDescriptor(SIFT):KeyPointMatcher(BruteForce)");
51 Globals->abbreviations.insert("SmallSURF", "Open+LimitSize(512)+KeyPointDetector(SURF)+KeyPointDescriptor(SURF):KeyPointMatcher(BruteForce)"); 51 Globals->abbreviations.insert("SmallSURF", "Open+LimitSize(512)+KeyPointDetector(SURF)+KeyPointDescriptor(SURF):KeyPointMatcher(BruteForce)");
52 Globals->abbreviations.insert("ColorHist", "Open+LimitSize(512)!EnsureChannels(3)+SplitChannels+Hist(256,0,8)+Cat+Normalize(L1):L2"); 52 Globals->abbreviations.insert("ColorHist", "Open+LimitSize(512)!EnsureChannels(3)+SplitChannels+Hist(256,0,8)+Cat+Normalize(L1):L2");
53 - Globals->abbreviations.insert("ImageClassification", "Open+CropSquare+LimitSize(256)+Cvt(Gray)+Gradient+Bin(0,360,9,true)+Merge+Integral+RecursiveIntegralSampler(4,2,8,Singleton(KMeans(1024)[fraction=0.2]))+Cat+Print+CvtFloat+Hist(1024):Dist(L1)"); 53 + Globals->abbreviations.insert("ImageClassification", "Open+CropSquare+LimitSize(256)+Cvt(Gray)+Gradient+Bin(0,360,9,true)+Merge+Integral+RecursiveIntegralSampler(4,2,8,Singleton(KMeans(1024)[fraction=0.5]))+Cat+CvtFloat+Hist(1024):Dist(L1)");
54 54
55 // Hash 55 // Hash
56 Globals->abbreviations.insert("FileName", "Name+Identity:Identical"); 56 Globals->abbreviations.insert("FileName", "Name+Identity:Identical");
openbr/plugins/integral.cpp
@@ -188,6 +188,7 @@ class RecursiveIntegralSamplerTransform : public Transform @@ -188,6 +188,7 @@ class RecursiveIntegralSamplerTransform : public Transform
188 OutputDescriptor(dst.ptr<float>(2), channels, 1) = ((a+b)-(c+d))/2.f; 188 OutputDescriptor(dst.ptr<float>(2), channels, 1) = ((a+b)-(c+d))/2.f;
189 OutputDescriptor(dst.ptr<float>(3), channels, 1) = ((a+c)-(b+d))/2.f; 189 OutputDescriptor(dst.ptr<float>(3), channels, 1) = ((a+c)-(b+d))/2.f;
190 OutputDescriptor(dst.ptr<float>(4), channels, 1) = ((a+d)-(b+c))/2.f; 190 OutputDescriptor(dst.ptr<float>(4), channels, 1) = ((a+d)-(b+c))/2.f;
  191 + dst = dst.reshape(1, 1);
191 } 192 }
192 193
193 Template subdivide(const Template &src) const 194 Template subdivide(const Template &src) const
openbr/plugins/regions.cpp
@@ -92,15 +92,15 @@ class CatTransform : public UntrainableMetaTransform @@ -92,15 +92,15 @@ class CatTransform : public UntrainableMetaTransform
92 qFatal("%d partitions does not evenly divide %d matrices.", partitions, src.size()); 92 qFatal("%d partitions does not evenly divide %d matrices.", partitions, src.size());
93 QVector<int> sizes(partitions, 0); 93 QVector<int> sizes(partitions, 0);
94 for (int i=0; i<src.size(); i++) 94 for (int i=0; i<src.size(); i++)
95 - sizes[i%partitions] += src[i].total() * src[i].channels(); 95 + sizes[i%partitions] += src[i].total();
96 96
97 foreach (int size, sizes) 97 foreach (int size, sizes)
98 - dst.append(Mat(1, size, CV_32FC1)); 98 + dst.append(Mat(1, size, src.m().type()));
99 99
100 QVector<int> offsets(partitions, 0); 100 QVector<int> offsets(partitions, 0);
101 for (int i=0; i<src.size(); i++) { 101 for (int i=0; i<src.size(); i++) {
102 size_t size = src[i].total() * src[i].elemSize(); 102 size_t size = src[i].total() * src[i].elemSize();
103 - int j = i%partitions; 103 + int j = i % partitions;
104 memcpy(&dst[j].data[offsets[j]], src[i].ptr(), size); 104 memcpy(&dst[j].data[offsets[j]], src[i].ptr(), size);
105 offsets[j] += size; 105 offsets[j] += size;
106 } 106 }