no commit message

devA
yuxue 5 years ago
parent 04b6396d65
commit bb3df46522

@ -8,8 +8,8 @@ package com.yuxue.enumtype;
*/ */
public enum PlateColor { public enum PlateColor {
BLUE("BLUE","蓝牌", 100, 140), BLUE("BLUE","蓝牌", 100, 130),
GREEN("GREEN","绿牌", 8, 150), GREEN("GREEN","绿牌", 38, 100),
YELLOW("YELLOW","黄牌", 15, 40), YELLOW("YELLOW","黄牌", 15, 40),
UNKNOWN("UNKNOWN","未知", 0, 0); UNKNOWN("UNKNOWN","未知", 0, 0);

@ -71,7 +71,7 @@ public class ImageUtil {
Instant start = Instant.now(); Instant start = Instant.now();
String tempPath = DEFAULT_BASE_TEST_PATH + "test/"; String tempPath = DEFAULT_BASE_TEST_PATH + "test/";
String filename = tempPath + "/100_yuantu.jpg"; String filename = tempPath + "/100_yuantu.jpg";
filename = tempPath + "/100_yuantu1.jpg"; filename = tempPath + "/100_yuantu2.jpg";
// filename = tempPath + "/109_crop_0.png"; // filename = tempPath + "/109_crop_0.png";
Mat src = Imgcodecs.imread(filename); Mat src = Imgcodecs.imread(filename);

@ -140,16 +140,15 @@ public class PlateUtil {
*/ */
public static PlateColor getPlateColor(Mat inMat, Boolean adaptive_minsv, Boolean debug, String tempPath) { public static PlateColor getPlateColor(Mat inMat, Boolean adaptive_minsv, Boolean debug, String tempPath) {
// 判断阈值 // 判断阈值
final float thresh = 0.49f; final float thresh = 0.70f;
if(colorMatch(inMat, PlateColor.GREEN, adaptive_minsv, debug, tempPath) > thresh) {
if(colorMatch(inMat, PlateColor.BLUE, adaptive_minsv, debug, tempPath) > thresh) { return PlateColor.GREEN;
return PlateColor.BLUE;
} }
if(colorMatch(inMat, PlateColor.YELLOW, adaptive_minsv, debug, tempPath) > thresh) { if(colorMatch(inMat, PlateColor.YELLOW, adaptive_minsv, debug, tempPath) > thresh) {
return PlateColor.YELLOW; return PlateColor.YELLOW;
} }
if(colorMatch(inMat, PlateColor.GREEN, adaptive_minsv, debug, tempPath) > thresh) { if(colorMatch(inMat, PlateColor.BLUE, adaptive_minsv, debug, tempPath) > thresh) {
return PlateColor.GREEN; return PlateColor.BLUE;
} }
return PlateColor.UNKNOWN; return PlateColor.UNKNOWN;
} }
@ -275,10 +274,10 @@ public class PlateUtil {
Vector<Rect> rt = new Vector<Rect>(); Vector<Rect> rt = new Vector<Rect>();
for (int i = 0; i < contours.size(); i++) { for (int i = 0; i < contours.size(); i++) {
Rect mr = Imgproc.boundingRect(contours.get(i)); Rect mr = Imgproc.boundingRect(contours.get(i));
if(debug) { /*if(debug) {
Mat mat = new Mat(threshold, rt.get(i)); Mat mat = new Mat(threshold, mr);
Imgcodecs.imwrite(tempPath + debugMap.get("plateRect") + "_plateRect_" + i + ".jpg", mat); Imgcodecs.imwrite(tempPath + debugMap.get("plateRect") + "_plateRect_" + i + ".jpg", mat);
} }*/
if (checkCharSizes(mr)) { if (checkCharSizes(mr)) {
rt.add(mr); rt.add(mr);
} }

Loading…
Cancel
Save