// getPlateType //判断车牌的类型 Color getPlateType(const Mat &src, const bool adaptive_minsv) { float max_percent = 0; Color max_color = UNKNOWN; float blue_percent = 0; float yellow_percent = 0; float white_percent = 0; if (plateColorJudge(src, BLUE, adaptive_minsv, blue_percent) == true) { // cout << "BLUE" << endl; return BLUE; } else if (plateColorJudge(src, YELLOW, adaptive_minsv, yellow_percent) == true) { // cout << "YELLOW" << endl; return YELLOW; } else if (plateColorJudge(src, WHITE, adaptive_minsv, white_percent) == true) { // cout << "WHITE" << endl; return WHITE; } else { // cout << "OTHER" << endl; // 如果任意一者都不大于阈值,则取值最大者 max_percent = blue_percent > yellow_percent ? blue_percent : yellow_percent; max_color = blue_percent > yellow_percent ? BLUE : YELLOW; max_color = max_percent > white_percent ? max_color : WHITE; return max_color; } }
//getPlateType //判断车牌的类型 Color getPlateType(const Mat& src, const bool adaptive_minsv) { if (plateColorJudge(src, BLUE, adaptive_minsv) == true) { //cout << "BLUE" << endl; return BLUE; } else if (plateColorJudge(src, YELLOW, adaptive_minsv) == true) { //cout << "YELLOW" << endl; return YELLOW; } else { //cout << "OTHER" << endl; return BLUE; } }