mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-06 11:26:56 +08:00
Commented out some debug code that caused crashing with variable sized histograms
This commit is contained in:
@@ -96,29 +96,31 @@ namespace alpr
|
||||
|
||||
HistogramVertical vertHistogram(pipeline_data->thresholds[i], histogramMask);
|
||||
|
||||
if (this->config->debugCharSegmenter)
|
||||
{
|
||||
Mat histoCopy(vertHistogram.histoImg.size(), vertHistogram.histoImg.type());
|
||||
//vertHistogram.copyTo(histoCopy);
|
||||
cvtColor(vertHistogram.histoImg, histoCopy, CV_GRAY2RGB);
|
||||
|
||||
string label = "threshold: " + toString(i);
|
||||
allHistograms.push_back(addLabel(histoCopy, label));
|
||||
}
|
||||
// if (this->config->debugCharSegmenter)
|
||||
// {
|
||||
// Mat histoCopy(vertHistogram.histoImg.size(), vertHistogram.histoImg.type());
|
||||
// //vertHistogram.copyTo(histoCopy);
|
||||
// cvtColor(vertHistogram.histoImg, histoCopy, CV_GRAY2RGB);
|
||||
//
|
||||
// string label = "threshold: " + toString(i);
|
||||
// allHistograms.push_back(addLabel(histoCopy, label));
|
||||
//
|
||||
// std::cout << histoCopy.cols << " x " << histoCopy.rows << std::endl;
|
||||
// }
|
||||
|
||||
float score = 0;
|
||||
vector<Rect> charBoxes = getHistogramBoxes(vertHistogram, avgCharWidth, avgCharHeight, &score);
|
||||
|
||||
if (this->config->debugCharSegmenter)
|
||||
{
|
||||
for (unsigned int cboxIdx = 0; cboxIdx < charBoxes.size(); cboxIdx++)
|
||||
{
|
||||
rectangle(allHistograms[i], charBoxes[cboxIdx], Scalar(0, 255, 0));
|
||||
}
|
||||
|
||||
Mat histDashboard = drawImageDashboard(allHistograms, allHistograms[0].type(), 1);
|
||||
displayImage(config, "Char seg histograms", histDashboard);
|
||||
}
|
||||
// if (this->config->debugCharSegmenter)
|
||||
// {
|
||||
// for (unsigned int cboxIdx = 0; cboxIdx < charBoxes.size(); cboxIdx++)
|
||||
// {
|
||||
// rectangle(allHistograms[i], charBoxes[cboxIdx], Scalar(0, 255, 0));
|
||||
// }
|
||||
//
|
||||
// Mat histDashboard = drawImageDashboard(allHistograms, allHistograms[0].type(), 1);
|
||||
// displayImage(config, "Char seg histograms", histDashboard);
|
||||
// }
|
||||
|
||||
for (unsigned int z = 0; z < charBoxes.size(); 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;
|
||||
for (unsigned int lidx = 0; lidx < pipeline_data->charRegions.size(); lidx++)
|
||||
{
|
||||
|
Reference in New Issue
Block a user