diff --git a/src/openalpr/prewarp.cpp b/src/openalpr/prewarp.cpp index 93de5b5..e1cd908 100644 --- a/src/openalpr/prewarp.cpp +++ b/src/openalpr/prewarp.cpp @@ -44,7 +44,7 @@ namespace alpr this->valid = false; } - else if (commacount != 8) + else if (commacount != 9) { if (this->config->debugPrewarp) cout << "Invalid prewarp configuration" << endl; @@ -78,6 +78,8 @@ namespace alpr ss.ignore(); // Ignore comma ss >> rotationz; ss.ignore(); // Ignore comma + ss >> stretchX; + ss.ignore(); // Ignore comma ss >> dist; ss.ignore(); // Ignore comma ss >> panX; @@ -113,7 +115,7 @@ namespace alpr 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; @@ -194,7 +196,7 @@ namespace alpr cv::Mat PreWarp::findTransform(float w, float h, float rotationx, float rotationy, float rotationz, - float panX, float panY, float dist) { + float panX, float panY, float stretchX, float dist) { float alpha = rotationx; float beta = rotationy; @@ -239,7 +241,7 @@ namespace alpr // Translation matrix on the Z axis Mat T = (Mat_(4, 4) << - 1, 0, 0, panX, + stretchX, 0, 0, panX, 0, 1, 0, panY, 0, 0, 1, dist, 0, 0, 0, 1); diff --git a/src/openalpr/prewarp.h b/src/openalpr/prewarp.h index 7e6a589..0ed5e13 100644 --- a/src/openalpr/prewarp.h +++ b/src/openalpr/prewarp.h @@ -45,9 +45,9 @@ namespace alpr Config* config; 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); }; }