no commit message

devA
yuxue 5 years ago
parent 04b6396d65
commit bb3df46522

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

@ -71,7 +71,7 @@ public class ImageUtil {
Instant start = Instant.now();
String tempPath = DEFAULT_BASE_TEST_PATH + "test/";
String filename = tempPath + "/100_yuantu.jpg";
filename = tempPath + "/100_yuantu1.jpg";
filename = tempPath + "/100_yuantu2.jpg";
// filename = tempPath + "/109_crop_0.png";
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) {
// 判断阈值
final float thresh = 0.49f;
if(colorMatch(inMat, PlateColor.BLUE, adaptive_minsv, debug, tempPath) > thresh) {
return PlateColor.BLUE;
final float thresh = 0.70f;
if(colorMatch(inMat, PlateColor.GREEN, adaptive_minsv, debug, tempPath) > thresh) {
return PlateColor.GREEN;
}
if(colorMatch(inMat, PlateColor.YELLOW, adaptive_minsv, debug, tempPath) > thresh) {
return PlateColor.YELLOW;
}
if(colorMatch(inMat, PlateColor.GREEN, adaptive_minsv, debug, tempPath) > thresh) {
return PlateColor.GREEN;
if(colorMatch(inMat, PlateColor.BLUE, adaptive_minsv, debug, tempPath) > thresh) {
return PlateColor.BLUE;
}
return PlateColor.UNKNOWN;
}
@ -275,10 +274,10 @@ public class PlateUtil {
Vector<Rect> rt = new Vector<Rect>();
for (int i = 0; i < contours.size(); i++) {
Rect mr = Imgproc.boundingRect(contours.get(i));
if(debug) {
Mat mat = new Mat(threshold, rt.get(i));
/*if(debug) {
Mat mat = new Mat(threshold, mr);
Imgcodecs.imwrite(tempPath + debugMap.get("plateRect") + "_plateRect_" + i + ".jpg", mat);
}
}*/
if (checkCharSizes(mr)) {
rt.add(mr);
}

Loading…
Cancel
Save