mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-06 01:36:51 +08:00
Ensure detection rectangle is always within image frame bounds
This commit is contained in:
@@ -115,6 +115,9 @@ namespace alpr
|
|||||||
plates[i].y = (plates[i].y / scale_factor) + offset_y;
|
plates[i].y = (plates[i].y / scale_factor) + offset_y;
|
||||||
plates[i].width = plates[i].width / scale_factor;
|
plates[i].width = plates[i].width / scale_factor;
|
||||||
plates[i].height = plates[i].height / scale_factor;
|
plates[i].height = plates[i].height / scale_factor;
|
||||||
|
|
||||||
|
// Ensure that the rectangle isn't < 0 or > maxWidth/Height
|
||||||
|
plates[i] = expandRect(plates[i], 0, 0, frame.cols, frame.rows);
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<PlateRegion> orderedRegions = aggregateRegions(plates);
|
vector<PlateRegion> orderedRegions = aggregateRegions(plates);
|
||||||
|
@@ -125,6 +125,9 @@ namespace alpr
|
|||||||
plates[i].y = (plates[i].y / scale_factor) + offset_y;
|
plates[i].y = (plates[i].y / scale_factor) + offset_y;
|
||||||
plates[i].width = plates[i].width / scale_factor;
|
plates[i].width = plates[i].width / scale_factor;
|
||||||
plates[i].height = plates[i].height / scale_factor;
|
plates[i].height = plates[i].height / scale_factor;
|
||||||
|
|
||||||
|
// Ensure that the rectangle isn't < 0 or > maxWidth/Height
|
||||||
|
plates[i] = expandRect(plates[i], 0, 0, frame.cols, frame.rows);
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<PlateRegion> orderedRegions = aggregateRegions(plates);
|
vector<PlateRegion> orderedRegions = aggregateRegions(plates);
|
||||||
|
Reference in New Issue
Block a user