From cc3b0d9d7c043ad64f191efc67084f442e9f20a9 Mon Sep 17 00:00:00 2001 From: yuxue Date: Sun, 10 May 2020 21:21:00 +0800 Subject: [PATCH] no commit message --- src/main/java/com/yuxue/easypr/core/CoreFunc.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/yuxue/easypr/core/CoreFunc.java b/src/main/java/com/yuxue/easypr/core/CoreFunc.java index 354b5f94..2902a346 100644 --- a/src/main/java/com/yuxue/easypr/core/CoreFunc.java +++ b/src/main/java/com/yuxue/easypr/core/CoreFunc.java @@ -48,6 +48,8 @@ public class CoreFunc { final float minref_sv = 64; final float minabs_sv = 95; + + //opencv颜色识别的HSV中各个颜色所对应的H的范围: Orange 0-22 Yellow 22- 38 Green 38-75 Blue 75-130 // blue的H范围 final int min_blue = 100; final int max_blue = 140; @@ -55,7 +57,11 @@ public class CoreFunc { // yellow的H范围 final int min_yellow = 15; final int max_yellow = 40; - + + // green的H范围 + final int min_green = 38; + final int max_green = 75; + // 转到HSV空间进行处理,颜色搜索主要使用的是H分量进行蓝色与黄色的匹配工作 Mat src_hsv = new Mat(); cvtColor(src, src_hsv, CV_BGR2HSV); @@ -76,6 +82,10 @@ public class CoreFunc { min_h = min_yellow; max_h = max_yellow; break; + case GREEN: + min_h = min_green; + max_h = max_green; + break; default: break; } @@ -185,6 +195,8 @@ public class CoreFunc { return PlateColor.BLUE; } else if (plateColorJudge(src, PlateColor.YELLOW, adaptive_minsv) == true) { return PlateColor.YELLOW; + } else if (plateColorJudge(src, PlateColor.GREEN, adaptive_minsv) == true) { + return PlateColor.GREEN; } else { return PlateColor.UNKNOWN; }