From faf8aed33a8de7d14ee2e32ef7c2fac86e0dc092 Mon Sep 17 00:00:00 2001 From: Matt Hill Date: Sun, 28 Jun 2015 11:45:34 -0400 Subject: [PATCH] Return 0 size crop if either width or height is 0 --- src/openalpr/transformation.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/openalpr/transformation.cpp b/src/openalpr/transformation.cpp index fba3840..ce7f6fc 100644 --- a/src/openalpr/transformation.cpp +++ b/src/openalpr/transformation.cpp @@ -129,6 +129,10 @@ namespace alpr float w = distanceBetweenPoints(leftEdge.midpoint(), rightEdge.midpoint()); float h = distanceBetweenPoints(bottomEdge.midpoint(), topEdge.midpoint()); + + if (w <= 0 || h <= 0) + return Size(0,0); + float aspect = w/h; int width = targetSize.width; int height = round(((float) width) / aspect);