Эх сурвалжийг харах

替换itexty依赖 替换虹软linux依赖

车车 2 долоо хоног өмнө
parent
commit
86eebc7c48

+ 8 - 1
ktg-common/pom.xml

@@ -211,10 +211,17 @@
             <version>4.7.0-0</version>
         </dependency>
 
-        <dependency>
+        <!--<dependency>
             <groupId>com.arcsoft.face</groupId>
             <artifactId>arcsoft-sdk-face</artifactId>
             <version>3.0.0.0</version>
+        </dependency>-->
+
+       <!-- linux-->
+        <dependency>
+            <groupId>com.arcsoft.face</groupId>
+            <artifactId>arcsoft-sdk-face</artifactId>
+            <version>4.1.1.0</version>
         </dependency>
 
         <!--<dependency>

+ 24 - 18
ktg-common/src/main/java/com/ktg/common/utils/face/ArcSoftMothodUtil.java

@@ -6,6 +6,7 @@ import com.arcsoft.face.*;
 import com.arcsoft.face.enums.DetectMode;
 import com.arcsoft.face.enums.DetectOrient;
 import com.arcsoft.face.enums.ErrorInfo;
+import com.arcsoft.face.enums.ExtractType;
 import com.arcsoft.face.toolkit.ImageInfo;
 import com.google.common.collect.Lists;
 import com.ktg.common.config.RuoYiConfig;
@@ -44,13 +45,17 @@ public class ArcSoftMothodUtil {
         //从官网获取
         String appId;
         String sdkKey;
+        String activeKey = null;
         String libarcsoftFaceDllPath;
         String prodApi = RuoYiConfig.getProd();
         if (StringUtils.isNotBlank(prodApi)) {
             // 在linux
-            appId = "FTN3G4pk8n2RKwjD955sRapRjbYQFefwhHd4sBZMYEz6";
-            sdkKey = "BjJomNU2bQc2SYhT7NNqwvFd1t6RRNv5DTZNYd8pMH19";
-            libarcsoftFaceDllPath = "/usr/lib/ArcSoft_ArcFace_Java_Linux_x64_V3.0/libs/LINUX64";
+            // appId = "FTN3G4pk8n2RKwjD955sRapRjbYQFefwhHd4sBZMYEz6";
+            // sdkKey = "BjJomNU2bQc2SYhT7NNqwvFd1t6RRNv5DTZNYd8pMH19";
+            appId = "5fiiFa6fTSRhDbiarBSMGVS1hEkDyMQLYyBgn97EzZyb";
+            sdkKey = "3QndXfNCsoUM5hDyzSw2a3j7BXUXJJbEB6bLK4qzAaJb";
+            activeKey = "82G1-11YW-G2ER-C3AW";
+            libarcsoftFaceDllPath = "/usr/lib/ArcSoft_ArcFacePro_linux_java_V4.1/libs/LINUX64";
         } else {
             // 在win
             appId = "FTN3G4pk8n2RKwjD955sRapRjbYQFefwhHd4sBZMYEz6";
@@ -61,7 +66,7 @@ public class ArcSoftMothodUtil {
         faceEngine = new FaceEngine(libarcsoftFaceDllPath);
         //激活引擎
         // 联网激活
-        int errorCode = faceEngine.activeOnline(appId, sdkKey);
+        int errorCode = faceEngine.activeOnline(appId, sdkKey, activeKey);
         // 离线激活
         // int errorCode = faceEngine.activeOffline("D:\\work\\app\\appinstall\\ArcSoft_ArcFacePro_windows_x64_java_V4.2\\86M111YWX11JB4BZ.dat");
 
@@ -80,19 +85,19 @@ public class ArcSoftMothodUtil {
         EngineConfiguration engineConfiguration = new EngineConfiguration();
         engineConfiguration.setDetectMode(DetectMode.ASF_DETECT_MODE_IMAGE);
         engineConfiguration.setDetectFaceOrientPriority(DetectOrient.ASF_OP_ALL_OUT);
-        engineConfiguration.setDetectFaceMaxNum(10);
+        engineConfiguration.setDetectFaceMaxNum(1);
         // 联网激活
         // engineConfiguration.setDetectFaceScaleVal(16);
         //功能配置
         FunctionConfiguration functionConfiguration = new FunctionConfiguration();
-        functionConfiguration.setSupportAge(true);
+        functionConfiguration.setSupportAge(false);
         // 联网激活
         // functionConfiguration.setSupportFace3dAngle(true);
         functionConfiguration.setSupportFaceDetect(true);
         functionConfiguration.setSupportFaceRecognition(true);
-        functionConfiguration.setSupportGender(true);
+        functionConfiguration.setSupportGender(false);
         functionConfiguration.setSupportLiveness(true);
-        functionConfiguration.setSupportIRLiveness(true);
+        functionConfiguration.setSupportIRLiveness(false);
         engineConfiguration.setFunctionConfiguration(functionConfiguration);
 
         //初始化引擎
@@ -166,10 +171,10 @@ public class ArcSoftMothodUtil {
 
         //特征提取
         FaceFeature faceFeature = new FaceFeature();
-        // 联网激活
-        errorCode = faceEngine.extractFaceFeature(imageInfo.getImageData(), imageInfo.getWidth(), imageInfo.getHeight(), imageInfo.getImageFormat(), faceInfoList.get(0), faceFeature);
-        // 离线激活
-        // errorCode = faceEngine.extractFaceFeature(imageInfo.getImageData(), imageInfo.getWidth(), imageInfo.getHeight(), imageInfo.getImageFormat(), faceInfoList.get(0), ExtractType.RECOGNIZE, 0, faceFeature);
+        // 联网激活 3.0
+        // errorCode = faceEngine.extractFaceFeature(imageInfo.getImageData(), imageInfo.getWidth(), imageInfo.getHeight(), imageInfo.getImageFormat(), faceInfoList.get(0), faceFeature);
+        // 离线激活4.1 / 4.2
+        errorCode = faceEngine.extractFaceFeature(imageInfo.getImageData(), imageInfo.getWidth(), imageInfo.getHeight(), imageInfo.getImageFormat(), faceInfoList.get(0), ExtractType.RECOGNIZE, 0, faceFeature);
         Assert.isFalse(errorCode != ErrorInfo.MOK.getValue(), "获取人脸特征值失败!");
         byte[] featureData = faceFeature.getFeatureData();
         // 4------------------------返回解析的数据---------------------
@@ -214,16 +219,16 @@ public class ArcSoftMothodUtil {
             List<FaceInfo> faceInfoList = new ArrayList<>();
             errorCode = faceEngine.detectFaces(imageInfo.getImageData(), imageInfo.getWidth(), imageInfo.getHeight(), imageInfo.getImageFormat(), faceInfoList);
             Assert.isFalse(errorCode != ErrorInfo.MOK.getValue(), "未识别到人脸!");
-
+            System.out.println("人脸检测完成---------");
             //特征提取
             FaceFeature faceFeature = new FaceFeature();
             // 联网激活
-            errorCode = faceEngine.extractFaceFeature(imageInfo.getImageData(), imageInfo.getWidth(), imageInfo.getHeight(), imageInfo.getImageFormat(), faceInfoList.get(0), faceFeature);
+            // errorCode = faceEngine.extractFaceFeature(imageInfo.getImageData(), imageInfo.getWidth(), imageInfo.getHeight(), imageInfo.getImageFormat(), faceInfoList.get(0), faceFeature);
             // 离线激活
-            // errorCode = faceEngine.extractFaceFeature(imageInfo.getImageData(), imageInfo.getWidth(), imageInfo.getHeight(), imageInfo.getImageFormat(), faceInfoList.get(0), ExtractType.RECOGNIZE, 0, faceFeature);
+            errorCode = faceEngine.extractFaceFeature(imageInfo.getImageData(), imageInfo.getWidth(), imageInfo.getHeight(), imageInfo.getImageFormat(), faceInfoList.get(0), ExtractType.RECOGNIZE, 0, faceFeature);
             Assert.isFalse(errorCode != ErrorInfo.MOK.getValue(), "获取人脸特征值失败!");
             byte[] featureData = faceFeature.getFeatureData();
-
+            System.out.println("特征提取完成---------");
             // 转成list
             List<String> matcherFeatureDataList = new ArrayList<>(matcher);
             /*FaceFeature targetFaceFeature = new FaceFeature();
@@ -253,6 +258,7 @@ public class ArcSoftMothodUtil {
 
             // 构建四个线程进行处理,防止人员过多对比速度太慢
             CompletableFuture<FaceMatchVO>[] completableFutureArray = averageMatcherFeatureDataList.stream().map(partitionFeatureData -> CompletableFuture.supplyAsync(() -> comparison(featureData, new ArrayList<>(partitionFeatureData)), THREAD_POOL_EXECUTOR)).toArray(CompletableFuture[]::new);
+            System.out.println("四个线程进行处理完成---------");
             // 等待所有任务执行完
             CompletableFuture.allOf(completableFutureArray).join();
             List<FaceMatchVO> verificationList = new ArrayList<>();
@@ -273,7 +279,7 @@ public class ArcSoftMothodUtil {
                 return max;
             }
         } catch (Exception e) {
-            log.error("人脸比对异常:{}", e.getMessage());
+            log.error("人脸比对异常1:{}", e.getMessage());
         } finally {
             //特征值提取完毕后清除数据
             removeFile(fileName);
@@ -309,7 +315,7 @@ public class ArcSoftMothodUtil {
                 return high >= THRESHOLD ? new FaceMatchVO().setContent(match).setScore(high) : null;
             }
         } catch (Exception e) {
-            log.error("人脸比对异常:{}", e.getMessage());
+            log.error("人脸比对异常2:{}", e.getMessage());
         }
         return null;
     }

+ 18 - 2
ktg-mes/pom.xml

@@ -16,10 +16,26 @@
     </description>
     <dependencies>
         <!--jasperreport组件-->
-        <dependency>
+        <!--<dependency>
             <groupId>net.sf.jasperreports</groupId>
             <artifactId>jasperreports</artifactId>
             <version>6.18.1</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>com.lowagie</groupId>
+                    <artifactId>itext</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>-->
+        <!--<dependency>
+            <groupId>com.lowagie</groupId>
+            <artifactId>itext</artifactId>
+            <version>2.1.7</version>
+        </dependency>-->
+        <dependency>
+            <groupId>net.sf.jasperreports</groupId>
+            <artifactId>jasperreports</artifactId>
+            <version>7.0.3</version>
         </dependency>
         <dependency>
             <groupId>net.sf.jasperreports</groupId>
@@ -54,4 +70,4 @@
         </dependency>
     </dependencies>
 
-</project>
+</project>