Sorting TextLines from top to bottom vertically

This commit is contained in:
Matt Hill
2014-10-19 20:27:49 -04:00
parent 02e9517d83
commit 2a9c0de2e3
2 changed files with 6 additions and 0 deletions

View File

@@ -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++)
{

View File

@@ -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"