mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-07 04:50:54 +08:00
Reusing expandRect function to verify bounds of rectangle
This commit is contained in:
@@ -191,16 +191,9 @@ for (int i = 0; i < rects.size(); i++) {
|
|||||||
|
|
||||||
PlateRegion PlateReg;
|
PlateRegion PlateReg;
|
||||||
|
|
||||||
PlateReg.rect = PlateRect.boundingRect();
|
// Ensure that the rectangle isn't < 0 or > maxWidth/Height
|
||||||
|
Rect bounding_rect = PlateRect.boundingRect();
|
||||||
if (PlateReg.rect.x < 0)
|
PlateReg.rect = expandRect(bounding_rect, 0, 0, frame.cols, frame.rows);
|
||||||
PlateReg.rect.x = 0;
|
|
||||||
if (PlateReg.rect.y < 0)
|
|
||||||
PlateReg.rect.y = 0;
|
|
||||||
if (PlateReg.rect.x + PlateReg.rect.width > frame.cols)
|
|
||||||
PlateReg.rect.width = frame.cols - PlateReg.rect.x;
|
|
||||||
if (PlateReg.rect.y + PlateReg.rect.height > frame.rows)
|
|
||||||
PlateReg.rect.height = frame.rows - PlateReg.rect.y;
|
|
||||||
|
|
||||||
|
|
||||||
detectedRegions.push_back(PlateReg);
|
detectedRegions.push_back(PlateReg);
|
||||||
|
Reference in New Issue
Block a user