mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-05 15:57:01 +08:00
Split out projectRect function in prewarp
This commit is contained in:
@@ -183,21 +183,26 @@ namespace alpr
|
|||||||
|
|
||||||
for (unsigned int i = 0; i < rects.size(); i++)
|
for (unsigned int i = 0; i < rects.size(); i++)
|
||||||
{
|
{
|
||||||
|
Rect r = projectRect(rects[i], maxWidth, maxHeight, inverse);
|
||||||
|
projected_rects.push_back(r);
|
||||||
|
}
|
||||||
|
|
||||||
|
return projected_rects;
|
||||||
|
}
|
||||||
|
|
||||||
|
Rect PreWarp::projectRect(Rect rect, int maxWidth, int maxHeight, bool inverse) {
|
||||||
vector<Point2f> points;
|
vector<Point2f> points;
|
||||||
points.push_back(Point(rects[i].x, rects[i].y));
|
points.push_back(Point(rect.x, rect.y));
|
||||||
points.push_back(Point(rects[i].x + rects[i].width, rects[i].y));
|
points.push_back(Point(rect.x + rect.width, rect.y));
|
||||||
points.push_back(Point(rects[i].x + rects[i].width, rects[i].y + rects[i].height));
|
points.push_back(Point(rect.x + rect.width, rect.y + rect.height));
|
||||||
points.push_back(Point(rects[i].x, rects[i].y + rects[i].height));
|
points.push_back(Point(rect.x, rect.y + rect.height));
|
||||||
|
|
||||||
vector<Point2f> projectedPoints = projectPoints(points, inverse);
|
vector<Point2f> projectedPoints = projectPoints(points, inverse);
|
||||||
|
|
||||||
Rect projectedRect = boundingRect(projectedPoints);
|
Rect projectedRect = boundingRect(projectedPoints);
|
||||||
projectedRect = expandRect(projectedRect, 0, 0, maxWidth, maxHeight);
|
projectedRect = expandRect(projectedRect, 0, 0, maxWidth, maxHeight);
|
||||||
projected_rects.push_back(projectedRect);
|
|
||||||
|
|
||||||
}
|
return projectedRect;
|
||||||
|
|
||||||
return projected_rects;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<Point2f> PreWarp::projectPoints(vector<Point2f> points, bool inverse) {
|
vector<Point2f> PreWarp::projectPoints(vector<Point2f> points, bool inverse) {
|
||||||
|
@@ -40,6 +40,7 @@ namespace alpr
|
|||||||
cv::Mat warpImage(cv::Mat image);
|
cv::Mat warpImage(cv::Mat image);
|
||||||
std::vector<cv::Point2f> projectPoints(std::vector<cv::Point2f> points, bool inverse);
|
std::vector<cv::Point2f> projectPoints(std::vector<cv::Point2f> points, bool inverse);
|
||||||
std::vector<cv::Rect> projectRects(std::vector<cv::Rect> rects, int maxWidth, int maxHeight, bool inverse);
|
std::vector<cv::Rect> projectRects(std::vector<cv::Rect> rects, int maxWidth, int maxHeight, bool inverse);
|
||||||
|
cv::Rect projectRect(cv::Rect rect, int maxWidth, int maxHeight, bool inverse);
|
||||||
void projectPlateRegions(std::vector<PlateRegion>& plateRegions, int maxWidth, int maxHeight, bool inverse);
|
void projectPlateRegions(std::vector<PlateRegion>& plateRegions, int maxWidth, int maxHeight, bool inverse);
|
||||||
|
|
||||||
void setTransform(float w, float h, float rotationx, float rotationy, float rotationz, float panX, float panY, float stretchX, float dist);
|
void setTransform(float w, float h, float rotationx, float rotationy, float rotationz, float panX, float panY, float stretchX, float dist);
|
||||||
|
Reference in New Issue
Block a user