diff --git a/src/openalpr/segmentation/charactersegmenter.cpp b/src/openalpr/segmentation/charactersegmenter.cpp index 4797ef6..1b83628 100644 --- a/src/openalpr/segmentation/charactersegmenter.cpp +++ b/src/openalpr/segmentation/charactersegmenter.cpp @@ -957,69 +957,6 @@ void CharacterSegmenter::filterEdgeBoxes(vector thresholds, const vector > contours; - Mat mask = Mat::zeros(thresholds[i].size(),CV_8U); - rectangle(mask, charRegions[boxidx], Scalar(255,255,255), CV_FILLED); - - bitwise_and(thresholds[i], mask, mask); - findContours(mask, contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_SIMPLE); - //int tallContourIndex = isSkinnyLineInsideBox(thresholds[i], charRegions[boxidx], allContours[i], hierarchy[i], avgCharWidth, avgCharHeight); - float tallestContourHeight = 0; - float fattestContourWidth = 0; - float biggestContourArea = 0; - for (int c = 0; c < contours.size(); c++) - { - Rect r = boundingRect(contours[c]); - if (r.height > tallestContourHeight) - tallestContourHeight = r.height; - if (r.width > fattestContourWidth) - fattestContourWidth = r.width; - float a = r.area(); - if (a > biggestContourArea) - biggestContourArea = a; - } - - float minArea = charRegions[boxidx].area() * MIN_EDGE_CONTOUR_AREA_PCT; - if ((fattestContourWidth < MIN_BOX_WIDTH_PX) || - (tallestContourHeight < MIN_EDGE_CONTOUR_HEIGHT) || - (biggestContourArea < minArea) - ) - { - // Find a good place to MASK this contour. - // for now, just mask the whole thing - if (this->debug) - { - rectangle(imgDbgCleanStages[i], charRegions[boxidx], COLOR_DEBUG_EDGE, 2); - cout << "Edge Filter: threshold " << i << " box " << boxidx << endl; - } - rectangle(thresholds[i], charRegions[boxidx], Scalar(0,0,0), -1); - } - else - { - filteredCharRegions.push_back(charRegions[boxidx]); - } - } - } - */ } int CharacterSegmenter::getLongestBlobLengthBetweenLines(Mat img, int col) diff --git a/src/openalpr/segmentation/charactersegmenter.h b/src/openalpr/segmentation/charactersegmenter.h index 31dc53b..319dced 100644 --- a/src/openalpr/segmentation/charactersegmenter.h +++ b/src/openalpr/segmentation/charactersegmenter.h @@ -63,20 +63,10 @@ class CharacterSegmenter std::vector imgDbgGeneral; std::vector imgDbgCleanStages; - std::vector filter(cv::Mat img, std::vector > contours, std::vector hierarchy); - std::vector filterByBoxSize(std::vector< std::vector > contours, std::vector goodIndices, float minHeightPx, float maxHeightPx); - std::vector filterBetweenLines(cv::Mat img, std::vector > contours, std::vector hierarchy, std::vector outerPolygon, std::vector goodIndices); - std::vector filterContourHoles(std::vector > contours, std::vector hierarchy, std::vector goodIndices); - - std::vector getBestVotedLines(cv::Mat img, std::vector > contours, std::vector goodIndices); - int getGoodIndicesCount(std::vector goodIndices); - - cv::Mat getCharacterMask(cv::Mat img_threshold, std::vector > contours, std::vector hierarchy, std::vector goodIndices); cv::Mat getCharBoxMask(cv::Mat img_threshold, std::vector charBoxes); void removeSmallContours(std::vector thresholds, std::vector contours, float avgCharWidth, float avgCharHeight); - cv::Mat getVerticalHistogram(cv::Mat img, cv::Mat mask); std::vector getHistogramBoxes(VerticalHistogram histogram, float avgCharWidth, float avgCharHeight, float* score); std::vector getBestCharBoxes(cv::Mat img, std::vector charBoxes, float avgCharWidth); std::vector combineCloseBoxes( std::vector charBoxes, float avgCharWidth); @@ -93,7 +83,6 @@ class CharacterSegmenter int isSkinnyLineInsideBox(cv::Mat threshold, cv::Rect box, std::vector > contours, std::vector hierarchy, float avgCharWidth, float avgCharHeight); - std::vector getEncapsulatingLines(cv::Mat img, std::vector > contours, std::vector goodIndices); }; #endif // OPENALPR_CHARACTERSEGMENTER_H