From 681cd399664102105c1333a9804aa5a767bc76cc Mon Sep 17 00:00:00 2001 From: bhklein Date: Mon, 28 Mar 2016 23:57:29 -0400 Subject: [PATCH] crop and resize landmark examples --- openbr/core/eval.cpp | 4 ++-- openbr/plugins/imgproc/cropfromlandmarks.cpp | 23 ++++++++++++++--------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/openbr/core/eval.cpp b/openbr/core/eval.cpp index 21b010b..3914d4f 100755 --- a/openbr/core/eval.cpp +++ b/openbr/core/eval.cpp @@ -898,7 +898,7 @@ float EvalLandmarking(const QString &predictedGallery, const QString &truthGalle { QScopedPointer t(Transform::make("Open+Draw(verbose,rects=false,location=false)",NULL)); - QString filePath = "landmarking_examples_truth/"+truth[sampleIndex].file.fileName(); + QString filePath = "landmarking_examples_truth/sample.jpg"; projectAndWrite(t.data(), truth[sampleIndex],filePath); lines.append("Sample,"+filePath+","+QString::number(truth[sampleIndex].file.points().size())); } @@ -906,7 +906,7 @@ float EvalLandmarking(const QString &predictedGallery, const QString &truthGalle // Get best and worst performing examples QList< QPair > exampleIndices = Common::Sort(imageErrors,true); - QScopedPointer t(Transform::make("Open+Draw(rects=false)",NULL)); + QScopedPointer t(Transform::make("Open+Draw(rects=false)+CropFromLandmarks+Resize(128,method=Area)",NULL)); for (int i=0; i cropIndices = indices; + if (cropIndices.isEmpty() && !src.file.points().isEmpty()) + for (int i=0; i src.file.points()[indices[i]].x()) - minX = src.file.points()[indices[i]].x(); - if (minY > src.file.points()[indices[i]].y()) - minY = src.file.points()[indices[i]].y(); - if (maxX < src.file.points()[indices[i]].x()) - maxX = src.file.points()[indices[i]].x(); - if (maxY < src.file.points()[indices[i]].y()) - maxY = src.file.points()[indices[i]].y(); + for (int i = 0; i src.file.points()[cropIndices[i]].x()) + minX = src.file.points()[cropIndices[i]].x(); + if (minY > src.file.points()[cropIndices[i]].y()) + minY = src.file.points()[cropIndices[i]].y(); + if (maxX < src.file.points()[cropIndices[i]].x()) + maxX = src.file.points()[cropIndices[i]].x(); + if (maxY < src.file.points()[cropIndices[i]].y()) + maxY = src.file.points()[cropIndices[i]].y(); } int padW = qRound((maxX - minX) * (paddingHorizontal / 2)); -- libgit2 0.21.4