Commit 0c37b47269d5d5b59cd2c12e46cc243b9ba0a039
Merge branch 'temp'
Showing
4 changed files
with
48 additions
and
1 deletions
openbr/core/eval.cpp
| ... | ... | @@ -839,6 +839,14 @@ static QStringList computeDetectionResults(const QList<ResolvedDetection> &detec |
| 839 | 839 | qDebug("TAR @ FAR => %f : 1", TP / totalTrueDetections); |
| 840 | 840 | qDebug("Confidence: %f", detection.confidence); |
| 841 | 841 | qDebug("TP vs. FP: %f to %f", TP, FP); |
| 842 | + } else if (prevFP / numImages < 0.5 && FP / numImages >= 0.5 && discrete) { | |
| 843 | + qDebug("TAR @ FAR => %f : 0.5", TP / totalTrueDetections); | |
| 844 | + qDebug("Confidence: %f", detection.confidence); | |
| 845 | + qDebug("TP vs. FP: %f to %f", TP, FP); | |
| 846 | + } else if (prevFP / numImages < 0.2 && FP / numImages >= 0.2 && discrete) { | |
| 847 | + qDebug("TAR @ FAR => %f : 0.2", TP / totalTrueDetections); | |
| 848 | + qDebug("Confidence: %f", detection.confidence); | |
| 849 | + qDebug("TP vs. FP: %f to %f", TP, FP); | |
| 842 | 850 | } else if (prevFP / numImages < 0.1 && FP / numImages >= 0.1 && discrete) { |
| 843 | 851 | qDebug("TAR @ FAR => %f : 0.1", TP / totalTrueDetections); |
| 844 | 852 | qDebug("Confidence: %f", detection.confidence); | ... | ... |
openbr/core/opencvutils.cpp
| ... | ... | @@ -527,6 +527,42 @@ void OpenCVUtils::group(QList<Rect> &rects, QList<float> &confidences, float con |
| 527 | 527 | } |
| 528 | 528 | } |
| 529 | 529 | |
| 530 | +void OpenCVUtils::pad(const br::Template &src, br::Template &dst, bool padMat, const QList<int> &padding, bool padPoints, bool padRects, int border, int value) | |
| 531 | +{ | |
| 532 | + // Padding is expected to be top, bottom, left, right | |
| 533 | + if (padMat) | |
| 534 | + copyMakeBorder(src, dst, padding[0], padding[1], padding[2], padding[3], border, Scalar(value)); | |
| 535 | + else | |
| 536 | + dst = src; | |
| 537 | + | |
| 538 | + if (padPoints) { | |
| 539 | + QList<QPointF> points = src.file.points(); | |
| 540 | + QList<QPointF> paddedPoints; | |
| 541 | + for (int i=0; i<points.size(); i++) | |
| 542 | + paddedPoints.append(points[i] += QPointF(padding[2],padding[0])); | |
| 543 | + dst.file.setPoints(paddedPoints); | |
| 544 | + } | |
| 545 | + | |
| 546 | + if (padRects) { | |
| 547 | + QList<QRectF> rects = src.file.rects(); | |
| 548 | + QList<QRectF> paddedRects; | |
| 549 | + for (int i=0; i<rects.size(); i++) | |
| 550 | + paddedRects.append(rects[i].translated(QPointF(padding[2],padding[0]))); | |
| 551 | + dst.file.setRects(paddedRects); | |
| 552 | + } | |
| 553 | + | |
| 554 | + | |
| 555 | +} | |
| 556 | + | |
| 557 | +void OpenCVUtils::pad(const br::TemplateList &src, br::TemplateList &dst, bool padMat, const QList<int> &padding, bool padPoints, bool padRects, int border, int value) | |
| 558 | +{ | |
| 559 | + for (int i=0; i<src.size(); i++) { | |
| 560 | + br::Template t; | |
| 561 | + pad(src[i], t, padMat, padding, padPoints, padRects, border, value); | |
| 562 | + dst.append(t); | |
| 563 | + } | |
| 564 | +} | |
| 565 | + | |
| 530 | 566 | void OpenCVUtils::rotate(const br::Template &src, br::Template &dst, int degrees, bool rotateMat, bool rotatePoints, bool rotateRects) |
| 531 | 567 | { |
| 532 | 568 | Mat rotMatrix = getRotationMatrix2D(Point2f(src.m().rows/2,src.m().cols/2),degrees,1.0); | ... | ... |
openbr/core/opencvutils.h
| ... | ... | @@ -103,6 +103,8 @@ namespace OpenCVUtils |
| 103 | 103 | |
| 104 | 104 | // Misc |
| 105 | 105 | void group(QList<cv::Rect> &rects, QList<float> &confidences, float confidenceThreshold, int minNeighbors, float epsilon); |
| 106 | + void pad(const br::Template &src, br::Template &dst, bool padMat, const QList<int> &padding, bool padPoints, bool padRects, int border=0, int value=0); | |
| 107 | + void pad(const br::TemplateList &src, br::TemplateList &dst, bool padMat, const QList<int> &padding, bool padPoints, bool padRects, int border=0, int value=0); | |
| 106 | 108 | void rotate(const br::Template &src, br::Template &dst, int degrees, bool rotateMat=true, bool rotatePoints=true, bool rotateRects=true); |
| 107 | 109 | void rotate(const br::TemplateList &src, br::TemplateList &dst, int degrees, bool rotateMat=true, bool rotatePoint=true, bool rotateRects=true); |
| 108 | 110 | void flip(const br::Template &src, br::Template &dst, int axis, bool flipMat=true, bool flipPoints=true, bool flipRects=true); | ... | ... |
openbr/plugins/imgproc/pad.cpp
| 1 | 1 | #include <opencv2/imgproc/imgproc.hpp> |
| 2 | 2 | #include <openbr/plugins/openbr_internal.h> |
| 3 | +#include <openbr/core/opencvutils.h> | |
| 3 | 4 | |
| 4 | 5 | using namespace cv; |
| 5 | 6 | |
| ... | ... | @@ -35,7 +36,7 @@ private: |
| 35 | 36 | int top, bottom, left, right; |
| 36 | 37 | top = percent*src.m().rows; bottom = percent*src.m().rows; |
| 37 | 38 | left = percent*src.m().cols; right = percent*src.m().cols; |
| 38 | - copyMakeBorder(src, dst, top, bottom, left, right, border, Scalar(value)); | |
| 39 | + OpenCVUtils::pad(src,dst,true,QList<int>() << top << bottom << left << right,true,true,border,value); | |
| 39 | 40 | } |
| 40 | 41 | }; |
| 41 | 42 | ... | ... |