Commit a6fc60eb4e962e388ca737d61075ac74afef0ea0
1 parent
4569eb79
Fixed bug where if PP5 failed stasm would fail
Showing
2 changed files
with
13 additions
and
7 deletions
openbr/plugins/register.cpp
| @@ -72,6 +72,10 @@ class AffineTransform : public UntrainableTransform | @@ -72,6 +72,10 @@ class AffineTransform : public UntrainableTransform | ||
| 72 | (src.file.contains("Affine_2") || twoPoints)) { | 72 | (src.file.contains("Affine_2") || twoPoints)) { |
| 73 | srcPoints[0] = OpenCVUtils::toPoint(src.file.get<QPointF>("Affine_0")); | 73 | srcPoints[0] = OpenCVUtils::toPoint(src.file.get<QPointF>("Affine_0")); |
| 74 | srcPoints[1] = OpenCVUtils::toPoint(src.file.get<QPointF>("Affine_1")); | 74 | srcPoints[1] = OpenCVUtils::toPoint(src.file.get<QPointF>("Affine_1")); |
| 75 | + | ||
| 76 | + dst.file.set("Affine_0", OpenCVUtils::fromPoint(dstPoints[0])); | ||
| 77 | + dst.file.set("Affine_1", OpenCVUtils::fromPoint(dstPoints[1])); | ||
| 78 | + | ||
| 75 | if (!twoPoints) srcPoints[2] = OpenCVUtils::toPoint(src.file.get<QPointF>("Affine_2")); | 79 | if (!twoPoints) srcPoints[2] = OpenCVUtils::toPoint(src.file.get<QPointF>("Affine_2")); |
| 76 | } else { | 80 | } else { |
| 77 | const QList<Point2f> landmarks = OpenCVUtils::toPoints(src.file.points()); | 81 | const QList<Point2f> landmarks = OpenCVUtils::toPoints(src.file.points()); |
| @@ -93,9 +97,6 @@ class AffineTransform : public UntrainableTransform | @@ -93,9 +97,6 @@ class AffineTransform : public UntrainableTransform | ||
| 93 | if (twoPoints) srcPoints[2] = getThirdAffinePoint(srcPoints[0], srcPoints[1]); | 97 | if (twoPoints) srcPoints[2] = getThirdAffinePoint(srcPoints[0], srcPoints[1]); |
| 94 | 98 | ||
| 95 | warpAffine(src, dst, getAffineTransform(srcPoints, dstPoints), Size(width, height)); | 99 | warpAffine(src, dst, getAffineTransform(srcPoints, dstPoints), Size(width, height)); |
| 96 | - | ||
| 97 | - dst.file.set("Affine_0", OpenCVUtils::fromPoint(dstPoints[0])); | ||
| 98 | - dst.file.set("Affine_1", OpenCVUtils::fromPoint(dstPoints[1])); | ||
| 99 | } | 100 | } |
| 100 | }; | 101 | }; |
| 101 | 102 |
openbr/plugins/stasm.cpp
| @@ -57,10 +57,15 @@ class StasmTransform : public UntrainableTransform | @@ -57,10 +57,15 @@ class StasmTransform : public UntrainableTransform | ||
| 57 | int landmarks[500]; | 57 | int landmarks[500]; |
| 58 | 58 | ||
| 59 | DET_PARAMS parameters; | 59 | DET_PARAMS parameters; |
| 60 | - parameters.lex = src.file.get<QPoint>("Affine_0").x() - src.m().cols/2; | ||
| 61 | - parameters.ley = src.m().rows/2 - src.file.get<QPoint>("Affine_0").y(); | ||
| 62 | - parameters.rex = src.file.get<QPoint>("Affine_1").x() - src.m().cols/2; | ||
| 63 | - parameters.rey = src.m().rows/2 - src.file.get<QPoint>("Affine_1").y(); | 60 | + |
| 61 | + if (src.file.contains("Affine_0") && src.file.contains("Affine_1")) { | ||
| 62 | + parameters.lex = src.file.get<QPoint>("Affine_0").x() - src.m().cols/2; | ||
| 63 | + parameters.ley = src.m().rows/2 - src.file.get<QPoint>("Affine_0").y(); | ||
| 64 | + parameters.rex = src.file.get<QPoint>("Affine_1").x() - src.m().cols/2; | ||
| 65 | + parameters.rey = src.m().rows/2 - src.file.get<QPoint>("Affine_1").y(); | ||
| 66 | + } else { | ||
| 67 | + parameters.lex = parameters.ley = parameters.rex = parameters.rey = INVALID; | ||
| 68 | + } | ||
| 64 | 69 | ||
| 65 | AsmSearchDll(numLandmarks, landmarks, qPrintable(src.file.name), | 70 | AsmSearchDll(numLandmarks, landmarks, qPrintable(src.file.name), |
| 66 | reinterpret_cast<char*>(src.m().data), src.m(), models, | 71 | reinterpret_cast<char*>(src.m().data), src.m(), models, |