EasyPR中主要涉及到蓝色底牌与黄色底牌、白色底牌的车牌识别,随着新能源车辆的发展,目前有很多绿色底牌的车牌,因此增加绿色车牌的识别。
EasyPR中关于车牌的识别,已经比较完善,这里主要涉及到三个地方的修改。
1.添加颜色
include/easypr/config.h
在自定义Color的枚举类中,添加 绿色,修改之后为:
enum Color { BLUE, YELLOW, WHITE, GREEN, UNKNOWN };
添加绿色识别
在OpenCV或其他软件中,识别颜色主要通过RGB映射到HSV空间,通过判断H、S、V的相关值来判断颜色的,主要原理可以参考:OpenCV颜色识别。修改之后的部分代码如下:
src/core/core_func.cpp
Mat colorMatch(const Mat &src, Mat &match, const Color r,
const bool adaptive_minsv) {
// if use adaptive_minsv
// min value of s and v is adaptive to h
const float max_sv = 255;
const float minref_sv = 64;
const float minabs_sv = 95; //95;
// H range of blue
const int min_blue = 100; // 100
const int max_blue = 140; // 140
// H range of yellow
const int