Commit 310083344b4cb3ec26abc0b871ea38043521be8d
1 parent
b32f0957
Added parameters for displaying named points and point locations
Showing
1 changed file
with
7 additions
and
2 deletions
openbr/plugins/draw.cpp
| ... | ... | @@ -42,11 +42,15 @@ class DrawTransform : public UntrainableTransform |
| 42 | 42 | Q_PROPERTY(bool rects READ get_rects WRITE set_rects RESET reset_rects STORED false) |
| 43 | 43 | Q_PROPERTY(bool inPlace READ get_inPlace WRITE set_inPlace RESET reset_inPlace STORED false) |
| 44 | 44 | Q_PROPERTY(int lineThickness READ get_lineThickness WRITE set_lineThickness RESET reset_lineThickness STORED false) |
| 45 | + Q_PROPERTY(bool named READ get_named WRITE set_named RESET reset_named STORED false) | |
| 46 | + Q_PROPERTY(bool location READ get_location WRITE set_location RESET reset_location STORED false) | |
| 45 | 47 | BR_PROPERTY(bool, verbose, false) |
| 46 | 48 | BR_PROPERTY(bool, points, true) |
| 47 | 49 | BR_PROPERTY(bool, rects, true) |
| 48 | 50 | BR_PROPERTY(bool, inPlace, false) |
| 49 | 51 | BR_PROPERTY(int, lineThickness, 1) |
| 52 | + BR_PROPERTY(bool, named, true) | |
| 53 | + BR_PROPERTY(bool, location, true) | |
| 50 | 54 | |
| 51 | 55 | void project(const Template &src, Template &dst) const |
| 52 | 56 | { |
| ... | ... | @@ -55,11 +59,12 @@ class DrawTransform : public UntrainableTransform |
| 55 | 59 | dst.m() = inPlace ? src.m() : src.m().clone(); |
| 56 | 60 | |
| 57 | 61 | if (points) { |
| 58 | - const QList<Point2f> pointsList = OpenCVUtils::toPoints(src.file.namedPoints() + src.file.points()); | |
| 62 | + const QList<Point2f> pointsList = (named) ? OpenCVUtils::toPoints(src.file.points()+src.file.namedPoints()) : OpenCVUtils::toPoints(src.file.points()); | |
| 59 | 63 | for (int i=0; i<pointsList.size(); i++) { |
| 60 | 64 | const Point2f &point = pointsList[i]; |
| 61 | 65 | circle(dst, point, 3, color, -1); |
| 62 | - if (verbose) putText(dst, QString("%1,(%2,%3)").arg(QString::number(i),QString::number(point.x),QString::number(point.y)).toStdString(), point, FONT_HERSHEY_SIMPLEX, 0.5, verboseColor, 1); | |
| 66 | + QString label = (location) ? QString("%1,(%2,%3)").arg(QString::number(i),QString::number(point.x),QString::number(point.y)) : QString("%1").arg(QString::number(i)); | |
| 67 | + if (verbose) putText(dst, label.toStdString(), point, FONT_HERSHEY_SIMPLEX, 0.5, verboseColor, 1); | |
| 63 | 68 | } |
| 64 | 69 | } |
| 65 | 70 | if (rects) { | ... | ... |