diff --git a/src/main/java/org/wlld/imageRecognition/segmentation/Watershed.java b/src/main/java/org/wlld/imageRecognition/segmentation/Watershed.java index f906edc..4dbabdc 100644 --- a/src/main/java/org/wlld/imageRecognition/segmentation/Watershed.java +++ b/src/main/java/org/wlld/imageRecognition/segmentation/Watershed.java @@ -216,12 +216,11 @@ public class Watershed { for (Specifications specification : specifications) { int width = maxY - minY; int height = maxX - minX; - double h = this.height / 8; - double w = this.width / 8; - boolean isCenter = true;// minX > h && minY > w && minX < (h * 4.5) && minY < (w * 4.5); +// double h = this.height / 8; +// double w = this.width / 8; + // boolean isCenter = minX > h && minY > w && minX < (h * 4.5) && minY < (w * 4.5); if (width >= specification.getMinWidth() && height >= specification.getMinHeight() - && width <= specification.getMaxWidth() && height <= specification.getMaxHeight() - && isCenter) { + && width <= specification.getMaxWidth() && height <= specification.getMaxHeight()) { isRight = true; break; } diff --git a/src/test/java/coverTest/FoodTest.java b/src/test/java/coverTest/FoodTest.java index 0113ea5..7d8fdab 100644 --- a/src/test/java/coverTest/FoodTest.java +++ b/src/test/java/coverTest/FoodTest.java @@ -21,13 +21,13 @@ import java.util.List; public class FoodTest { public static void main(String[] args) throws Exception { - ModelParameter parameter = JSON.parseObject(ModelData.DATA, ModelParameter.class); - if (parameter.getKnnVector() != null) { - System.out.println("空的"); - } else { - System.out.println("不是空==="); - } - //test(); +// ModelParameter parameter = JSON.parseObject(ModelData.DATA, ModelParameter.class); +// if (parameter.getKnnVector() != null) { +// System.out.println("空的"); +// } else { +// System.out.println("不是空==="); +// } + test(); } public static void one(double[] test, double[] right, double[] wrong) { @@ -112,12 +112,22 @@ public class FoodTest { for (int i = 1; i <= 1; i++) { ThreeChannelMatrix threeChannelMatrix1 = picture.getThreeMatrix("/Users/lidapeng/Documents/paramterTest/a" + i + ".jpg"); ThreeChannelMatrix threeChannelMatrix2 = picture.getThreeMatrix("/Users/lidapeng/Documents/paramterTest/b" + i + ".jpg"); - operation.colorStudy(threeChannelMatrix1, 1, specificationsList); + operation.colorStudy(threeChannelMatrix1, 83, specificationsList); System.out.println("======================================="); - operation.colorStudy(threeChannelMatrix2, 2, specificationsList); + operation.colorStudy(threeChannelMatrix2, 86, specificationsList); System.out.println("=======================================" + i); } - test2(templeConfig); + ModelParameter modelParameter = templeConfig.getModel(); + if (modelParameter.getKnnVector() != null) { + System.out.println("not null 1"); + } + String tr = JSON.toJSONString(modelParameter); + System.out.println(tr); + ModelParameter modelParameter1 = JSON.parseObject(tr, ModelParameter.class); + if (modelParameter1.getKnnVector() != null) { + System.out.println("not null 2"); + } + //test2(templeConfig); } public static void study() throws Exception {