mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-06 06:46:53 +08:00
Fixed issue where detected region has a negative width/height
This commit is contained in:
@@ -35,6 +35,7 @@ set(lpr_source_files
|
||||
textdetection/linefinder.cpp
|
||||
pipeline_data.cpp
|
||||
cjson.c
|
||||
motiondetector.cpp
|
||||
)
|
||||
|
||||
|
||||
|
@@ -111,13 +111,16 @@ namespace alpr
|
||||
|
||||
for( unsigned int i = 0; i < plates.size(); i++ )
|
||||
{
|
||||
plates[i].x = (plates[i].x / scale_factor) + offset_x;
|
||||
plates[i].y = (plates[i].y / scale_factor) + offset_y;
|
||||
plates[i].x = (plates[i].x / scale_factor);
|
||||
plates[i].y = (plates[i].y / scale_factor);
|
||||
plates[i].width = plates[i].width / 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);
|
||||
plates[i] = expandRect(plates[i], 0, 0, w, h);
|
||||
|
||||
plates[i].x = plates[i].x + offset_x;
|
||||
plates[i].y = plates[i].y + offset_y;
|
||||
}
|
||||
|
||||
vector<PlateRegion> orderedRegions = aggregateRegions(plates);
|
||||
|
@@ -121,13 +121,16 @@ namespace alpr
|
||||
|
||||
for( unsigned int i = 0; i < plates.size(); i++ )
|
||||
{
|
||||
plates[i].x = (plates[i].x / scale_factor) + offset_x;
|
||||
plates[i].y = (plates[i].y / scale_factor) + offset_y;
|
||||
plates[i].x = (plates[i].x / scale_factor);
|
||||
plates[i].y = (plates[i].y / scale_factor);
|
||||
plates[i].width = plates[i].width / 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);
|
||||
plates[i] = expandRect(plates[i], 0, 0, w, h);
|
||||
|
||||
plates[i].x = plates[i].x + offset_x;
|
||||
plates[i].y = plates[i].y + offset_y;
|
||||
}
|
||||
|
||||
vector<PlateRegion> orderedRegions = aggregateRegions(plates);
|
||||
|
Reference in New Issue
Block a user