mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-07 00:02:52 +08:00
Using a perspective transformation on CharAnalysis instead of redoing the whole process during segmentation. Much faster and seems slightly more accurate -- will need to benchmark.
This commit is contained in:
@@ -24,9 +24,35 @@
|
||||
|
||||
using namespace cv;
|
||||
|
||||
TextLine::TextLine(std::vector<cv::Point2f> textArea, std::vector<cv::Point2f> linePolygon) {
|
||||
std::vector<Point> textAreaInts, linePolygonInts;
|
||||
|
||||
for (uint i = 0; i < textArea.size(); i++)
|
||||
textAreaInts.push_back(Point(round(textArea[i].x), round(textArea[i].y)));
|
||||
for (uint i = 0; i < linePolygon.size(); i++)
|
||||
linePolygonInts.push_back(Point(round(linePolygon[i].x), round(linePolygon[i].y)));
|
||||
|
||||
initialize(textAreaInts, linePolygonInts);
|
||||
}
|
||||
|
||||
TextLine::TextLine(std::vector<cv::Point> textArea, std::vector<cv::Point> linePolygon) {
|
||||
initialize(textArea, linePolygon);
|
||||
}
|
||||
|
||||
|
||||
TextLine::~TextLine() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
void TextLine::initialize(std::vector<cv::Point> textArea, std::vector<cv::Point> linePolygon) {
|
||||
if (textArea.size() > 0)
|
||||
{
|
||||
if (this->textArea.size() > 0)
|
||||
this->textArea.clear();
|
||||
if (this->linePolygon.size() > 0)
|
||||
this->linePolygon.clear();
|
||||
|
||||
for (uint i = 0; i < textArea.size(); i++)
|
||||
this->textArea.push_back(textArea[i]);
|
||||
|
||||
@@ -53,9 +79,6 @@ TextLine::TextLine(std::vector<cv::Point> textArea, std::vector<cv::Point> lineP
|
||||
}
|
||||
|
||||
|
||||
TextLine::~TextLine() {
|
||||
}
|
||||
|
||||
cv::Mat TextLine::drawDebugImage(cv::Mat baseImage) {
|
||||
cv::Mat debugImage(baseImage.size(), baseImage.type());
|
||||
|
||||
|
Reference in New Issue
Block a user