diff --git a/openbr/plugins/register.cpp b/openbr/plugins/register.cpp index e32d126..ffb169f 100644 --- a/openbr/plugins/register.cpp +++ b/openbr/plugins/register.cpp @@ -72,6 +72,10 @@ class AffineTransform : public UntrainableTransform (src.file.contains("Affine_2") || twoPoints)) { srcPoints[0] = OpenCVUtils::toPoint(src.file.get("Affine_0")); srcPoints[1] = OpenCVUtils::toPoint(src.file.get("Affine_1")); + + dst.file.set("Affine_0", OpenCVUtils::fromPoint(dstPoints[0])); + dst.file.set("Affine_1", OpenCVUtils::fromPoint(dstPoints[1])); + if (!twoPoints) srcPoints[2] = OpenCVUtils::toPoint(src.file.get("Affine_2")); } else { const QList landmarks = OpenCVUtils::toPoints(src.file.points()); @@ -93,9 +97,6 @@ class AffineTransform : public UntrainableTransform if (twoPoints) srcPoints[2] = getThirdAffinePoint(srcPoints[0], srcPoints[1]); warpAffine(src, dst, getAffineTransform(srcPoints, dstPoints), Size(width, height)); - - dst.file.set("Affine_0", OpenCVUtils::fromPoint(dstPoints[0])); - dst.file.set("Affine_1", OpenCVUtils::fromPoint(dstPoints[1])); } }; diff --git a/openbr/plugins/stasm.cpp b/openbr/plugins/stasm.cpp index 8682438..8ab77ec 100644 --- a/openbr/plugins/stasm.cpp +++ b/openbr/plugins/stasm.cpp @@ -57,10 +57,15 @@ class StasmTransform : public UntrainableTransform int landmarks[500]; DET_PARAMS parameters; - parameters.lex = src.file.get("Affine_0").x() - src.m().cols/2; - parameters.ley = src.m().rows/2 - src.file.get("Affine_0").y(); - parameters.rex = src.file.get("Affine_1").x() - src.m().cols/2; - parameters.rey = src.m().rows/2 - src.file.get("Affine_1").y(); + + if (src.file.contains("Affine_0") && src.file.contains("Affine_1")) { + parameters.lex = src.file.get("Affine_0").x() - src.m().cols/2; + parameters.ley = src.m().rows/2 - src.file.get("Affine_0").y(); + parameters.rex = src.file.get("Affine_1").x() - src.m().cols/2; + parameters.rey = src.m().rows/2 - src.file.get("Affine_1").y(); + } else { + parameters.lex = parameters.ley = parameters.rex = parameters.rey = INVALID; + } AsmSearchDll(numLandmarks, landmarks, qPrintable(src.file.name), reinterpret_cast(src.m().data), src.m(), models,