Commit 250ef1227641fa2a215550b794698c93c8c5c6b1
Merge branch 'master' of https://github.com/biometrics/openbr into serialization_update
Showing
8 changed files
with
47 additions
and
20 deletions
openbr/core/eval.cpp
| @@ -605,10 +605,10 @@ struct ResolvedDetection | @@ -605,10 +605,10 @@ struct ResolvedDetection | ||
| 605 | 605 | ||
| 606 | struct DetectionOperatingPoint | 606 | struct DetectionOperatingPoint |
| 607 | { | 607 | { |
| 608 | - float Recall, FalsePositives, Precision; | ||
| 609 | - DetectionOperatingPoint() : Recall(-1), FalsePositives(-1), Precision(-1) {} | 608 | + float Recall, FalsePositiveRate, Precision; |
| 609 | + DetectionOperatingPoint() : Recall(-1), FalsePositiveRate(-1), Precision(-1) {} | ||
| 610 | DetectionOperatingPoint(float TP, float FP, float totalPositives) | 610 | DetectionOperatingPoint(float TP, float FP, float totalPositives) |
| 611 | - : Recall(TP/totalPositives), FalsePositives(FP), Precision(TP/(TP+FP)) {} | 611 | + : Recall(TP/totalPositives), FalsePositiveRate(FP/totalPositives), Precision(TP/(TP+FP)) {} |
| 612 | }; | 612 | }; |
| 613 | 613 | ||
| 614 | static QStringList computeDetectionResults(const QList<ResolvedDetection> &detections, int totalTrueDetections, bool discrete) | 614 | static QStringList computeDetectionResults(const QList<ResolvedDetection> &detections, int totalTrueDetections, bool discrete) |
| @@ -639,12 +639,12 @@ static QStringList computeDetectionResults(const QList<ResolvedDetection> &detec | @@ -639,12 +639,12 @@ static QStringList computeDetectionResults(const QList<ResolvedDetection> &detec | ||
| 639 | QStringList lines; lines.reserve(keep); | 639 | QStringList lines; lines.reserve(keep); |
| 640 | if (keep == 1) { | 640 | if (keep == 1) { |
| 641 | const DetectionOperatingPoint &point = points[0]; | 641 | const DetectionOperatingPoint &point = points[0]; |
| 642 | - lines.append(QString("%1ROC, %2, %3").arg(discrete ? "Discrete" : "Continuous", QString::number(point.FalsePositives), QString::number(point.Recall))); | 642 | + lines.append(QString("%1ROC, %2, %3").arg(discrete ? "Discrete" : "Continuous", QString::number(point.FalsePositiveRate), QString::number(point.Recall))); |
| 643 | lines.append(QString("%1PR, %2, %3").arg(discrete ? "Discrete" : "Continuous", QString::number(point.Recall), QString::number(point.Precision))); | 643 | lines.append(QString("%1PR, %2, %3").arg(discrete ? "Discrete" : "Continuous", QString::number(point.Recall), QString::number(point.Precision))); |
| 644 | } else { | 644 | } else { |
| 645 | for (int i=0; i<keep; i++) { | 645 | for (int i=0; i<keep; i++) { |
| 646 | const DetectionOperatingPoint &point = points[double(i) / double(keep-1) * double(points.size()-1)]; | 646 | const DetectionOperatingPoint &point = points[double(i) / double(keep-1) * double(points.size()-1)]; |
| 647 | - lines.append(QString("%1ROC, %2, %3").arg(discrete ? "Discrete" : "Continuous", QString::number(point.FalsePositives), QString::number(point.Recall))); | 647 | + lines.append(QString("%1ROC, %2, %3").arg(discrete ? "Discrete" : "Continuous", QString::number(point.FalsePositiveRate), QString::number(point.Recall))); |
| 648 | lines.append(QString("%1PR, %2, %3").arg(discrete ? "Discrete" : "Continuous", QString::number(point.Recall), QString::number(point.Precision))); | 648 | lines.append(QString("%1PR, %2, %3").arg(discrete ? "Discrete" : "Continuous", QString::number(point.Recall), QString::number(point.Precision))); |
| 649 | } | 649 | } |
| 650 | } | 650 | } |
openbr/core/plot.cpp
| @@ -350,10 +350,10 @@ bool PlotDetection(const QStringList &files, const File &destination, bool show) | @@ -350,10 +350,10 @@ bool PlotDetection(const QStringList &files, const File &destination, bool show) | ||
| 350 | p.file.write(qPrintable(QString("qplot(X, Y, data=%1ROC%2").arg(type, (p.major.smooth || p.minor.smooth) ? ", geom=\"smooth\", method=loess, level=0.99" : QString(", geom=\"%1\"").arg(plotType)) + | 350 | p.file.write(qPrintable(QString("qplot(X, Y, data=%1ROC%2").arg(type, (p.major.smooth || p.minor.smooth) ? ", geom=\"smooth\", method=loess, level=0.99" : QString(", geom=\"%1\"").arg(plotType)) + |
| 351 | (p.major.size > 1 ? QString(", colour=factor(%1)").arg(p.major.header) : QString()) + | 351 | (p.major.size > 1 ? QString(", colour=factor(%1)").arg(p.major.header) : QString()) + |
| 352 | (p.minor.size > 1 ? QString(", linetype=factor(%1)").arg(p.minor.header) : QString()) + | 352 | (p.minor.size > 1 ? QString(", linetype=factor(%1)").arg(p.minor.header) : QString()) + |
| 353 | - QString(", xlab=\"False Accepts\", ylab=\"True Accept Rate\") + theme_minimal()") + | 353 | + QString(", xlab=\"Percentage of False Accepts Per Image\", ylab=\"True Accept Rate\") + theme_minimal()") + |
| 354 | (p.major.size > 1 ? getScale("colour", p.major.header, p.major.size) : QString()) + | 354 | (p.major.size > 1 ? getScale("colour", p.major.header, p.major.size) : QString()) + |
| 355 | (p.minor.size > 1 ? QString(" + scale_linetype_discrete(\"%1\")").arg(p.minor.header) : QString()) + | 355 | (p.minor.size > 1 ? QString(" + scale_linetype_discrete(\"%1\")").arg(p.minor.header) : QString()) + |
| 356 | - QString(" + scale_x_log10() + scale_y_continuous(labels=percent) + annotation_logticks(sides=\"b\") + ggtitle(\"%1\")\n\n").arg(type))); | 356 | + QString(" + scale_x_log10(labels=percent) + scale_y_continuous(labels=percent, limits=c(0,1)) + annotation_logticks(sides=\"b\") + ggtitle(\"%1\") + theme(legend.position=\"bottom\")\n\n").arg(type))); |
| 357 | 357 | ||
| 358 | foreach (const QString &type, QStringList() << "Discrete" << "Continuous") | 358 | foreach (const QString &type, QStringList() << "Discrete" << "Continuous") |
| 359 | p.file.write(qPrintable(QString("qplot(X, Y, data=%1PR%2").arg(type, (p.major.smooth || p.minor.smooth) ? ", geom=\"smooth\", method=loess, level=0.99" : QString(", geom=\"%1\"").arg(plotType)) + | 359 | p.file.write(qPrintable(QString("qplot(X, Y, data=%1PR%2").arg(type, (p.major.smooth || p.minor.smooth) ? ", geom=\"smooth\", method=loess, level=0.99" : QString(", geom=\"%1\"").arg(plotType)) + |
| @@ -362,12 +362,12 @@ bool PlotDetection(const QStringList &files, const File &destination, bool show) | @@ -362,12 +362,12 @@ bool PlotDetection(const QStringList &files, const File &destination, bool show) | ||
| 362 | QString(", xlab=\"Recall\", ylab=\"Precision\") + theme_minimal()") + | 362 | QString(", xlab=\"Recall\", ylab=\"Precision\") + theme_minimal()") + |
| 363 | (p.major.size > 1 ? getScale("colour", p.major.header, p.major.size) : QString()) + | 363 | (p.major.size > 1 ? getScale("colour", p.major.header, p.major.size) : QString()) + |
| 364 | (p.minor.size > 1 ? QString(" + scale_linetype_discrete(\"%1\")").arg(p.minor.header) : QString()) + | 364 | (p.minor.size > 1 ? QString(" + scale_linetype_discrete(\"%1\")").arg(p.minor.header) : QString()) + |
| 365 | - QString(" + scale_x_continuous(labels=percent) + scale_y_continuous(labels=percent) + ggtitle(\"%1\")\n\n").arg(type))); | 365 | + QString(" + scale_x_continuous(labels=percent, limits=c(0,1)) + scale_y_continuous(labels=percent, limits=c(0,1)) + ggtitle(\"%1\") + theme(legend.position=\"bottom\")\n\n").arg(type))); |
| 366 | 366 | ||
| 367 | p.file.write(qPrintable(QString("qplot(X, data=Overlap, geom=\"histogram\", position=\"identity\", xlab=\"Overlap\", ylab=\"Frequency\")") + | 367 | p.file.write(qPrintable(QString("qplot(X, data=Overlap, geom=\"histogram\", position=\"identity\", xlab=\"Overlap\", ylab=\"Frequency\")") + |
| 368 | QString(" + theme_minimal() + scale_x_continuous(minor_breaks=NULL) + scale_y_continuous(minor_breaks=NULL) + theme(axis.text.y=element_blank(), axis.ticks=element_blank(), axis.text.x=element_text(angle=-90, hjust=0))") + | 368 | QString(" + theme_minimal() + scale_x_continuous(minor_breaks=NULL) + scale_y_continuous(minor_breaks=NULL) + theme(axis.text.y=element_blank(), axis.ticks=element_blank(), axis.text.x=element_text(angle=-90, hjust=0))") + |
| 369 | (p.major.size > 1 ? (p.minor.size > 1 ? QString(" + facet_grid(%2 ~ %1, scales=\"free\")").arg(p.minor.header, p.major.header) : QString(" + facet_wrap(~ %1, scales = \"free\")").arg(p.major.header)) : QString()) + | 369 | (p.major.size > 1 ? (p.minor.size > 1 ? QString(" + facet_grid(%2 ~ %1, scales=\"free\")").arg(p.minor.header, p.major.header) : QString(" + facet_wrap(~ %1, scales = \"free\")").arg(p.major.header)) : QString()) + |
| 370 | - QString(" + theme(aspect.ratio=1)\n\n"))); | 370 | + QString(" + theme(aspect.ratio=1, legend.position=\"bottom\")\n\n"))); |
| 371 | 371 | ||
| 372 | p.file.write(qPrintable(QString("ggplot(AverageOverlap, aes(x=%1, y=%2, label=round(X,3)), main=\"Average Overlap\") + geom_text() + theme_minimal()").arg(p.minor.size > 1 ? p.minor.header : "'X'", p.major.size > 1 ? p.major.header : "'Y'") + | 372 | p.file.write(qPrintable(QString("ggplot(AverageOverlap, aes(x=%1, y=%2, label=round(X,3)), main=\"Average Overlap\") + geom_text() + theme_minimal()").arg(p.minor.size > 1 ? p.minor.header : "'X'", p.major.size > 1 ? p.major.header : "'Y'") + |
| 373 | QString("%1%2\n\n").arg(p.minor.size > 1 ? "" : " + xlab(NULL)", p.major.size > 1 ? "" : " + ylab(NULL)"))); | 373 | QString("%1%2\n\n").arg(p.minor.size > 1 ? "" : " + xlab(NULL)", p.major.size > 1 ? "" : " + ylab(NULL)"))); |
openbr/openbr_plugin.cpp
| @@ -126,6 +126,14 @@ bool File::contains(const QString &key) const | @@ -126,6 +126,14 @@ bool File::contains(const QString &key) const | ||
| 126 | return m_metadata.contains(key) || Globals->contains(key) || key == "name"; | 126 | return m_metadata.contains(key) || Globals->contains(key) || key == "name"; |
| 127 | } | 127 | } |
| 128 | 128 | ||
| 129 | +bool File::contains(const QStringList &keys) const | ||
| 130 | +{ | ||
| 131 | + foreach (const QString &key, keys) | ||
| 132 | + if (!contains(key)) | ||
| 133 | + return false; | ||
| 134 | + return true; | ||
| 135 | +} | ||
| 136 | + | ||
| 129 | QVariant File::value(const QString &key) const | 137 | QVariant File::value(const QString &key) const |
| 130 | { | 138 | { |
| 131 | return m_metadata.contains(key) ? m_metadata.value(key) : (key == "name" ? name : Globals->property(qPrintable(key))); | 139 | return m_metadata.contains(key) ? m_metadata.value(key) : (key == "name" ? name : Globals->property(qPrintable(key))); |
openbr/openbr_plugin.h
| @@ -213,6 +213,7 @@ struct BR_EXPORT File | @@ -213,6 +213,7 @@ struct BR_EXPORT File | ||
| 213 | QString resolved() const; /*!< \brief Returns name prepended with Globals->path if name does not exist. */ | 213 | QString resolved() const; /*!< \brief Returns name prepended with Globals->path if name does not exist. */ |
| 214 | 214 | ||
| 215 | bool contains(const QString &key) const; /*!< \brief Returns \c true if the key has an associated value, \c false otherwise. */ | 215 | bool contains(const QString &key) const; /*!< \brief Returns \c true if the key has an associated value, \c false otherwise. */ |
| 216 | + bool contains(const QStringList &keys) const; /*!< \brief Returns \c true if all keys have associated values, \c false otherwise. */ | ||
| 216 | QVariant value(const QString &key) const; /*!< \brief Returns the value for the specified key. */ | 217 | QVariant value(const QString &key) const; /*!< \brief Returns the value for the specified key. */ |
| 217 | static QVariant parse(const QString &value); /*!< \brief Try to convert the QString to a QPointF or QRectF if possible. */ | 218 | static QVariant parse(const QString &value); /*!< \brief Try to convert the QString to a QPointF or QRectF if possible. */ |
| 218 | inline void set(const QString &key, const QVariant &value) { m_metadata.insert(key, value); } /*!< \brief Insert or overwrite the metadata key with the specified value. */ | 219 | inline void set(const QString &key, const QVariant &value) { m_metadata.insert(key, value); } /*!< \brief Insert or overwrite the metadata key with the specified value. */ |
openbr/plugins/algorithms.cpp
| @@ -39,7 +39,7 @@ class AlgorithmsInitializer : public Initializer | @@ -39,7 +39,7 @@ class AlgorithmsInitializer : public Initializer | ||
| 39 | Globals->abbreviations.insert("BlurredFaceDetection", "Open+LimitSize(1024)+SkinMask/(Cvt(Gray)+GradientMask)+And+Morph(Erode,16)+LargestConvexArea"); | 39 | Globals->abbreviations.insert("BlurredFaceDetection", "Open+LimitSize(1024)+SkinMask/(Cvt(Gray)+GradientMask)+And+Morph(Erode,16)+LargestConvexArea"); |
| 40 | Globals->abbreviations.insert("DrawFaceDetection", "Open+Cascade(FrontalFace)+Expand+ASEFEyes+Draw"); | 40 | Globals->abbreviations.insert("DrawFaceDetection", "Open+Cascade(FrontalFace)+Expand+ASEFEyes+Draw"); |
| 41 | Globals->abbreviations.insert("ShowFaceDetection", "DrawFaceDetection+Expand+Show"); | 41 | Globals->abbreviations.insert("ShowFaceDetection", "DrawFaceDetection+Expand+Show"); |
| 42 | - Globals->abbreviations.insert("DownloadFaceRecognition", "Download+Expand+FaceDetection+Expand+<FaceRecognitionRegistration>+Expand+<FaceRecognitionExtraction>+<FaceRecognitionEmbedding>+<FaceRecognitionQuantization>+SetMetadata(AlgorithmID,-1):MatchProbability(ByteL1)"); | 42 | + Globals->abbreviations.insert("DownloadFaceRecognition", "Download+Open+ROI+Expand+Cvt(Gray)+Cascade(FrontalFace)+Expand+<FaceRecognitionRegistration>+Expand+<FaceRecognitionExtraction>+<FaceRecognitionEmbedding>+<FaceRecognitionQuantization>+SetMetadata(AlgorithmID,-1):MatchProbability(ByteL1)"); |
| 43 | Globals->abbreviations.insert("OpenBR", "FaceRecognition"); | 43 | Globals->abbreviations.insert("OpenBR", "FaceRecognition"); |
| 44 | Globals->abbreviations.insert("GenderEstimation", "GenderClassification"); | 44 | Globals->abbreviations.insert("GenderEstimation", "GenderClassification"); |
| 45 | Globals->abbreviations.insert("AgeEstimation", "AgeRegression"); | 45 | Globals->abbreviations.insert("AgeEstimation", "AgeRegression"); |
| @@ -55,9 +55,9 @@ class AlgorithmsInitializer : public Initializer | @@ -55,9 +55,9 @@ class AlgorithmsInitializer : public Initializer | ||
| 55 | Globals->abbreviations.insert("ShowOpticalFlowMagnitude", "Stream(AggregateFrames(2)+OpticalFlow+Normalize(Range,false,0,255)+Cvt(Color)+Draw+FPSLimit(30)+Show(false)+Discard)"); | 55 | Globals->abbreviations.insert("ShowOpticalFlowMagnitude", "Stream(AggregateFrames(2)+OpticalFlow+Normalize(Range,false,0,255)+Cvt(Color)+Draw+FPSLimit(30)+Show(false)+Discard)"); |
| 56 | Globals->abbreviations.insert("ShowMotionSegmentation", "Stream(DropFrames(5)+AggregateFrames(2)+OpticalFlow+CvtUChar+WatershedSegmentation+DrawSegmentation+Draw+FPSLimit(30)+Show(false)+Discard)"); | 56 | Globals->abbreviations.insert("ShowMotionSegmentation", "Stream(DropFrames(5)+AggregateFrames(2)+OpticalFlow+CvtUChar+WatershedSegmentation+DrawSegmentation+Draw+FPSLimit(30)+Show(false)+Discard)"); |
| 57 | 57 | ||
| 58 | - Globals->abbreviations.insert("HOG", "Stream(DropFrames(5)+Cvt(Gray)+Grid(5,5)+ROIFromPts(32,24)+Expand+Resize(32,32)+Gradient+RectRegions+Bin(0,360,8)+Hist(8)+Cat)+Contract+CatRows+KMeans(500)+Hist(500)+SVM"); | ||
| 59 | - Globals->abbreviations.insert("HOF", "Stream(DropFrames(5)+Grid(5,5)+AggregateFrames(2)+OpticalFlow+ROIFromPts(32,24)+Expand+Resize(32,32)+Gradient+RectRegions+Bin(0,360,8)+Hist(8)+Cat)+Contract+CatRows+KMeans(500)+Hist(500)"); | ||
| 60 | - Globals->abbreviations.insert("HOGHOF", "Stream(DropFrames(5)+Grid(5,5)+AggregateFrames(2)+(OpticalFlow+ROIFromPts(32,24)+Expand+Resize(32,32)+Gradient+RectRegions+Bin(0,360,8)+Hist(8)+Cat+Contract)/(First+Cvt(Gray)+ROIFromPts(32,24)+Expand+Resize(32,32)+Gradient+RectRegions+Bin(0,360,8)+Hist(8)+Cat+Contract)+CatCols)+Contract+CatRows+KMeans(500)+Hist(500)+SVM"); | 58 | + Globals->abbreviations.insert("HOGVideo", "Stream(DropFrames(5)+Cvt(Gray)+Grid(5,5)+ROIFromPts(32,24)+Expand+Resize(32,32)+Gradient+RectRegions+Bin(0,360,8)+Hist(8)+Cat)+Contract+CatRows+KMeans(500)+Hist(500)+SVM"); |
| 59 | + Globals->abbreviations.insert("HOFVideo", "Stream(DropFrames(5)+Grid(5,5)+AggregateFrames(2)+OpticalFlow+ROIFromPts(32,24)+Expand+Resize(32,32)+Gradient+RectRegions+Bin(0,360,8)+Hist(8)+Cat)+Contract+CatRows+KMeans(500)+Hist(500)"); | ||
| 60 | + Globals->abbreviations.insert("HOGHOFVideo", "Stream(DropFrames(5)+Grid(5,5)+AggregateFrames(2)+(OpticalFlow+ROIFromPts(32,24)+Expand+Resize(32,32)+Gradient+RectRegions+Bin(0,360,8)+Hist(8)+Cat+Contract)/(First+Cvt(Gray)+ROIFromPts(32,24)+Expand+Resize(32,32)+Gradient+RectRegions+Bin(0,360,8)+Hist(8)+Cat+Contract)+CatCols)+Contract+CatRows+KMeans(500)+Hist(500)+SVM"); | ||
| 61 | 61 | ||
| 62 | // Generic Image Processing | 62 | // Generic Image Processing |
| 63 | Globals->abbreviations.insert("SIFT", "Open+KeyPointDetector(SIFT)+KeyPointDescriptor(SIFT):KeyPointMatcher(BruteForce)"); | 63 | Globals->abbreviations.insert("SIFT", "Open+KeyPointDetector(SIFT)+KeyPointDescriptor(SIFT):KeyPointMatcher(BruteForce)"); |
| @@ -83,6 +83,7 @@ class AlgorithmsInitializer : public Initializer | @@ -83,6 +83,7 @@ class AlgorithmsInitializer : public Initializer | ||
| 83 | // Transforms | 83 | // Transforms |
| 84 | Globals->abbreviations.insert("FaceDetection", "Open+Cvt(Gray)+Cascade(FrontalFace)"); | 84 | Globals->abbreviations.insert("FaceDetection", "Open+Cvt(Gray)+Cascade(FrontalFace)"); |
| 85 | Globals->abbreviations.insert("DenseLBP", "(Blur(1.1)+Gamma(0.2)+DoG(1,2)+ContrastEq(0.1,10)+LBP(1,2)+RectRegions(8,8,6,6)+Hist(59))"); | 85 | Globals->abbreviations.insert("DenseLBP", "(Blur(1.1)+Gamma(0.2)+DoG(1,2)+ContrastEq(0.1,10)+LBP(1,2)+RectRegions(8,8,6,6)+Hist(59))"); |
| 86 | + Globals->abbreviations.insert("DenseHOG", "Gradient+RectRegions(8,8,6,6)+Bin(0,360,8)+Hist(8)"); | ||
| 86 | Globals->abbreviations.insert("DenseSIFT", "(Grid(10,10)+SIFTDescriptor(12)+ByRow)"); | 87 | Globals->abbreviations.insert("DenseSIFT", "(Grid(10,10)+SIFTDescriptor(12)+ByRow)"); |
| 87 | Globals->abbreviations.insert("DenseSIFT2", "(Grid(5,5)+SIFTDescriptor(12)+ByRow)"); | 88 | Globals->abbreviations.insert("DenseSIFT2", "(Grid(5,5)+SIFTDescriptor(12)+ByRow)"); |
| 88 | Globals->abbreviations.insert("FaceRecognitionRegistration", "(ASEFEyes+Affine(88,88,0.25,0.35)+DownsampleTraining(FTE(DFFS),instances=1))"); | 89 | Globals->abbreviations.insert("FaceRecognitionRegistration", "(ASEFEyes+Affine(88,88,0.25,0.35)+DownsampleTraining(FTE(DFFS),instances=1))"); |
openbr/plugins/crop.cpp
| @@ -65,14 +65,19 @@ class ROITransform : public UntrainableTransform | @@ -65,14 +65,19 @@ class ROITransform : public UntrainableTransform | ||
| 65 | if (!propName.isEmpty()) { | 65 | if (!propName.isEmpty()) { |
| 66 | QRectF rect = src.file.get<QRectF>(propName); | 66 | QRectF rect = src.file.get<QRectF>(propName); |
| 67 | dst += src.m()(OpenCVUtils::toRect(rect)); | 67 | dst += src.m()(OpenCVUtils::toRect(rect)); |
| 68 | - } | ||
| 69 | - else if (src.file.rects().empty()) { | ||
| 70 | - dst = src; | ||
| 71 | - if (Globals->verbose) qWarning("No rects present in file."); | ||
| 72 | - } | ||
| 73 | - else | 68 | + } else if (!src.file.rects().empty()) { |
| 74 | foreach (const QRectF &rect, src.file.rects()) | 69 | foreach (const QRectF &rect, src.file.rects()) |
| 75 | dst += src.m()(OpenCVUtils::toRect(rect)); | 70 | dst += src.m()(OpenCVUtils::toRect(rect)); |
| 71 | + } else if (src.file.contains(QStringList() << "X" << "Y" << "Width" << "Height")) { | ||
| 72 | + dst += src.m()(Rect(src.file.get<int>("X"), | ||
| 73 | + src.file.get<int>("Y"), | ||
| 74 | + src.file.get<int>("Width"), | ||
| 75 | + src.file.get<int>("Height"))); | ||
| 76 | + } else { | ||
| 77 | + dst = src; | ||
| 78 | + if (Globals->verbose) | ||
| 79 | + qWarning("No rects present in file."); | ||
| 80 | + } | ||
| 76 | } | 81 | } |
| 77 | }; | 82 | }; |
| 78 | 83 |
openbr/plugins/gallery.cpp
| @@ -225,6 +225,13 @@ class utGallery : public BinaryGallery | @@ -225,6 +225,13 @@ class utGallery : public BinaryGallery | ||
| 225 | if (ut.algorithmID == 5) { | 225 | if (ut.algorithmID == 5) { |
| 226 | QDataStream stream(&data, QIODevice::ReadOnly); | 226 | QDataStream stream(&data, QIODevice::ReadOnly); |
| 227 | stream >> t; | 227 | stream >> t; |
| 228 | + } else if (ut.algorithmID == 7) { | ||
| 229 | + uint32_t *roi = (uint32_t*) data.data(); | ||
| 230 | + t.file.set("X", roi[0]); | ||
| 231 | + t.file.set("Y", roi[1]); | ||
| 232 | + t.file.set("Width", roi[2]); | ||
| 233 | + t.file.set("Height", roi[3]); | ||
| 234 | + t.append(cv::Mat(1, data.size()-4*sizeof(uint32_t), CV_8UC1, data.data()+4*sizeof(uint32_t)).clone() /* We don't want a shallow copy! */); | ||
| 228 | } else { | 235 | } else { |
| 229 | t.append(cv::Mat(1, data.size(), CV_8UC1, data.data()).clone() /* We don't want a shallow copy! */); | 236 | t.append(cv::Mat(1, data.size(), CV_8UC1, data.data()).clone() /* We don't want a shallow copy! */); |
| 230 | } | 237 | } |
| @@ -357,7 +364,7 @@ class jsonGallery : public BinaryGallery | @@ -357,7 +364,7 @@ class jsonGallery : public BinaryGallery | ||
| 357 | QJsonParseError error; | 364 | QJsonParseError error; |
| 358 | File file = QJsonDocument::fromJson(gallery.readLine(), &error).object().toVariantMap(); | 365 | File file = QJsonDocument::fromJson(gallery.readLine(), &error).object().toVariantMap(); |
| 359 | if (error.error != QJsonParseError::NoError) | 366 | if (error.error != QJsonParseError::NoError) |
| 360 | - qDebug() << error.errorString(); | 367 | + qFatal("%s\n", qPrintable(error.errorString())); |
| 361 | return file; | 368 | return file; |
| 362 | } | 369 | } |
| 363 | 370 |
openbr/universal_template.h
| @@ -25,6 +25,11 @@ | @@ -25,6 +25,11 @@ | ||
| 25 | extern "C" { | 25 | extern "C" { |
| 26 | #endif | 26 | #endif |
| 27 | 27 | ||
| 28 | +// Disable 'nonstandard extension used : zero-sized array in struct/union' warning | ||
| 29 | +#ifdef _MSC_VER | ||
| 30 | +# pragma warning(disable: 4200) | ||
| 31 | +#endif // _MSC_VER | ||
| 32 | + | ||
| 28 | /*! | 33 | /*! |
| 29 | * \brief A flat template format for representing arbitrary feature vectors. | 34 | * \brief A flat template format for representing arbitrary feature vectors. |
| 30 | */ | 35 | */ |