Return 0 size crop if either width or height is 0

This commit is contained in:
Matt Hill
2015-06-28 11:45:34 -04:00
parent d8f84cb702
commit faf8aed33a

View File

@@ -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);