Commit 71885f41dce92f2a3c47bda7673560b4c115dd2b
1 parent
7f2ebb97
Scale operates on points and rects as well
Showing
1 changed file
with
12 additions
and
1 deletions
openbr/plugins/cvt.cpp
| ... | ... | @@ -115,7 +115,18 @@ class ScaleTransform : public UntrainableTransform |
| 115 | 115 | |
| 116 | 116 | void project(const Template &src, Template &dst) const |
| 117 | 117 | { |
| 118 | - resize(src, dst, Size(src.m().cols*scaleFactor,src.m().rows*scaleFactor)); | |
| 118 | + resize(src, dst, Size(src.m().cols*scaleFactor,src.m().rows*scaleFactor)); | |
| 119 | + | |
| 120 | + QList<QRectF> rects = src.file.rects(); | |
| 121 | + for (int i=0; i<rects.size(); i++) | |
| 122 | + rects[i] = QRectF(rects[i].topLeft()*scaleFactor,rects[i].bottomRight()*scaleFactor); | |
| 123 | + dst.file.setRects(rects); | |
| 124 | + | |
| 125 | + QList<QPointF> points = src.file.points(); | |
| 126 | + for (int i=0; i<points.size(); i++) | |
| 127 | + points[i] = points[i] * scaleFactor; | |
| 128 | + dst.file.setPoints(points); | |
| 129 | + | |
| 119 | 130 | } |
| 120 | 131 | }; |
| 121 | 132 | ... | ... |