mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-06 04:56:51 +08:00
Sorting TextLines from top to bottom vertically
This commit is contained in:
@@ -25,6 +25,8 @@
|
||||
using namespace cv;
|
||||
using namespace std;
|
||||
|
||||
bool sort_text_line(TextLine i, TextLine j) { return (i.topLine.p1.y < j.topLine.p1.y); }
|
||||
|
||||
CharacterAnalysis::CharacterAnalysis(PipelineData* pipeline_data)
|
||||
{
|
||||
this->pipeline_data = pipeline_data;
|
||||
@@ -155,6 +157,9 @@ void CharacterAnalysis::analyze()
|
||||
|
||||
filterBetweenLines(bestThreshold, bestContours, tempTextLines);
|
||||
|
||||
// Sort the lines from top to bottom.
|
||||
std::sort(tempTextLines.begin(), tempTextLines.end(), sort_text_line);
|
||||
|
||||
// Now that we've filtered a few more contours, re-do the text area.
|
||||
for (uint i = 0; i < tempTextLines.size(); i++)
|
||||
{
|
||||
|
@@ -20,6 +20,7 @@
|
||||
#ifndef OPENALPR_CHARACTERANALYSIS_H
|
||||
#define OPENALPR_CHARACTERANALYSIS_H
|
||||
|
||||
#include <algorithm>
|
||||
#include "opencv2/imgproc/imgproc.hpp"
|
||||
#include "utility.h"
|
||||
#include "config.h"
|
||||
|
Reference in New Issue
Block a user