diff --git a/src/openalpr/CMakeLists.txt b/src/openalpr/CMakeLists.txt index 2d95095..bfb3b22 100644 --- a/src/openalpr/CMakeLists.txt +++ b/src/openalpr/CMakeLists.txt @@ -35,6 +35,7 @@ set(lpr_source_files textdetection/linefinder.cpp pipeline_data.cpp cjson.c + motiondetector.cpp ) diff --git a/src/openalpr/detection/detectorcpu.cpp b/src/openalpr/detection/detectorcpu.cpp index 40413c7..0564f4b 100644 --- a/src/openalpr/detection/detectorcpu.cpp +++ b/src/openalpr/detection/detectorcpu.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 orderedRegions = aggregateRegions(plates); diff --git a/src/openalpr/detection/detectorcuda.cpp b/src/openalpr/detection/detectorcuda.cpp index 1fd42db..b57bb4f 100644 --- a/src/openalpr/detection/detectorcuda.cpp +++ b/src/openalpr/detection/detectorcuda.cpp @@ -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 orderedRegions = aggregateRegions(plates); diff --git a/src/video/motiondetector.cpp b/src/openalpr/motiondetector.cpp similarity index 100% rename from src/video/motiondetector.cpp rename to src/openalpr/motiondetector.cpp diff --git a/src/video/motiondetector.h b/src/openalpr/motiondetector.h similarity index 100% rename from src/video/motiondetector.h rename to src/openalpr/motiondetector.h