mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-07 21:40:56 +08:00
Finally getting rid of "OpenCV Error: Assertion failed (0 <= roi.x && 0 <= roi.width..."
This commit is contained in:
@@ -40,18 +40,12 @@ namespace alpr
|
|||||||
expandedRegion.y = expandedRegion.y - halfY;
|
expandedRegion.y = expandedRegion.y - halfY;
|
||||||
expandedRegion.height = expandedRegion.height + expandYPixels;
|
expandedRegion.height = expandedRegion.height + expandYPixels;
|
||||||
|
|
||||||
if (expandedRegion.x < 0)
|
expandedRegion.x = std::min(std::max(expandedRegion.x, 0), maxX);
|
||||||
expandedRegion.x = 0;
|
expandedRegion.y = std::min(std::max(expandedRegion.y, 0), maxY);
|
||||||
if (expandedRegion.y < 0)
|
|
||||||
expandedRegion.y = 0;
|
|
||||||
if (expandedRegion.x + expandedRegion.width > maxX)
|
if (expandedRegion.x + expandedRegion.width > maxX)
|
||||||
expandedRegion.width = maxX - expandedRegion.x;
|
expandedRegion.width = maxX - expandedRegion.x;
|
||||||
if (expandedRegion.y + expandedRegion.height > maxY)
|
if (expandedRegion.y + expandedRegion.height > maxY)
|
||||||
expandedRegion.height = maxY - expandedRegion.y;
|
expandedRegion.height = maxY - expandedRegion.y;
|
||||||
if (expandedRegion.width < 0)
|
|
||||||
expandedRegion.width = 0;
|
|
||||||
if (expandedRegion.height < 0)
|
|
||||||
expandedRegion.height = 0;
|
|
||||||
|
|
||||||
return expandedRegion;
|
return expandedRegion;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user