mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-06 14:07:39 +08:00
Performance improvement -- stop processing filters if the character count is already 0.
This commit is contained in:
@@ -573,12 +573,12 @@ vector<bool> CharacterAnalysis::filter(Mat img, vector<vector<Point> > contours,
|
|||||||
goodIndices = this->filterByBoxSize(contours, goodIndices, STARTING_MIN_HEIGHT + (i * HEIGHT_STEP), STARTING_MAX_HEIGHT + (i * HEIGHT_STEP));
|
goodIndices = this->filterByBoxSize(contours, goodIndices, STARTING_MIN_HEIGHT + (i * HEIGHT_STEP), STARTING_MAX_HEIGHT + (i * HEIGHT_STEP));
|
||||||
|
|
||||||
goodIndicesCount = getGoodIndicesCount(goodIndices);
|
goodIndicesCount = getGoodIndicesCount(goodIndices);
|
||||||
if ( goodIndicesCount > 0 && goodIndicesCount <= bestFitScore) // Don't bother doing more filtering if we already lost...
|
if ( goodIndicesCount == 0 || goodIndicesCount <= bestFitScore) // Don't bother doing more filtering if we already lost...
|
||||||
continue;
|
continue;
|
||||||
goodIndices = this->filterContourHoles(contours, hierarchy, goodIndices);
|
goodIndices = this->filterContourHoles(contours, hierarchy, goodIndices);
|
||||||
|
|
||||||
goodIndicesCount = getGoodIndicesCount(goodIndices);
|
goodIndicesCount = getGoodIndicesCount(goodIndices);
|
||||||
if ( goodIndicesCount > 0 && goodIndicesCount <= bestFitScore) // Don't bother doing more filtering if we already lost...
|
if ( goodIndicesCount == 0 || goodIndicesCount <= bestFitScore) // Don't bother doing more filtering if we already lost...
|
||||||
continue;
|
continue;
|
||||||
//goodIndices = this->filterByParentContour( contours, hierarchy, goodIndices);
|
//goodIndices = this->filterByParentContour( contours, hierarchy, goodIndices);
|
||||||
vector<Point> lines = getBestVotedLines(img, contours, goodIndices);
|
vector<Point> lines = getBestVotedLines(img, contours, goodIndices);
|
||||||
|
@@ -37,7 +37,7 @@ CharacterRegion::CharacterRegion(Mat img, Config* config)
|
|||||||
charAnalysis = new CharacterAnalysis(img, config);
|
charAnalysis = new CharacterAnalysis(img, config);
|
||||||
charAnalysis->analyze();
|
charAnalysis->analyze();
|
||||||
|
|
||||||
if (this->debug)
|
if (this->debug && charAnalysis->linePolygon.size() > 0)
|
||||||
{
|
{
|
||||||
vector<Mat> tempDash;
|
vector<Mat> tempDash;
|
||||||
for (int z = 0; z < charAnalysis->thresholds.size(); z++)
|
for (int z = 0; z < charAnalysis->thresholds.size(); z++)
|
||||||
|
Reference in New Issue
Block a user