Commented out some debug code that caused crashing with variable sized histograms

This commit is contained in:
Matt Hill
2015-09-27 18:30:33 -04:00
parent 3c4000de64
commit d5958e66f7

View File

@@ -96,29 +96,31 @@ namespace alpr
HistogramVertical vertHistogram(pipeline_data->thresholds[i], histogramMask); HistogramVertical vertHistogram(pipeline_data->thresholds[i], histogramMask);
if (this->config->debugCharSegmenter) // if (this->config->debugCharSegmenter)
{ // {
Mat histoCopy(vertHistogram.histoImg.size(), vertHistogram.histoImg.type()); // Mat histoCopy(vertHistogram.histoImg.size(), vertHistogram.histoImg.type());
//vertHistogram.copyTo(histoCopy); // //vertHistogram.copyTo(histoCopy);
cvtColor(vertHistogram.histoImg, histoCopy, CV_GRAY2RGB); // cvtColor(vertHistogram.histoImg, histoCopy, CV_GRAY2RGB);
//
string label = "threshold: " + toString(i); // string label = "threshold: " + toString(i);
allHistograms.push_back(addLabel(histoCopy, label)); // allHistograms.push_back(addLabel(histoCopy, label));
} //
// std::cout << histoCopy.cols << " x " << histoCopy.rows << std::endl;
// }
float score = 0; float score = 0;
vector<Rect> charBoxes = getHistogramBoxes(vertHistogram, avgCharWidth, avgCharHeight, &score); vector<Rect> charBoxes = getHistogramBoxes(vertHistogram, avgCharWidth, avgCharHeight, &score);
if (this->config->debugCharSegmenter) // if (this->config->debugCharSegmenter)
{ // {
for (unsigned int cboxIdx = 0; cboxIdx < charBoxes.size(); cboxIdx++) // for (unsigned int cboxIdx = 0; cboxIdx < charBoxes.size(); cboxIdx++)
{ // {
rectangle(allHistograms[i], charBoxes[cboxIdx], Scalar(0, 255, 0)); // rectangle(allHistograms[i], charBoxes[cboxIdx], Scalar(0, 255, 0));
} // }
//
Mat histDashboard = drawImageDashboard(allHistograms, allHistograms[0].type(), 1); // Mat histDashboard = drawImageDashboard(allHistograms, allHistograms[0].type(), 1);
displayImage(config, "Char seg histograms", histDashboard); // displayImage(config, "Char seg histograms", histDashboard);
} // }
for (unsigned int z = 0; z < charBoxes.size(); z++) for (unsigned int z = 0; z < charBoxes.size(); z++)
lineBoxes.push_back(charBoxes[z]); lineBoxes.push_back(charBoxes[z]);
@@ -185,6 +187,12 @@ namespace alpr
} }
} }
// Apply the edge mask (left and right ends) after all lines have been processed.
for (unsigned int i = 0; i < pipeline_data->thresholds.size(); i++)
{
bitwise_and(pipeline_data->thresholds[i], edge_filter_mask, pipeline_data->thresholds[i]);
}
vector<Rect> all_regions_combined; vector<Rect> all_regions_combined;
for (unsigned int lidx = 0; lidx < pipeline_data->charRegions.size(); lidx++) for (unsigned int lidx = 0; lidx < pipeline_data->charRegions.size(); lidx++)
{ {