mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-05 22:26:51 +08:00
Replaced "uint" (platform specific) with "unsigned int" (universal)
This commit is contained in:
@@ -90,7 +90,7 @@ namespace alpr
|
||||
response.results.img_width = img.cols;
|
||||
response.results.img_height = img.rows;
|
||||
|
||||
for (uint i = 0; i < regionsOfInterest.size(); i++)
|
||||
for (unsigned int i = 0; i < regionsOfInterest.size(); i++)
|
||||
{
|
||||
response.results.regionsOfInterest.push_back(AlprRegionOfInterest(regionsOfInterest[i].x, regionsOfInterest[i].y,
|
||||
regionsOfInterest[i].width, regionsOfInterest[i].height));
|
||||
@@ -109,7 +109,7 @@ namespace alpr
|
||||
response.plateRegions = plateDetector->detect(img, regionsOfInterest);
|
||||
|
||||
queue<PlateRegion> plateQueue;
|
||||
for (uint i = 0; i < response.plateRegions.size(); i++)
|
||||
for (unsigned int i = 0; i < response.plateRegions.size(); i++)
|
||||
plateQueue.push(response.plateRegions[i]);
|
||||
|
||||
while(!plateQueue.empty())
|
||||
@@ -158,7 +158,7 @@ namespace alpr
|
||||
|
||||
int bestPlateIndex = 0;
|
||||
|
||||
for (uint pp = 0; pp < ppResults.size(); pp++)
|
||||
for (unsigned int pp = 0; pp < ppResults.size(); pp++)
|
||||
{
|
||||
if (pp >= topN)
|
||||
break;
|
||||
@@ -196,7 +196,7 @@ namespace alpr
|
||||
{
|
||||
// Not a valid plate
|
||||
// Check if this plate has any children, if so, send them back up for processing
|
||||
for (uint childidx = 0; childidx < plateRegion.children.size(); childidx++)
|
||||
for (unsigned int childidx = 0; childidx < plateRegion.children.size(); childidx++)
|
||||
{
|
||||
plateQueue.push(plateRegion.children[childidx]);
|
||||
}
|
||||
@@ -218,12 +218,12 @@ namespace alpr
|
||||
|
||||
if (config->debugGeneral && config->debugShowImages)
|
||||
{
|
||||
for (uint i = 0; i < response.plateRegions.size(); i++)
|
||||
for (unsigned int i = 0; i < response.plateRegions.size(); i++)
|
||||
{
|
||||
rectangle(img, response.plateRegions[i].rect, Scalar(0, 0, 255), 2);
|
||||
}
|
||||
|
||||
for (uint i = 0; i < response.results.plates.size(); i++)
|
||||
for (unsigned int i = 0; i < response.results.plates.size(); i++)
|
||||
{
|
||||
for (int z = 0; z < 4; z++)
|
||||
{
|
||||
@@ -290,7 +290,7 @@ namespace alpr
|
||||
std::vector<cv::Rect> AlprImpl::convertRects(std::vector<AlprRegionOfInterest> regionsOfInterest)
|
||||
{
|
||||
std::vector<cv::Rect> rectRegions;
|
||||
for (uint i = 0; i < regionsOfInterest.size(); i++)
|
||||
for (unsigned int i = 0; i < regionsOfInterest.size(); i++)
|
||||
{
|
||||
rectRegions.push_back(cv::Rect(regionsOfInterest[i].x, regionsOfInterest[i].y, regionsOfInterest[i].width, regionsOfInterest[i].height));
|
||||
}
|
||||
@@ -315,7 +315,7 @@ namespace alpr
|
||||
// Add the regions of interest to the JSON
|
||||
cJSON *rois;
|
||||
cJSON_AddItemToObject(root, "regions_of_interest", rois=cJSON_CreateArray());
|
||||
for (uint i=0;i<results.regionsOfInterest.size();i++)
|
||||
for (unsigned int i=0;i<results.regionsOfInterest.size();i++)
|
||||
{
|
||||
cJSON *roi_object;
|
||||
roi_object = cJSON_CreateObject();
|
||||
@@ -329,7 +329,7 @@ namespace alpr
|
||||
|
||||
|
||||
cJSON_AddItemToObject(root, "results", jsonResults=cJSON_CreateArray());
|
||||
for (uint i = 0; i < results.plates.size(); i++)
|
||||
for (unsigned int i = 0; i < results.plates.size(); i++)
|
||||
{
|
||||
cJSON *resultObj = createJsonObj( &results.plates[i] );
|
||||
cJSON_AddItemToArray(jsonResults, resultObj);
|
||||
@@ -378,7 +378,7 @@ namespace alpr
|
||||
|
||||
|
||||
cJSON_AddItemToObject(root, "candidates", candidates=cJSON_CreateArray());
|
||||
for (uint i = 0; i < result->topNPlates.size(); i++)
|
||||
for (unsigned int i = 0; i < result->topNPlates.size(); i++)
|
||||
{
|
||||
cJSON *candidate_object;
|
||||
candidate_object = cJSON_CreateObject();
|
||||
|
@@ -123,7 +123,7 @@ namespace alpr
|
||||
vector<float> hMeans, sMeans, vMeans;
|
||||
vector<float> hStdDevs, sStdDevs, vStdDevs;
|
||||
|
||||
for (uint i = 0; i < contours.size(); i++)
|
||||
for (unsigned int i = 0; i < contours.size(); i++)
|
||||
{
|
||||
if (hierarchy[i][3] != -1)
|
||||
continue;
|
||||
@@ -376,11 +376,11 @@ namespace alpr
|
||||
float lowestOverallDiff = 1000000000;
|
||||
int bestPercentAgreementIndex = -1;
|
||||
|
||||
for (uint i = 0; i < values.size(); i++)
|
||||
for (unsigned int i = 0; i < values.size(); i++)
|
||||
{
|
||||
int valuesInRange = 0;
|
||||
float overallDiff = 0;
|
||||
for (uint j = 0; j < values.size(); j++)
|
||||
for (unsigned int j = 0; j < values.size(); j++)
|
||||
{
|
||||
float diff = abs(values[i] - values[j]);
|
||||
if (diff < maxValDifference)
|
||||
|
@@ -95,9 +95,9 @@ namespace alpr
|
||||
|
||||
float postProcessMinConfidence;
|
||||
float postProcessConfidenceSkipLevel;
|
||||
uint postProcessMaxSubstitutions;
|
||||
uint postProcessMinCharacters;
|
||||
uint postProcessMaxCharacters;
|
||||
unsigned int postProcessMaxSubstitutions;
|
||||
unsigned int postProcessMinCharacters;
|
||||
unsigned int postProcessMaxCharacters;
|
||||
|
||||
|
||||
bool debugGeneral;
|
||||
|
@@ -73,17 +73,17 @@ namespace alpr
|
||||
std::sort(regions.begin(), regions.end(), rectHasLargerArea);
|
||||
|
||||
// Create new PlateRegions and attach the rectangles to each
|
||||
for (uint i = 0; i < regions.size(); i++)
|
||||
for (unsigned int i = 0; i < regions.size(); i++)
|
||||
{
|
||||
PlateRegion newRegion;
|
||||
newRegion.rect = regions[i];
|
||||
orderedRegions.push_back(newRegion);
|
||||
}
|
||||
|
||||
for (uint i = 0; i < orderedRegions.size(); i++)
|
||||
for (unsigned int i = 0; i < orderedRegions.size(); i++)
|
||||
{
|
||||
bool foundParent = false;
|
||||
for (uint k = i + 1; k < orderedRegions.size(); k++)
|
||||
for (unsigned int k = i + 1; k < orderedRegions.size(); k++)
|
||||
{
|
||||
Point center( orderedRegions[i].rect.x + (orderedRegions[i].rect.width / 2),
|
||||
orderedRegions[i].rect.y + (orderedRegions[i].rect.height / 2));
|
||||
|
@@ -106,7 +106,7 @@ namespace alpr
|
||||
cout << "LBP Time: " << diffclock(startTime, endTime) << "ms." << endl;
|
||||
}
|
||||
|
||||
for( uint i = 0; i < plates.size(); i++ )
|
||||
for( unsigned int i = 0; i < plates.size(); i++ )
|
||||
{
|
||||
plates[i].x = plates[i].x / scale_factor;
|
||||
plates[i].y = plates[i].y / scale_factor;
|
||||
|
@@ -106,7 +106,7 @@ namespace alpr
|
||||
|
||||
// Re-map the textline coordinates to the new crop
|
||||
vector<TextLine> newLines;
|
||||
for (uint i = 0; i < pipeline_data->textLines.size(); i++)
|
||||
for (unsigned int i = 0; i < pipeline_data->textLines.size(); i++)
|
||||
{
|
||||
vector<Point2f> textArea = imgTransform.transformSmallPointsToBigImage(pipeline_data->textLines[i].textArea);
|
||||
vector<Point2f> linePolygon = imgTransform.transformSmallPointsToBigImage(pipeline_data->textLines[i].linePolygon);
|
||||
|
@@ -87,7 +87,7 @@ namespace alpr
|
||||
Mat imgCorners = Mat(inputImage.size(), inputImage.type());
|
||||
inputImage.copyTo(imgCorners);
|
||||
|
||||
for (uint linenum = 0; linenum < textLines.size(); linenum++)
|
||||
for (unsigned int linenum = 0; linenum < textLines.size(); linenum++)
|
||||
{
|
||||
for (int i = 0; i < 4; i++)
|
||||
circle(imgCorners, textLines[linenum].textArea[i], 2, Scalar(0, 0, 0));
|
||||
|
@@ -75,7 +75,7 @@ namespace alpr
|
||||
|
||||
Mat mask = Mat::zeros(inputImage.size(), CV_8U);
|
||||
|
||||
for (uint i = 0; i < textLines.size(); i++)
|
||||
for (unsigned int i = 0; i < textLines.size(); i++)
|
||||
{
|
||||
vector<vector<Point> > polygons;
|
||||
polygons.push_back(textLines[i].textArea);
|
||||
@@ -93,9 +93,9 @@ namespace alpr
|
||||
|
||||
vector<PlateLine> hlines = this->getLines(edges, sensitivity, false);
|
||||
vector<PlateLine> vlines = this->getLines(edges, sensitivity, true);
|
||||
for (uint i = 0; i < hlines.size(); i++)
|
||||
for (unsigned int i = 0; i < hlines.size(); i++)
|
||||
this->horizontalLines.push_back(hlines[i]);
|
||||
for (uint i = 0; i < vlines.size(); i++)
|
||||
for (unsigned int i = 0; i < vlines.size(); i++)
|
||||
this->verticalLines.push_back(vlines[i]);
|
||||
|
||||
// if debug is enabled, draw the image
|
||||
|
@@ -18,7 +18,7 @@ namespace alpr
|
||||
|
||||
charHeight = 0;
|
||||
charAngle = 0;
|
||||
for (uint i = 0; i < textLines.size(); i++)
|
||||
for (unsigned int i = 0; i < textLines.size(); i++)
|
||||
{
|
||||
charHeight += textLines[i].lineHeight;
|
||||
charAngle += textLines[i].angle;
|
||||
@@ -29,7 +29,7 @@ namespace alpr
|
||||
|
||||
this->topCharArea = textLines[0].charBoxTop;
|
||||
this->bottomCharArea = textLines[0].charBoxBottom;
|
||||
for (uint i = 1; i < textLines.size(); i++)
|
||||
for (unsigned int i = 1; i < textLines.size(); i++)
|
||||
{
|
||||
|
||||
if (this->topCharArea.isPointBelowLine(textLines[i].charBoxTop.midpoint()) == false)
|
||||
|
@@ -44,7 +44,7 @@ namespace alpr
|
||||
|
||||
FeatureMatcher::~FeatureMatcher()
|
||||
{
|
||||
for (uint i = 0; i < trainingImgKeypoints.size(); i++)
|
||||
for (unsigned int i = 0; i < trainingImgKeypoints.size(); i++)
|
||||
trainingImgKeypoints[i].clear();
|
||||
trainingImgKeypoints.clear();
|
||||
|
||||
@@ -110,7 +110,7 @@ namespace alpr
|
||||
{
|
||||
bool already_exists = false;
|
||||
// Quickly run through the matches we've already added and make sure it's not a duplicate...
|
||||
for (uint q = 0; q < matches12.size(); q++)
|
||||
for (unsigned int q = 0; q < matches12.size(); q++)
|
||||
{
|
||||
if (matchesKnn[descInd][0].queryIdx == matches12[q].queryIdx)
|
||||
{
|
||||
@@ -155,10 +155,10 @@ namespace alpr
|
||||
Rect crissCrossAreaVertical(0, 0, config->stateIdImageWidthPx, config->stateIdimageHeightPx * 2);
|
||||
Rect crissCrossAreaHorizontal(0, 0, config->stateIdImageWidthPx * 2, config->stateIdimageHeightPx);
|
||||
|
||||
for (uint i = 0; i < billMapping.size(); i++)
|
||||
for (unsigned int i = 0; i < billMapping.size(); i++)
|
||||
{
|
||||
vector<DMatch> matchesForOnePlate;
|
||||
for (uint j = 0; j < inputMatches.size(); j++)
|
||||
for (unsigned int j = 0; j < inputMatches.size(); j++)
|
||||
{
|
||||
if (inputMatches[j].imgIdx == (int) i)
|
||||
matchesForOnePlate.push_back(inputMatches[j]);
|
||||
@@ -170,7 +170,7 @@ namespace alpr
|
||||
vector<LineSegment> hlines;
|
||||
vector<int> matchIdx;
|
||||
|
||||
for (uint j = 0; j < matchesForOnePlate.size(); j++)
|
||||
for (unsigned int j = 0; j < matchesForOnePlate.size(); j++)
|
||||
{
|
||||
KeyPoint tkp = trainingImgKeypoints[i][matchesForOnePlate[j].trainIdx];
|
||||
KeyPoint qkp = queryKeypoints[matchesForOnePlate[j].queryIdx];
|
||||
@@ -187,10 +187,10 @@ namespace alpr
|
||||
int mostIntersectionsIndex = -1;
|
||||
mostIntersections = 0;
|
||||
|
||||
for (uint j = 0; j < vlines.size(); j++)
|
||||
for (unsigned int j = 0; j < vlines.size(); j++)
|
||||
{
|
||||
int intrCount = 0;
|
||||
for (uint q = 0; q < vlines.size(); q++)
|
||||
for (unsigned int q = 0; q < vlines.size(); q++)
|
||||
{
|
||||
Point vintr = vlines[j].intersection(vlines[q]);
|
||||
Point hintr = hlines[j].intersection(hlines[q]);
|
||||
@@ -224,7 +224,7 @@ namespace alpr
|
||||
}
|
||||
|
||||
// Push the non-crisscrosses back on the list
|
||||
for (uint j = 0; j < matchIdx.size(); j++)
|
||||
for (unsigned int j = 0; j < matchIdx.size(); j++)
|
||||
{
|
||||
outputMatches.push_back(matchesForOnePlate[matchIdx[j]]);
|
||||
}
|
||||
@@ -243,7 +243,7 @@ namespace alpr
|
||||
vector<Mat> trainImages;
|
||||
vector<string> plateFiles = getFilesInDir(country_dir.c_str());
|
||||
|
||||
for (uint i = 0; i < plateFiles.size(); i++)
|
||||
for (unsigned int i = 0; i < plateFiles.size(); i++)
|
||||
{
|
||||
if (hasEnding(plateFiles[i], ".jpg") == false)
|
||||
continue;
|
||||
@@ -316,12 +316,12 @@ namespace alpr
|
||||
// Create and initialize the counts to 0
|
||||
std::vector<int> bill_match_counts( billMapping.size() );
|
||||
|
||||
for (uint i = 0; i < billMapping.size(); i++)
|
||||
for (unsigned int i = 0; i < billMapping.size(); i++)
|
||||
{
|
||||
bill_match_counts[i] = 0;
|
||||
}
|
||||
|
||||
for (uint i = 0; i < filteredMatches.size(); i++)
|
||||
for (unsigned int i = 0; i < filteredMatches.size(); i++)
|
||||
{
|
||||
bill_match_counts[filteredMatches[i].imgIdx]++;
|
||||
//if (filteredMatches[i].imgIdx
|
||||
@@ -330,7 +330,7 @@ namespace alpr
|
||||
float max_count = 0; // represented as a percent (0 to 100)
|
||||
int secondmost_count = 0;
|
||||
int maxcount_index = -1;
|
||||
for (uint i = 0; i < billMapping.size(); i++)
|
||||
for (unsigned int i = 0; i < billMapping.size(); i++)
|
||||
{
|
||||
if (bill_match_counts[i] > max_count && bill_match_counts[i] >= 4)
|
||||
{
|
||||
@@ -358,7 +358,7 @@ namespace alpr
|
||||
if (drawOnImage)
|
||||
{
|
||||
vector<KeyPoint> positiveMatches;
|
||||
for (uint i = 0; i < filteredMatches.size(); i++)
|
||||
for (unsigned int i = 0; i < filteredMatches.size(); i++)
|
||||
{
|
||||
if (filteredMatches[i].imgIdx == maxcount_index)
|
||||
{
|
||||
@@ -383,7 +383,7 @@ namespace alpr
|
||||
|
||||
if (this->config->debugStateId)
|
||||
{
|
||||
for (uint i = 0; i < billMapping.size(); i++)
|
||||
for (unsigned int i = 0; i < billMapping.size(); i++)
|
||||
{
|
||||
cout << billMapping[i] << " : " << bill_match_counts[i] << endl;
|
||||
}
|
||||
|
@@ -90,7 +90,7 @@ namespace alpr
|
||||
// Apply a perspective transformation to the TextLine objects
|
||||
// to match the newly deskewed license plate crop
|
||||
vector<TextLine> newLines;
|
||||
for (uint i = 0; i < pipeline_data->textLines.size(); i++)
|
||||
for (unsigned int i = 0; i < pipeline_data->textLines.size(); i++)
|
||||
{
|
||||
vector<Point2f> textArea = imgTransform.transformSmallPointsToBigImage(pipeline_data->textLines[i].textArea);
|
||||
vector<Point2f> linePolygon = imgTransform.transformSmallPointsToBigImage(pipeline_data->textLines[i].linePolygon);
|
||||
@@ -105,7 +105,7 @@ namespace alpr
|
||||
}
|
||||
|
||||
pipeline_data->textLines.clear();
|
||||
for (uint i = 0; i < newLines.size(); i++)
|
||||
for (unsigned int i = 0; i < newLines.size(); i++)
|
||||
pipeline_data->textLines.push_back(newLines[i]);
|
||||
|
||||
|
||||
|
@@ -62,7 +62,7 @@ namespace alpr
|
||||
if (pipeline_data->charRegions.size() < config->postProcessMinCharacters)
|
||||
return;
|
||||
|
||||
for (uint i = 0; i < pipeline_data->thresholds.size(); i++)
|
||||
for (unsigned int i = 0; i < pipeline_data->thresholds.size(); i++)
|
||||
{
|
||||
// Make it black text on white background
|
||||
bitwise_not(pipeline_data->thresholds[i], pipeline_data->thresholds[i]);
|
||||
@@ -70,7 +70,7 @@ namespace alpr
|
||||
pipeline_data->thresholds[i].size().width, pipeline_data->thresholds[i].size().height,
|
||||
pipeline_data->thresholds[i].channels(), pipeline_data->thresholds[i].step1());
|
||||
|
||||
for (uint j = 0; j < pipeline_data->charRegions.size(); j++)
|
||||
for (unsigned int j = 0; j < pipeline_data->charRegions.size(); j++)
|
||||
{
|
||||
Rect expandedRegion = expandRect( pipeline_data->charRegions[j], 2, 2, pipeline_data->thresholds[i].cols, pipeline_data->thresholds[i].rows) ;
|
||||
|
||||
|
@@ -26,7 +26,7 @@ namespace alpr
|
||||
|
||||
void PipelineData::clearThresholds()
|
||||
{
|
||||
for (uint i = 0; i < thresholds.size(); i++)
|
||||
for (unsigned int i = 0; i < thresholds.size(); i++)
|
||||
{
|
||||
thresholds[i].release();
|
||||
}
|
||||
|
@@ -69,7 +69,7 @@ namespace alpr
|
||||
// cvtColor(img_contours, img_contours, CV_GRAY2RGB);
|
||||
//
|
||||
// vector<vector<Point> > allowedContours;
|
||||
// for (uint i = 0; i < charAnalysis->bestContours.size(); i++)
|
||||
// for (unsigned int i = 0; i < charAnalysis->bestContours.size(); i++)
|
||||
// {
|
||||
// if (charAnalysis->bestContours.goodIndices[i])
|
||||
// allowedContours.push_back(charAnalysis->bestContours.contours[i]);
|
||||
@@ -96,7 +96,7 @@ namespace alpr
|
||||
|
||||
|
||||
|
||||
for (uint lineidx = 0; lineidx < pipeline_data->textLines.size(); lineidx++)
|
||||
for (unsigned int lineidx = 0; lineidx < pipeline_data->textLines.size(); lineidx++)
|
||||
{
|
||||
this->top = pipeline_data->textLines[lineidx].topLine;
|
||||
this->bottom = pipeline_data->textLines[lineidx].bottomLine;
|
||||
@@ -115,7 +115,7 @@ namespace alpr
|
||||
vector<Mat> allHistograms;
|
||||
|
||||
vector<Rect> lineBoxes;
|
||||
for (uint i = 0; i < pipeline_data->thresholds.size(); i++)
|
||||
for (unsigned int i = 0; i < pipeline_data->thresholds.size(); i++)
|
||||
{
|
||||
Mat histogramMask = Mat::zeros(pipeline_data->thresholds[i].size(), CV_8U);
|
||||
|
||||
@@ -139,7 +139,7 @@ namespace alpr
|
||||
|
||||
if (this->config->debugCharSegmenter)
|
||||
{
|
||||
for (uint cboxIdx = 0; cboxIdx < charBoxes.size(); cboxIdx++)
|
||||
for (unsigned int cboxIdx = 0; cboxIdx < charBoxes.size(); cboxIdx++)
|
||||
{
|
||||
rectangle(allHistograms[i], charBoxes[cboxIdx], Scalar(0, 255, 0));
|
||||
}
|
||||
@@ -148,7 +148,7 @@ namespace alpr
|
||||
displayImage(config, "Char seg histograms", histDashboard);
|
||||
}
|
||||
|
||||
for (uint z = 0; z < charBoxes.size(); z++)
|
||||
for (unsigned int z = 0; z < charBoxes.size(); z++)
|
||||
lineBoxes.push_back(charBoxes[z]);
|
||||
//drawAndWait(&histogramMask);
|
||||
}
|
||||
@@ -156,7 +156,7 @@ namespace alpr
|
||||
float medianCharWidth = avgCharWidth;
|
||||
vector<int> widthValues;
|
||||
// Compute largest char width
|
||||
for (uint i = 0; i < lineBoxes.size(); i++)
|
||||
for (unsigned int i = 0; i < lineBoxes.size(); i++)
|
||||
{
|
||||
widthValues.push_back(lineBoxes[i].width);
|
||||
}
|
||||
@@ -175,7 +175,7 @@ namespace alpr
|
||||
if (this->config->debugCharSegmenter)
|
||||
{
|
||||
// Setup the dashboard images to show the cleaning filters
|
||||
for (uint i = 0; i < pipeline_data->thresholds.size(); i++)
|
||||
for (unsigned int i = 0; i < pipeline_data->thresholds.size(); i++)
|
||||
{
|
||||
Mat cleanImg = Mat::zeros(pipeline_data->thresholds[i].size(), pipeline_data->thresholds[i].type());
|
||||
Mat boxMask = getCharBoxMask(pipeline_data->thresholds[i], candidateBoxes);
|
||||
@@ -183,7 +183,7 @@ namespace alpr
|
||||
bitwise_and(cleanImg, boxMask, cleanImg);
|
||||
cvtColor(cleanImg, cleanImg, CV_GRAY2BGR);
|
||||
|
||||
for (uint c = 0; c < candidateBoxes.size(); c++)
|
||||
for (unsigned int c = 0; c < candidateBoxes.size(); c++)
|
||||
rectangle(cleanImg, candidateBoxes[c], Scalar(0, 255, 0), 1);
|
||||
imgDbgCleanStages.push_back(cleanImg);
|
||||
}
|
||||
@@ -198,7 +198,7 @@ namespace alpr
|
||||
|
||||
candidateBoxes = filterMostlyEmptyBoxes(pipeline_data->thresholds, candidateBoxes);
|
||||
|
||||
for (uint cbox = 0; cbox < candidateBoxes.size(); cbox++)
|
||||
for (unsigned int cbox = 0; cbox < candidateBoxes.size(); cbox++)
|
||||
pipeline_data->charRegions.push_back(candidateBoxes[cbox]);
|
||||
|
||||
if (config->debugTiming)
|
||||
@@ -251,7 +251,7 @@ namespace alpr
|
||||
vector<Rect> charBoxes;
|
||||
vector<Rect> allBoxes = get1DHits(histogram.histoImg, pxLeniency);
|
||||
|
||||
for (uint i = 0; i < allBoxes.size(); i++)
|
||||
for (unsigned int i = 0; i < allBoxes.size(); i++)
|
||||
{
|
||||
if (allBoxes[i].width >= config->segmentationMinBoxWidthPx && allBoxes[i].width <= MAX_SEGMENT_WIDTH &&
|
||||
allBoxes[i].height > MIN_HISTOGRAM_HEIGHT )
|
||||
@@ -307,7 +307,7 @@ namespace alpr
|
||||
{
|
||||
columnCount = 0;
|
||||
|
||||
for (uint i = 0; i < charBoxes.size(); i++)
|
||||
for (unsigned int i = 0; i < charBoxes.size(); i++)
|
||||
{
|
||||
if (col >= charBoxes[i].x && col < (charBoxes[i].x + charBoxes[i].width))
|
||||
columnCount++;
|
||||
@@ -339,7 +339,7 @@ namespace alpr
|
||||
|
||||
float rowScore = 0;
|
||||
|
||||
for (uint boxidx = 0; boxidx < allBoxes.size(); boxidx++)
|
||||
for (unsigned int boxidx = 0; boxidx < allBoxes.size(); boxidx++)
|
||||
{
|
||||
int w = allBoxes[boxidx].width;
|
||||
if (w >= config->segmentationMinBoxWidthPx && w <= MAX_SEGMENT_WIDTH)
|
||||
@@ -398,7 +398,7 @@ namespace alpr
|
||||
Mat imgBestBoxes(img.size(), img.type());
|
||||
img.copyTo(imgBestBoxes);
|
||||
cvtColor(imgBestBoxes, imgBestBoxes, CV_GRAY2BGR);
|
||||
for (uint i = 0; i < bestBoxes.size(); i++)
|
||||
for (unsigned int i = 0; i < bestBoxes.size(); i++)
|
||||
rectangle(imgBestBoxes, bestBoxes[i], Scalar(0, 255, 0));
|
||||
|
||||
this->imgDbgGeneral.push_back(addLabel(histoImg, "All Histograms"));
|
||||
@@ -447,7 +447,7 @@ namespace alpr
|
||||
Mat textLineMask = Mat::zeros(thresholds[0].size(), CV_8U);
|
||||
fillConvexPoly(textLineMask, textLine.linePolygon.data(), textLine.linePolygon.size(), Scalar(255,255,255));
|
||||
|
||||
for (uint i = 0; i < thresholds.size(); i++)
|
||||
for (unsigned int i = 0; i < thresholds.size(); i++)
|
||||
{
|
||||
vector<vector<Point> > contours;
|
||||
vector<Vec4i> hierarchy;
|
||||
@@ -456,7 +456,7 @@ namespace alpr
|
||||
thresholds[i].copyTo(thresholdsCopy, textLineMask);
|
||||
findContours(thresholdsCopy, contours, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE);
|
||||
|
||||
for (uint c = 0; c < contours.size(); c++)
|
||||
for (unsigned int c = 0; c < contours.size(); c++)
|
||||
{
|
||||
if (contours[c].size() == 0)
|
||||
continue;
|
||||
@@ -476,7 +476,7 @@ namespace alpr
|
||||
{
|
||||
vector<Rect> newCharBoxes;
|
||||
|
||||
for (uint i = 0; i < charBoxes.size(); i++)
|
||||
for (unsigned int i = 0; i < charBoxes.size(); i++)
|
||||
{
|
||||
if (i == charBoxes.size() - 1)
|
||||
{
|
||||
@@ -496,7 +496,7 @@ namespace alpr
|
||||
newCharBoxes.push_back(bigRect);
|
||||
if (this->config->debugCharSegmenter)
|
||||
{
|
||||
for (uint z = 0; z < pipeline_data->thresholds.size(); z++)
|
||||
for (unsigned int z = 0; z < pipeline_data->thresholds.size(); z++)
|
||||
{
|
||||
Point center(bigRect.x + bigRect.width / 2, bigRect.y + bigRect.height / 2);
|
||||
RotatedRect rrect(center, Size2f(bigRect.width, bigRect.height + (bigRect.height / 2)), 0);
|
||||
@@ -525,7 +525,7 @@ namespace alpr
|
||||
|
||||
Mat mask = getCharBoxMask(thresholds[0], charRegions);
|
||||
|
||||
for (uint i = 0; i < thresholds.size(); i++)
|
||||
for (unsigned int i = 0; i < thresholds.size(); i++)
|
||||
{
|
||||
bitwise_and(thresholds[i], mask, thresholds[i]);
|
||||
vector<vector<Point> > contours;
|
||||
@@ -542,14 +542,14 @@ namespace alpr
|
||||
|
||||
findContours(tempImg, contours, RETR_EXTERNAL, CV_CHAIN_APPROX_SIMPLE);
|
||||
|
||||
for (uint j = 0; j < charRegions.size(); j++)
|
||||
for (unsigned int j = 0; j < charRegions.size(); j++)
|
||||
{
|
||||
const float MIN_SPECKLE_HEIGHT = ((float)charRegions[j].height) * MIN_SPECKLE_HEIGHT_PERCENT;
|
||||
const float MIN_CONTOUR_AREA = ((float)charRegions[j].area()) * MIN_CONTOUR_AREA_PERCENT;
|
||||
|
||||
int tallestContourHeight = 0;
|
||||
float totalArea = 0;
|
||||
for (uint c = 0; c < contours.size(); c++)
|
||||
for (unsigned int c = 0; c < contours.size(); c++)
|
||||
{
|
||||
if (contours[c].size() == 0)
|
||||
continue;
|
||||
@@ -621,7 +621,7 @@ namespace alpr
|
||||
morphologyEx(thresholds[i], thresholds[i], MORPH_CLOSE, closureElement);
|
||||
|
||||
// Lastly, draw a clipping line between each character boxes
|
||||
for (uint j = 0; j < charRegions.size(); j++)
|
||||
for (unsigned int j = 0; j < charRegions.size(); j++)
|
||||
{
|
||||
line(thresholds[i], Point(charRegions[j].x - 1, charRegions[j].y), Point(charRegions[j].x - 1, charRegions[j].y + charRegions[j].height), Scalar(0, 0, 0));
|
||||
line(thresholds[i], Point(charRegions[j].x + charRegions[j].width + 1, charRegions[j].y), Point(charRegions[j].x + charRegions[j].width + 1, charRegions[j].y + charRegions[j].height), Scalar(0, 0, 0));
|
||||
@@ -635,9 +635,9 @@ namespace alpr
|
||||
// Consider it a bad news bear. REmove the whole area.
|
||||
const float MIN_PERCENT_CHUNK_REMOVED = 0.6;
|
||||
|
||||
for (uint i = 0; i < thresholds.size(); i++)
|
||||
for (unsigned int i = 0; i < thresholds.size(); i++)
|
||||
{
|
||||
for (uint j = 0; j < charRegions.size(); j++)
|
||||
for (unsigned int j = 0; j < charRegions.size(); j++)
|
||||
{
|
||||
Mat boxChar = Mat::zeros(thresholds[i].size(), CV_8U);
|
||||
rectangle(boxChar, charRegions[j], Scalar(255,255,255), CV_FILLED);
|
||||
@@ -685,12 +685,12 @@ namespace alpr
|
||||
{
|
||||
float MAX_FILLED = 0.95 * 255;
|
||||
|
||||
for (uint i = 0; i < charRegions.size(); i++)
|
||||
for (unsigned int i = 0; i < charRegions.size(); i++)
|
||||
{
|
||||
Mat mask = Mat::zeros(thresholds[0].size(), CV_8U);
|
||||
rectangle(mask, charRegions[i], Scalar(255,255,255), -1);
|
||||
|
||||
for (uint j = 0; j < thresholds.size(); j++)
|
||||
for (unsigned int j = 0; j < thresholds.size(); j++)
|
||||
{
|
||||
if (mean(thresholds[j], mask)[0] > MAX_FILLED)
|
||||
{
|
||||
@@ -719,12 +719,12 @@ namespace alpr
|
||||
|
||||
vector<int> boxScores(charRegions.size());
|
||||
|
||||
for (uint i = 0; i < charRegions.size(); i++)
|
||||
for (unsigned int i = 0; i < charRegions.size(); i++)
|
||||
boxScores[i] = 0;
|
||||
|
||||
for (uint i = 0; i < thresholds.size(); i++)
|
||||
for (unsigned int i = 0; i < thresholds.size(); i++)
|
||||
{
|
||||
for (uint j = 0; j < charRegions.size(); j++)
|
||||
for (unsigned int j = 0; j < charRegions.size(); j++)
|
||||
{
|
||||
//float minArea = charRegions[j].area() * MIN_AREA_PERCENT;
|
||||
|
||||
@@ -736,12 +736,12 @@ namespace alpr
|
||||
findContours(tempImg, contours, RETR_EXTERNAL, CV_CHAIN_APPROX_SIMPLE);
|
||||
|
||||
vector<Point> allPointsInBox;
|
||||
for (uint c = 0; c < contours.size(); c++)
|
||||
for (unsigned int c = 0; c < contours.size(); c++)
|
||||
{
|
||||
if (contours[c].size() == 0)
|
||||
continue;
|
||||
|
||||
for (uint z = 0; z < contours[c].size(); z++)
|
||||
for (unsigned int z = 0; z < contours[c].size(); z++)
|
||||
allPointsInBox.push_back(contours[c][z]);
|
||||
}
|
||||
|
||||
@@ -765,7 +765,7 @@ namespace alpr
|
||||
vector<Rect> newCharRegions;
|
||||
|
||||
int maxBoxScore = 0;
|
||||
for (uint i = 0; i < charRegions.size(); i++)
|
||||
for (unsigned int i = 0; i < charRegions.size(); i++)
|
||||
{
|
||||
if (boxScores[i] > maxBoxScore)
|
||||
maxBoxScore = boxScores[i];
|
||||
@@ -775,7 +775,7 @@ namespace alpr
|
||||
int MIN_FULL_BOXES = maxBoxScore * 0.49;
|
||||
|
||||
// Now check each score. If it's below the minimum, remove the charRegion
|
||||
for (uint i = 0; i < charRegions.size(); i++)
|
||||
for (unsigned int i = 0; i < charRegions.size(); i++)
|
||||
{
|
||||
if (boxScores[i] > MIN_FULL_BOXES)
|
||||
newCharRegions.push_back(charRegions[i]);
|
||||
@@ -788,7 +788,7 @@ namespace alpr
|
||||
cout << " this box had a score of : " << boxScores[i];;
|
||||
cout << " MIN_FULL_BOXES: " << MIN_FULL_BOXES << endl;;
|
||||
|
||||
for (uint z = 0; z < thresholds.size(); z++)
|
||||
for (unsigned int z = 0; z < thresholds.size(); z++)
|
||||
{
|
||||
rectangle(thresholds[z], charRegions[i], Scalar(0,0,0), -1);
|
||||
|
||||
@@ -838,7 +838,7 @@ namespace alpr
|
||||
vector<int> leftEdges;
|
||||
vector<int> rightEdges;
|
||||
|
||||
for (uint i = 0; i < thresholds.size(); i++)
|
||||
for (unsigned int i = 0; i < thresholds.size(); i++)
|
||||
{
|
||||
Mat rotated;
|
||||
|
||||
@@ -944,7 +944,7 @@ namespace alpr
|
||||
cout << "Edge Filter: Entire right region is erased" << endl;
|
||||
}
|
||||
|
||||
for (uint i = 0; i < thresholds.size(); i++)
|
||||
for (unsigned int i = 0; i < thresholds.size(); i++)
|
||||
{
|
||||
bitwise_and(thresholds[i], mask, thresholds[i]);
|
||||
}
|
||||
@@ -957,7 +957,7 @@ namespace alpr
|
||||
|
||||
Mat invertedMask(mask.size(), mask.type());
|
||||
bitwise_not(mask, invertedMask);
|
||||
for (uint z = 0; z < imgDbgCleanStages.size(); z++)
|
||||
for (unsigned int z = 0; z < imgDbgCleanStages.size(); z++)
|
||||
fillMask(imgDbgCleanStages[z], invertedMask, Scalar(0,0,255));
|
||||
}
|
||||
}
|
||||
@@ -1028,7 +1028,7 @@ namespace alpr
|
||||
Mat boxMask = Mat::zeros(threshold.size(), CV_8U);
|
||||
rectangle(boxMask, slightlySmallerBox, Scalar(255, 255, 255), -1);
|
||||
|
||||
for (uint i = 0; i < contours.size(); i++)
|
||||
for (unsigned int i = 0; i < contours.size(); i++)
|
||||
{
|
||||
// Only bother with the big boxes
|
||||
if (boundingRect(contours[i]).height < MIN_EDGE_CONTOUR_HEIGHT)
|
||||
@@ -1044,7 +1044,7 @@ namespace alpr
|
||||
int tallestContourHeight = 0;
|
||||
int tallestContourWidth = 0;
|
||||
float tallestContourArea = 0;
|
||||
for (uint s = 0; s < subContours.size(); s++)
|
||||
for (unsigned int s = 0; s < subContours.size(); s++)
|
||||
{
|
||||
Rect r = boundingRect(subContours[s]);
|
||||
if (r.height > tallestContourHeight)
|
||||
@@ -1075,7 +1075,7 @@ namespace alpr
|
||||
Mat CharacterSegmenter::getCharBoxMask(Mat img_threshold, vector<Rect> charBoxes)
|
||||
{
|
||||
Mat mask = Mat::zeros(img_threshold.size(), CV_8U);
|
||||
for (uint i = 0; i < charBoxes.size(); i++)
|
||||
for (unsigned int i = 0; i < charBoxes.size(); i++)
|
||||
rectangle(mask, charBoxes[i], Scalar(255, 255, 255), -1);
|
||||
|
||||
return mask;
|
||||
|
@@ -146,7 +146,7 @@ namespace alpr
|
||||
}
|
||||
}
|
||||
|
||||
HistogramDirection VerticalHistogram::getHistogramDirection(uint index)
|
||||
HistogramDirection VerticalHistogram::getHistogramDirection(unsigned int index)
|
||||
{
|
||||
int EXTRA_WIDTH_TO_AVERAGE = 2;
|
||||
|
||||
@@ -156,7 +156,7 @@ namespace alpr
|
||||
int trailStartIndex = index - EXTRA_WIDTH_TO_AVERAGE;
|
||||
if (trailStartIndex < 0)
|
||||
trailStartIndex = 0;
|
||||
uint forwardEndIndex = index + EXTRA_WIDTH_TO_AVERAGE;
|
||||
unsigned int forwardEndIndex = index + EXTRA_WIDTH_TO_AVERAGE;
|
||||
if (forwardEndIndex >= colHeights.size())
|
||||
forwardEndIndex = colHeights.size() - 1;
|
||||
|
||||
@@ -166,7 +166,7 @@ namespace alpr
|
||||
}
|
||||
trailingAverage = trailingAverage / ((float) (1 + index - trailStartIndex));
|
||||
|
||||
for (uint i = index; i <= forwardEndIndex; i++)
|
||||
for (unsigned int i = index; i <= forwardEndIndex; i++)
|
||||
{
|
||||
forwardAverage += colHeights[i];
|
||||
}
|
||||
|
@@ -60,7 +60,7 @@ namespace alpr
|
||||
void analyzeImage(cv::Mat inputImage, cv::Mat mask);
|
||||
void findValleys();
|
||||
|
||||
HistogramDirection getHistogramDirection(uint index);
|
||||
HistogramDirection getHistogramDirection(unsigned int index);
|
||||
};
|
||||
|
||||
}
|
||||
|
@@ -60,7 +60,7 @@ namespace alpr
|
||||
|
||||
pipeline_data->textLines.clear();
|
||||
|
||||
for (uint i = 0; i < pipeline_data->thresholds.size(); i++)
|
||||
for (unsigned int i = 0; i < pipeline_data->thresholds.size(); i++)
|
||||
{
|
||||
TextContours tc(pipeline_data->thresholds[i]);
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace alpr
|
||||
|
||||
getTime(&startTime);
|
||||
|
||||
for (uint i = 0; i < pipeline_data->thresholds.size(); i++)
|
||||
for (unsigned int i = 0; i < pipeline_data->thresholds.size(); i++)
|
||||
{
|
||||
this->filter(pipeline_data->thresholds[i], allTextContours[i]);
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace alpr
|
||||
if (plateMask.hasPlateMask)
|
||||
{
|
||||
// Filter out bad contours now that we have an outer box mask...
|
||||
for (uint i = 0; i < pipeline_data->thresholds.size(); i++)
|
||||
for (unsigned int i = 0; i < pipeline_data->thresholds.size(); i++)
|
||||
{
|
||||
filterByOuterMask(allTextContours[i]);
|
||||
}
|
||||
@@ -109,7 +109,7 @@ namespace alpr
|
||||
|
||||
int bestFitScore = -1;
|
||||
int bestFitIndex = -1;
|
||||
for (uint i = 0; i < pipeline_data->thresholds.size(); i++)
|
||||
for (unsigned int i = 0; i < pipeline_data->thresholds.size(); i++)
|
||||
{
|
||||
|
||||
int segmentCount = allTextContours[i].getGoodIndicesCount();
|
||||
@@ -142,7 +142,7 @@ namespace alpr
|
||||
vector<vector<Point> > linePolygons = lf.findLines(pipeline_data->crop_gray, bestContours);
|
||||
|
||||
vector<TextLine> tempTextLines;
|
||||
for (uint i = 0; i < linePolygons.size(); i++)
|
||||
for (unsigned int i = 0; i < linePolygons.size(); i++)
|
||||
{
|
||||
vector<Point> linePolygon = linePolygons[i];
|
||||
|
||||
@@ -162,7 +162,7 @@ namespace alpr
|
||||
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++)
|
||||
for (unsigned int i = 0; i < tempTextLines.size(); i++)
|
||||
{
|
||||
vector<Point> updatedTextArea = getCharArea(tempTextLines[i].topLine, tempTextLines[i].bottomLine);
|
||||
vector<Point> linePolygon = tempTextLines[i].linePolygon;
|
||||
@@ -214,7 +214,7 @@ namespace alpr
|
||||
if (this->pipeline_data->config->debugCharAnalysis && pipeline_data->textLines.size() > 0)
|
||||
{
|
||||
vector<Mat> tempDash;
|
||||
for (uint z = 0; z < pipeline_data->thresholds.size(); z++)
|
||||
for (unsigned int z = 0; z < pipeline_data->thresholds.size(); z++)
|
||||
{
|
||||
Mat tmp(pipeline_data->thresholds[z].size(), pipeline_data->thresholds[z].type());
|
||||
pipeline_data->thresholds[z].copyTo(tmp);
|
||||
@@ -227,7 +227,7 @@ namespace alpr
|
||||
this->bestThreshold.copyTo(bestVal);
|
||||
cvtColor(bestVal, bestVal, CV_GRAY2BGR);
|
||||
|
||||
for (uint z = 0; z < this->bestContours.size(); z++)
|
||||
for (unsigned int z = 0; z < this->bestContours.size(); z++)
|
||||
{
|
||||
Scalar dcolor(255,0,0);
|
||||
if (this->bestContours.goodIndices[z])
|
||||
@@ -246,7 +246,7 @@ namespace alpr
|
||||
{
|
||||
Mat charMask = Mat::zeros(bestThreshold.size(), CV_8U);
|
||||
|
||||
for (uint i = 0; i < bestContours.size(); i++)
|
||||
for (unsigned int i = 0; i < bestContours.size(); i++)
|
||||
{
|
||||
if (bestContours.goodIndices[i] == false)
|
||||
continue;
|
||||
@@ -281,7 +281,7 @@ namespace alpr
|
||||
{
|
||||
|
||||
//vector<bool> goodIndices(contours.size());
|
||||
for (uint z = 0; z < textContours.size(); z++) textContours.goodIndices[z] = true;
|
||||
for (unsigned int z = 0; z < textContours.size(); z++) textContours.goodIndices[z] = true;
|
||||
|
||||
this->filterByBoxSize(textContours, STARTING_MIN_HEIGHT + (i * HEIGHT_STEP), STARTING_MAX_HEIGHT + (i * HEIGHT_STEP));
|
||||
|
||||
@@ -315,7 +315,7 @@ namespace alpr
|
||||
float aspecttolerance=0.25;
|
||||
|
||||
|
||||
for (uint i = 0; i < textContours.size(); i++)
|
||||
for (unsigned int i = 0; i < textContours.size(); i++)
|
||||
{
|
||||
if (textContours.goodIndices[i] == false)
|
||||
continue;
|
||||
@@ -344,7 +344,7 @@ namespace alpr
|
||||
void CharacterAnalysis::filterContourHoles(TextContours& textContours)
|
||||
{
|
||||
|
||||
for (uint i = 0; i < textContours.size(); i++)
|
||||
for (unsigned int i = 0; i < textContours.size(); i++)
|
||||
{
|
||||
if (textContours.goodIndices[i] == false)
|
||||
continue;
|
||||
@@ -377,7 +377,7 @@ namespace alpr
|
||||
vector<int> parentIDs;
|
||||
vector<int> votes;
|
||||
|
||||
for (uint i = 0; i < textContours.size(); i++)
|
||||
for (unsigned int i = 0; i < textContours.size(); i++)
|
||||
{
|
||||
if (textContours.goodIndices[i] == false)
|
||||
continue;
|
||||
@@ -387,7 +387,7 @@ namespace alpr
|
||||
int voteIndex = -1;
|
||||
int parentID = textContours.hierarchy[i][3];
|
||||
// check if parentID is already in the lsit
|
||||
for (uint j = 0; j < parentIDs.size(); j++)
|
||||
for (unsigned int j = 0; j < parentIDs.size(); j++)
|
||||
{
|
||||
if (parentIDs[j] == parentID)
|
||||
{
|
||||
@@ -410,7 +410,7 @@ namespace alpr
|
||||
int totalVotes = 0;
|
||||
int winningParentId = 0;
|
||||
int highestVotes = 0;
|
||||
for (uint i = 0; i < parentIDs.size(); i++)
|
||||
for (unsigned int i = 0; i < parentIDs.size(); i++)
|
||||
{
|
||||
if (votes[i] > highestVotes)
|
||||
{
|
||||
@@ -421,7 +421,7 @@ namespace alpr
|
||||
}
|
||||
|
||||
// Now filter out all the contours with a different parent ID (assuming the totalVotes > 2)
|
||||
for (uint i = 0; i < textContours.size(); i++)
|
||||
for (unsigned int i = 0; i < textContours.size(); i++)
|
||||
{
|
||||
if (textContours.goodIndices[i] == false)
|
||||
continue;
|
||||
@@ -452,11 +452,11 @@ namespace alpr
|
||||
// Create a white mask for the area inside the polygon
|
||||
Mat outerMask = Mat::zeros(img.size(), CV_8U);
|
||||
|
||||
for (uint i = 0; i < textLines.size(); i++)
|
||||
for (unsigned int i = 0; i < textLines.size(); i++)
|
||||
fillConvexPoly(outerMask, textLines[i].linePolygon.data(), textLines[i].linePolygon.size(), Scalar(255,255,255));
|
||||
|
||||
// For each contour, determine if enough of it is between the lines to qualify
|
||||
for (uint i = 0; i < textContours.size(); i++)
|
||||
for (unsigned int i = 0; i < textContours.size(); i++)
|
||||
{
|
||||
if (textContours.goodIndices[i] == false)
|
||||
continue;
|
||||
@@ -490,7 +490,7 @@ namespace alpr
|
||||
|
||||
// Get the absolute distance from the top and bottom lines
|
||||
|
||||
for (uint i = 0; i < textLines.size(); i++)
|
||||
for (unsigned int i = 0; i < textLines.size(); i++)
|
||||
{
|
||||
Point closestTopPoint = textLines[i].topLine.closestPointOnSegmentTo(topMiddle);
|
||||
Point closestBottomPoint = textLines[i].bottomLine.closestPointOnSegmentTo(botMiddle);
|
||||
@@ -535,10 +535,10 @@ namespace alpr
|
||||
int totalChars = 0;
|
||||
|
||||
vector<bool> originalindices;
|
||||
for (uint i = 0; i < textContours.size(); i++)
|
||||
for (unsigned int i = 0; i < textContours.size(); i++)
|
||||
originalindices.push_back(textContours.goodIndices[i]);
|
||||
|
||||
for (uint i=0; i < textContours.size(); i++)
|
||||
for (unsigned int i=0; i < textContours.size(); i++)
|
||||
{
|
||||
if (textContours.goodIndices[i] == false)
|
||||
continue;
|
||||
@@ -625,12 +625,12 @@ namespace alpr
|
||||
int leftX = MAX;
|
||||
int rightX = MIN;
|
||||
|
||||
for (uint i = 0; i < bestContours.size(); i++)
|
||||
for (unsigned int i = 0; i < bestContours.size(); i++)
|
||||
{
|
||||
if (bestContours.goodIndices[i] == false)
|
||||
continue;
|
||||
|
||||
for (uint z = 0; z < bestContours.contours[i].size(); z++)
|
||||
for (unsigned int z = 0; z < bestContours.contours[i].size(); z++)
|
||||
{
|
||||
if (bestContours.contours[i][z].x < leftX)
|
||||
leftX = bestContours.contours[i][z].x;
|
||||
|
@@ -46,7 +46,7 @@ namespace alpr
|
||||
|
||||
vector<CharPointInfo> charPoints;
|
||||
|
||||
for (uint i = 0; i < contours.contours.size(); i++)
|
||||
for (unsigned int i = 0; i < contours.contours.size(); i++)
|
||||
{
|
||||
if (contours.goodIndices[i] == false)
|
||||
continue;
|
||||
@@ -65,7 +65,7 @@ namespace alpr
|
||||
// Create a mask from the bestLine area, and remove all contours with tops that fall inside of it.
|
||||
|
||||
vector<CharPointInfo> remainingPoints;
|
||||
for (uint i = 0; i < charPoints.size(); i++)
|
||||
for (unsigned int i = 0; i < charPoints.size(); i++)
|
||||
{
|
||||
Mat mask = Mat::zeros(Size(contours.width, contours.height), CV_8U);
|
||||
fillConvexPoly(mask, bestLine.data(), bestLine.size(), Scalar(255,255,255));
|
||||
@@ -103,7 +103,7 @@ namespace alpr
|
||||
|
||||
|
||||
vector<int> charheights;
|
||||
for (uint i = 0; i < charPoints.size(); i++)
|
||||
for (unsigned int i = 0; i < charPoints.size(); i++)
|
||||
charheights.push_back(charPoints[i].boundingBox.height);
|
||||
float medianCharHeight = median(charheights.data(), charheights.size());
|
||||
|
||||
@@ -112,9 +112,9 @@ namespace alpr
|
||||
vector<LineSegment> topLines;
|
||||
vector<LineSegment> bottomLines;
|
||||
// Iterate through each possible char and find all possible lines for the top and bottom of each char segment
|
||||
for (uint i = 0; i < charPoints.size() - 1; i++)
|
||||
for (unsigned int i = 0; i < charPoints.size() - 1; i++)
|
||||
{
|
||||
for (uint k = i+1; k < charPoints.size(); k++)
|
||||
for (unsigned int k = i+1; k < charPoints.size(); k++)
|
||||
{
|
||||
|
||||
int leftCPIndex, rightCPIndex;
|
||||
@@ -168,13 +168,13 @@ namespace alpr
|
||||
int bestScoreDistance = -1; // Line segment distance is used as a tie breaker
|
||||
|
||||
// Now, among all possible lines, find the one that is the best fit
|
||||
for (uint i = 0; i < topLines.size(); i++)
|
||||
for (unsigned int i = 0; i < topLines.size(); i++)
|
||||
{
|
||||
float SCORING_MIN_THRESHOLD = 0.97;
|
||||
float SCORING_MAX_THRESHOLD = 1.03;
|
||||
|
||||
int curScore = 0;
|
||||
for (uint charidx = 0; charidx < charPoints.size(); charidx++)
|
||||
for (unsigned int charidx = 0; charidx < charPoints.size(); charidx++)
|
||||
{
|
||||
float topYPos = topLines[i].getPointAt(charPoints[charidx].top.x);
|
||||
float botYPos = bottomLines[i].getPointAt(charPoints[charidx].bottom.x);
|
||||
|
@@ -51,14 +51,14 @@ namespace alpr
|
||||
if (pipeline_data->config->debugCharAnalysis)
|
||||
cout << "CharacterAnalysis::findOuterBoxMask" << endl;
|
||||
|
||||
for (uint imgIndex = 0; imgIndex < contours.size(); imgIndex++)
|
||||
for (unsigned int imgIndex = 0; imgIndex < contours.size(); imgIndex++)
|
||||
{
|
||||
//vector<bool> charContours = filter(thresholds[imgIndex], allContours[imgIndex], allHierarchy[imgIndex]);
|
||||
|
||||
int charsRecognized = 0;
|
||||
int parentId = -1;
|
||||
bool hasParent = false;
|
||||
for (uint i = 0; i < contours[imgIndex].goodIndices.size(); i++)
|
||||
for (unsigned int i = 0; i < contours[imgIndex].goodIndices.size(); i++)
|
||||
{
|
||||
if (contours[imgIndex].goodIndices[i]) charsRecognized++;
|
||||
if (contours[imgIndex].goodIndices[i] && contours[imgIndex].hierarchy[i][3] != -1)
|
||||
@@ -97,9 +97,9 @@ namespace alpr
|
||||
int longestChildIndex = -1;
|
||||
double longestChildLength = 0;
|
||||
// Find the child with the longest permiter/arc length ( just for kicks)
|
||||
for (uint i = 0; i < contours[winningIndex].size(); i++)
|
||||
for (unsigned int i = 0; i < contours[winningIndex].size(); i++)
|
||||
{
|
||||
for (uint j = 0; j < contours[winningIndex].size(); j++)
|
||||
for (unsigned int j = 0; j < contours[winningIndex].size(); j++)
|
||||
{
|
||||
if (contours[winningIndex].hierarchy[j][3] == winningParentId)
|
||||
{
|
||||
@@ -145,7 +145,7 @@ namespace alpr
|
||||
findContours(mask, contoursSecondRound, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_SIMPLE);
|
||||
int biggestContourIndex = -1;
|
||||
double largestArea = 0;
|
||||
for (uint c = 0; c < contoursSecondRound.size(); c++)
|
||||
for (unsigned int c = 0; c < contoursSecondRound.size(); c++)
|
||||
{
|
||||
double area = contourArea(contoursSecondRound[c]);
|
||||
if (area > largestArea)
|
||||
|
@@ -50,7 +50,7 @@ namespace alpr
|
||||
CV_RETR_TREE, // retrieve all contours
|
||||
CV_CHAIN_APPROX_SIMPLE ); // all pixels of each contours
|
||||
|
||||
for (uint i = 0; i < contours.size(); i++)
|
||||
for (unsigned int i = 0; i < contours.size(); i++)
|
||||
goodIndices.push_back(true);
|
||||
|
||||
this->width = threshold.cols;
|
||||
@@ -58,7 +58,7 @@ namespace alpr
|
||||
}
|
||||
|
||||
|
||||
uint TextContours::size() {
|
||||
unsigned int TextContours::size() {
|
||||
return contours.size();
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace alpr
|
||||
int TextContours::getGoodIndicesCount()
|
||||
{
|
||||
int count = 0;
|
||||
for (uint i = 0; i < goodIndices.size(); i++)
|
||||
for (unsigned int i = 0; i < goodIndices.size(); i++)
|
||||
{
|
||||
if (goodIndices[i])
|
||||
count++;
|
||||
@@ -80,7 +80,7 @@ namespace alpr
|
||||
std::vector<bool> TextContours::getIndicesCopy()
|
||||
{
|
||||
vector<bool> copyArray;
|
||||
for (uint i = 0; i < goodIndices.size(); i++)
|
||||
for (unsigned int i = 0; i < goodIndices.size(); i++)
|
||||
{
|
||||
bool val = goodIndices[i];
|
||||
copyArray.push_back(goodIndices[i]);
|
||||
@@ -93,7 +93,7 @@ namespace alpr
|
||||
{
|
||||
if (newIndices.size() == goodIndices.size())
|
||||
{
|
||||
for (uint i = 0; i < newIndices.size(); i++)
|
||||
for (unsigned int i = 0; i < newIndices.size(); i++)
|
||||
goodIndices[i] = newIndices[i];
|
||||
}
|
||||
else
|
||||
@@ -116,7 +116,7 @@ namespace alpr
|
||||
cvtColor(img_contours, img_contours, CV_GRAY2RGB);
|
||||
|
||||
vector<vector<Point> > allowedContours;
|
||||
for (uint i = 0; i < this->contours.size(); i++)
|
||||
for (unsigned int i = 0; i < this->contours.size(); i++)
|
||||
{
|
||||
if (this->goodIndices[i])
|
||||
allowedContours.push_back(this->contours[i]);
|
||||
|
@@ -41,7 +41,7 @@ namespace alpr
|
||||
std::vector<std::vector<cv::Point> > contours;
|
||||
std::vector<cv::Vec4i> hierarchy;
|
||||
|
||||
uint size();
|
||||
unsigned int size();
|
||||
int getGoodIndicesCount();
|
||||
|
||||
std::vector<bool> getIndicesCopy();
|
||||
|
@@ -30,9 +30,9 @@ namespace alpr
|
||||
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++)
|
||||
for (unsigned int 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++)
|
||||
for (unsigned int i = 0; i < linePolygon.size(); i++)
|
||||
linePolygonInts.push_back(Point(round(linePolygon[i].x), round(linePolygon[i].y)));
|
||||
|
||||
initialize(textAreaInts, linePolygonInts);
|
||||
@@ -56,10 +56,10 @@ namespace alpr
|
||||
if (this->linePolygon.size() > 0)
|
||||
this->linePolygon.clear();
|
||||
|
||||
for (uint i = 0; i < textArea.size(); i++)
|
||||
for (unsigned int i = 0; i < textArea.size(); i++)
|
||||
this->textArea.push_back(textArea[i]);
|
||||
|
||||
for (uint i = 0; i < linePolygon.size(); i++)
|
||||
for (unsigned int i = 0; i < linePolygon.size(); i++)
|
||||
this->linePolygon.push_back(linePolygon[i]);
|
||||
|
||||
this->topLine = LineSegment(linePolygon[0].x, linePolygon[0].y, linePolygon[1].x, linePolygon[1].y);
|
||||
|
@@ -50,7 +50,7 @@ namespace alpr
|
||||
vector<Point2f> Transformation::transformSmallPointsToBigImage(vector<Point2f> points)
|
||||
{
|
||||
vector<Point2f> bigPoints;
|
||||
for (uint i = 0; i < points.size(); i++)
|
||||
for (unsigned int i = 0; i < points.size(); i++)
|
||||
{
|
||||
float bigX = (points[i].x * ((float) regionInBigImage.width / smallImage.cols));
|
||||
float bigY = (points[i].y * ((float) regionInBigImage.height / smallImage.rows));
|
||||
|
@@ -50,13 +50,13 @@ namespace alpr
|
||||
return expandedRegion;
|
||||
}
|
||||
|
||||
Mat drawImageDashboard(vector<Mat> images, int imageType, uint numColumns)
|
||||
Mat drawImageDashboard(vector<Mat> images, int imageType, unsigned int numColumns)
|
||||
{
|
||||
uint numRows = ceil((float) images.size() / (float) numColumns);
|
||||
unsigned int numRows = ceil((float) images.size() / (float) numColumns);
|
||||
|
||||
Mat dashboard(Size(images[0].cols * numColumns, images[0].rows * numRows), imageType);
|
||||
|
||||
for (uint i = 0; i < numColumns * numRows; i++)
|
||||
for (unsigned int i = 0; i < numColumns * numRows; i++)
|
||||
{
|
||||
if (i < images.size())
|
||||
images[i].copyTo(dashboard(Rect((i%numColumns) * images[i].cols, floor((float) i/numColumns) * images[i].rows, images[i].cols, images[i].rows)));
|
||||
@@ -421,7 +421,7 @@ namespace alpr
|
||||
ss << value;
|
||||
return ss.str();
|
||||
}
|
||||
std::string toString(uint value)
|
||||
std::string toString(unsigned int value)
|
||||
{
|
||||
return toString((int) value);
|
||||
}
|
||||
|
@@ -77,7 +77,7 @@ namespace alpr
|
||||
|
||||
std::vector<cv::Mat> produceThresholds(const cv::Mat img_gray, Config* config);
|
||||
|
||||
cv::Mat drawImageDashboard(std::vector<cv::Mat> images, int imageType, uint numColumns);
|
||||
cv::Mat drawImageDashboard(std::vector<cv::Mat> images, int imageType, unsigned int numColumns);
|
||||
|
||||
void displayImage(Config* config, std::string windowName, cv::Mat frame);
|
||||
void drawAndWait(cv::Mat* frame);
|
||||
@@ -103,7 +103,7 @@ namespace alpr
|
||||
|
||||
|
||||
std::string toString(int value);
|
||||
std::string toString(uint value);
|
||||
std::string toString(unsigned int value);
|
||||
std::string toString(float value);
|
||||
std::string toString(double value);
|
||||
|
||||
|
Reference in New Issue
Block a user