diff --git a/src/main/java/com/yuxue/easypr/core/CharsSegment.java b/src/main/java/com/yuxue/easypr/core/CharsSegment.java index 340e8f0..887b33f 100644 --- a/src/main/java/com/yuxue/easypr/core/CharsSegment.java +++ b/src/main/java/com/yuxue/easypr/core/CharsSegment.java @@ -98,7 +98,15 @@ public class CharsSegment { case GREEN: threshold(input_grey, img_threshold, 10, 255, CV_THRESH_OTSU + CV_THRESH_BINARY_INV); break; - + + case WHITE: + threshold(input_grey, img_threshold, 10, 255, CV_THRESH_OTSU + CV_THRESH_BINARY); + break; + + case BLACK: + threshold(input_grey, img_threshold, 10, 255, CV_THRESH_OTSU + CV_THRESH_BINARY); + break; + default: return -3; } @@ -141,7 +149,7 @@ public class CharsSegment { } } if (vecRect.size() == 0) { - return -3; + return -3;//没有检测到 } Vector sortedRect = new Vector(); diff --git a/src/main/java/com/yuxue/easypr/core/CoreFunc.java b/src/main/java/com/yuxue/easypr/core/CoreFunc.java index e0f8c22..6a5dcd1 100644 --- a/src/main/java/com/yuxue/easypr/core/CoreFunc.java +++ b/src/main/java/com/yuxue/easypr/core/CoreFunc.java @@ -159,7 +159,11 @@ public class CoreFunc { return PlateColor.YELLOW; } else if (plateColorJudge(src, PlateColor.GREEN, adaptive_minsv) == true) { return PlateColor.GREEN; - } else { + } else if(plateColorJudge(src, PlateColor.WHITE, adaptive_minsv) == true) { + return PlateColor.WHITE; + }else if(plateColorJudge(src, PlateColor.BLACK, adaptive_minsv) == true) { + return PlateColor.BLACK; + }else{ return PlateColor.UNKNOWN; } } diff --git a/src/main/java/com/yuxue/enumtype/PlateColor.java b/src/main/java/com/yuxue/enumtype/PlateColor.java index c305c2c..0df00da 100644 --- a/src/main/java/com/yuxue/enumtype/PlateColor.java +++ b/src/main/java/com/yuxue/enumtype/PlateColor.java @@ -11,6 +11,8 @@ public enum PlateColor { BLUE("BLUE","蓝牌", 100, 130), GREEN("GREEN","绿牌", 38, 100), YELLOW("YELLOW","黄牌", 15, 40), + WHITE("WHITE","白牌",230,255), + BLACK("BLACK","黑牌",0,180), UNKNOWN("UNKNOWN","未知", 0, 0); public final String code; diff --git a/target/classes/yx_image_recognition.db b/target/classes/yx_image_recognition.db index 859428f..be11cfa 100644 Binary files a/target/classes/yx_image_recognition.db and b/target/classes/yx_image_recognition.db differ