From 7b836640283347986b05649516f4aefb51aacc3d Mon Sep 17 00:00:00 2001 From: thenk008 <794757862@qq.com> Date: Thu, 21 May 2020 16:30:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0VAVG=20=E7=A7=BB=E9=99=A4?= =?UTF-8?q?=E5=88=86=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/wlld/imageRecognition/TempleConfig.java | 9 +++++++++ src/main/java/org/wlld/imageRecognition/VectorK.java | 4 ++++ src/test/java/coverTest/FoodTest.java | 7 +++---- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/wlld/imageRecognition/TempleConfig.java b/src/main/java/org/wlld/imageRecognition/TempleConfig.java index 217bdfc..59fabc6 100644 --- a/src/main/java/org/wlld/imageRecognition/TempleConfig.java +++ b/src/main/java/org/wlld/imageRecognition/TempleConfig.java @@ -66,6 +66,15 @@ public class TempleConfig { private int featureNub = 4;//聚类特征数量 private Knn knn;//KNN分类器 private int knnNub = 3;//KNN投票人数 + private Matrix backGround;//背景 + + public Matrix getBackGround() { + return backGround; + } + + public void setBackGround(Matrix backGround) { + this.backGround = backGround; + } public Knn getKnn() { return knn; diff --git a/src/main/java/org/wlld/imageRecognition/VectorK.java b/src/main/java/org/wlld/imageRecognition/VectorK.java index de6ee75..140720b 100644 --- a/src/main/java/org/wlld/imageRecognition/VectorK.java +++ b/src/main/java/org/wlld/imageRecognition/VectorK.java @@ -19,6 +19,10 @@ public class VectorK { return matrixK; } + public void removeType(int typeId) { + matrixK.remove(typeId); + } + public void insertMatrix(int type, Matrix matrix) throws Exception { if (matrix.isRowVector() && matrix.getY() == length) { if (matrixMap.containsKey(type)) { diff --git a/src/test/java/coverTest/FoodTest.java b/src/test/java/coverTest/FoodTest.java index 03cdc98..4f50b47 100644 --- a/src/test/java/coverTest/FoodTest.java +++ b/src/test/java/coverTest/FoodTest.java @@ -43,13 +43,12 @@ public class FoodTest { public static void test() throws Exception { TempleConfig templeConfig = new TempleConfig(); Picture picture = new Picture(); - templeConfig.isShowLog(true); - templeConfig.setMaxRain(320); + templeConfig.isShowLog(true);//是否打印日志 + templeConfig.setMaxRain(320);//切割阈值 templeConfig.setFeatureNub(3); templeConfig.sethTh(0.88); templeConfig.setPoolSize(2); - templeConfig.setSensoryNerveNub(3); - templeConfig.setStudyPoint(0.01); + //templeConfig.setRegionNub(100); templeConfig.setClassifier(Classifier.VAvg); templeConfig.init(StudyPattern.Cover_Pattern, true, 400, 400, 3); Operation operation = new Operation(templeConfig);