mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-06 05:16:51 +08:00
Added prewarp stretch
This commit is contained in:
@@ -44,7 +44,7 @@ namespace alpr
|
|||||||
|
|
||||||
this->valid = false;
|
this->valid = false;
|
||||||
}
|
}
|
||||||
else if (commacount != 8)
|
else if (commacount != 9)
|
||||||
{
|
{
|
||||||
if (this->config->debugPrewarp)
|
if (this->config->debugPrewarp)
|
||||||
cout << "Invalid prewarp configuration" << endl;
|
cout << "Invalid prewarp configuration" << endl;
|
||||||
@@ -78,6 +78,8 @@ namespace alpr
|
|||||||
ss.ignore(); // Ignore comma
|
ss.ignore(); // Ignore comma
|
||||||
ss >> rotationz;
|
ss >> rotationz;
|
||||||
ss.ignore(); // Ignore comma
|
ss.ignore(); // Ignore comma
|
||||||
|
ss >> stretchX;
|
||||||
|
ss.ignore(); // Ignore comma
|
||||||
ss >> dist;
|
ss >> dist;
|
||||||
ss.ignore(); // Ignore comma
|
ss.ignore(); // Ignore comma
|
||||||
ss >> panX;
|
ss >> panX;
|
||||||
@@ -113,7 +115,7 @@ namespace alpr
|
|||||||
float py = panY / height_ratio;
|
float py = panY / height_ratio;
|
||||||
|
|
||||||
|
|
||||||
transform = findTransform(image.cols, image.rows, rx, ry, rotationz, px, py, dist);
|
transform = findTransform(image.cols, image.rows, rx, ry, rotationz, px, py, stretchX, dist);
|
||||||
|
|
||||||
|
|
||||||
Mat warped_image;
|
Mat warped_image;
|
||||||
@@ -194,7 +196,7 @@ namespace alpr
|
|||||||
|
|
||||||
cv::Mat PreWarp::findTransform(float w, float h,
|
cv::Mat PreWarp::findTransform(float w, float h,
|
||||||
float rotationx, float rotationy, float rotationz,
|
float rotationx, float rotationy, float rotationz,
|
||||||
float panX, float panY, float dist) {
|
float panX, float panY, float stretchX, float dist) {
|
||||||
|
|
||||||
float alpha = rotationx;
|
float alpha = rotationx;
|
||||||
float beta = rotationy;
|
float beta = rotationy;
|
||||||
@@ -239,7 +241,7 @@ namespace alpr
|
|||||||
|
|
||||||
// Translation matrix on the Z axis
|
// Translation matrix on the Z axis
|
||||||
Mat T = (Mat_<double>(4, 4) <<
|
Mat T = (Mat_<double>(4, 4) <<
|
||||||
1, 0, 0, panX,
|
stretchX, 0, 0, panX,
|
||||||
0, 1, 0, panY,
|
0, 1, 0, panY,
|
||||||
0, 0, 1, dist,
|
0, 0, 1, dist,
|
||||||
0, 0, 0, 1);
|
0, 0, 0, 1);
|
||||||
|
@@ -45,9 +45,9 @@ namespace alpr
|
|||||||
Config* config;
|
Config* config;
|
||||||
cv::Mat transform;
|
cv::Mat transform;
|
||||||
|
|
||||||
float w, h, rotationx, rotationy, rotationz, dist, panX, panY;
|
float w, h, rotationx, rotationy, rotationz, stretchX, dist, panX, panY;
|
||||||
|
|
||||||
cv::Mat findTransform(float w, float h, float rotationx, float rotationy, float rotationz, float panX, float panY, float dist);
|
cv::Mat findTransform(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