mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-06 08:27:08 +08:00
Moved more data members to textline
This commit is contained in:
@@ -49,6 +49,7 @@ void CharacterAnalysis::analyze()
|
||||
timespec startTime;
|
||||
getTime(&startTime);
|
||||
|
||||
pipeline_data->textLines.clear();
|
||||
|
||||
for (uint i = 0; i < pipeline_data->thresholds.size(); i++)
|
||||
{
|
||||
@@ -149,18 +150,19 @@ void CharacterAnalysis::analyze()
|
||||
displayImage(config, "Matching Contours", img_contours);
|
||||
}
|
||||
|
||||
this->linePolygon = getBestVotedLines(pipeline_data->crop_gray, bestContours);
|
||||
vector<Point> linePolygon = getBestVotedLines(pipeline_data->crop_gray, bestContours);
|
||||
|
||||
if (this->linePolygon.size() > 0)
|
||||
if (linePolygon.size() > 0)
|
||||
{
|
||||
LineSegment topLine = LineSegment(this->linePolygon[0].x, this->linePolygon[0].y, this->linePolygon[1].x, this->linePolygon[1].y);
|
||||
LineSegment bottomLine = LineSegment(this->linePolygon[3].x, this->linePolygon[3].y, this->linePolygon[2].x, this->linePolygon[2].y);
|
||||
|
||||
LineSegment topLine = LineSegment(linePolygon[0].x, linePolygon[0].y, linePolygon[1].x, linePolygon[1].y);
|
||||
LineSegment bottomLine = LineSegment(linePolygon[3].x, linePolygon[3].y, linePolygon[2].x, linePolygon[2].y);
|
||||
|
||||
filterBetweenLines(bestThreshold, bestContours, linePolygon);
|
||||
|
||||
|
||||
vector<Point> textArea = getCharArea(topLine, bottomLine);
|
||||
|
||||
TextLine textLine(textArea, topLine, bottomLine);
|
||||
TextLine textLine(textArea, linePolygon);
|
||||
|
||||
pipeline_data->textLines.push_back(textLine);
|
||||
}
|
||||
|
@@ -39,8 +39,6 @@ class CharacterAnalysis
|
||||
|
||||
TextContours bestContours;
|
||||
|
||||
std::vector<cv::Point> linePolygon;
|
||||
|
||||
bool thresholdsInverted;
|
||||
bool isTwoLine;
|
||||
|
||||
|
@@ -20,12 +20,15 @@
|
||||
|
||||
#include "textline.h"
|
||||
|
||||
TextLine::TextLine(std::vector<cv::Point> textArea, LineSegment topLine, LineSegment bottomLine) {
|
||||
TextLine::TextLine(std::vector<cv::Point> textArea, std::vector<cv::Point> linePolygon) {
|
||||
if (textArea.size() > 0)
|
||||
{
|
||||
this->textArea = textArea;
|
||||
this->topLine = topLine;
|
||||
this->bottomLine = bottomLine;
|
||||
this->linePolygon = linePolygon;
|
||||
|
||||
this->topLine = LineSegment(linePolygon[0].x, linePolygon[0].y, linePolygon[1].x, linePolygon[1].y);
|
||||
this->bottomLine = LineSegment(linePolygon[3].x, linePolygon[3].y, linePolygon[2].x, linePolygon[2].y);
|
||||
|
||||
this->charBoxTop = LineSegment(textArea[0].x, textArea[0].y, textArea[1].x, textArea[1].y);
|
||||
this->charBoxBottom = LineSegment(textArea[3].x, textArea[3].y, textArea[2].x, textArea[2].y);
|
||||
this->charBoxLeft = LineSegment(textArea[3].x, textArea[3].y, textArea[0].x, textArea[0].y);
|
||||
|
@@ -25,9 +25,10 @@
|
||||
|
||||
class TextLine {
|
||||
public:
|
||||
TextLine(std::vector<cv::Point> textArea, LineSegment topLine, LineSegment bottomLine);
|
||||
TextLine(std::vector<cv::Point> textArea, std::vector<cv::Point> linePolygon);
|
||||
virtual ~TextLine();
|
||||
|
||||
std::vector<cv::Point> linePolygon;
|
||||
std::vector<cv::Point> textArea;
|
||||
LineSegment topLine;
|
||||
LineSegment bottomLine;
|
||||
|
Reference in New Issue
Block a user