以下是需要修改的文件链接:https://github.com/MicrocontrollersAndMore/OpenCV_3_License_Plate_Recognition_Cpp/blob/master/DetectChars.cpp
bool checkIfPossibleChar(PossibleChar &possibleChar) {
// this function is a 'first pass' that does a rough check on a contour to see if it could be a char,
// note that we are not (yet) comparing the char to other chars to look for a group
if (possibleChar.boundingRect.area() > MIN_PIXEL_AREA &&
possibleChar.boundingRect.width > MIN_PIXEL_WIDTH && possibleChar.boundingRect.height > MIN_PIXEL_HEIGHT &&
MIN_ASPECT_RATIO < possibleChar.dblAspectRatio && possibleChar.dblAspectRatio < MAX_ASPECT_RATIO) {
return(true);
} else {
return(false);
}}
AND
double dblDistanceBetweenChars = distanceBetweenChars(possibleChar, possibleMatchingChar);
double dblAngleBetweenChars = angleBetweenChars(possibleChar, possibleMatchingChar);
double dblChangeInArea = (double)abs(possibleMatchingChar.boundingRect.area() - possibleChar.boundingRect.area()) / (double)possibleChar.boundingRect.area();
double dblChangeInWidth = (double)abs(possibleMatchingChar.boundingRect.width - possibleChar.boundingRect.width) / (double)possibleChar.boundingRect.width;
double dblChangeInHeight = (double)abs(possibleMatchingChar.boundingRect.height - possibleChar.boundingRect.height) / (double)possibleChar.boundingRect.height;
// check if chars match
if (dblDistanceBetweenChars < (possibleChar.dblDiagonalSize * MAX_DIAG_SIZE_MULTIPLE_AWAY) &&
dblAngleBetweenChars < MAX_ANGLE_BETWEEN_CHARS &&
dblChangeInArea < MAX_CHANGE_IN_AREA &&
dblChangeInWidth < MAX_CHANGE_IN_WIDTH &&
dblChangeInHeight < MAX_CHANGE_IN_HEIGHT) {
vectorOfMatchingChars.push_back(possibleMatchingChar); // if the chars are a match, add the current char to vector of matching chars
}
非常感谢您的提前帮助。