Parcourir la source

Merge branch 'master' of http://47.100.37.243:10080/wutt/manHourHousekeeper

# Conflicts:
#	fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ScreenshotServiceImpl.java
seyason il y a 5 ans
Parent
commit
f2d3da6f8f

+ 1 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ScreenshotServiceImpl.java

@@ -456,7 +456,7 @@ public class ScreenshotServiceImpl extends ServiceImpl<ScreenshotMapper, Screens
     }
 
     public static void main(String[] args) throws Exception {
-//        String b = isIM(new File("C:\\Users\\seya\\Desktop\\chat.jpg"));
+//        String b = isDevelop(new File("C:\\Users\\seya\\Desktop\\sqlyog_pt.jpg"));
 //        System.out.println("结果:"+b);
     }
 

+ 5 - 5
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/util/ImageReconizeUtil.java

@@ -15,7 +15,7 @@ import static org.opencv.imgproc.Imgproc.*;
 
 public class ImageReconizeUtil {
     public static final double YUZHI_HIGH = 2*Math.pow(0.1, 11);
-    public static final double YUZHI_NORMAL = 2*Math.pow(0.1, 10);
+    public static final double YUZHI_NORMAL = 1*Math.pow(0.1, 10);
     static {
         System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
         //注意程序运行的时候需要在VM option添加该行 指明opencv的dll文件所在路径
@@ -37,7 +37,7 @@ public class ImageReconizeUtil {
 
     public static boolean isTemplateMatch(String sourcePic, String targetPic) {
         double matchVal = templete(Imgproc.TM_SQDIFF_NORMED, sourcePic, targetPic,true);
-        if (Math.abs(matchVal) < YUZHI_NORMAL) {
+        if (Math.abs(matchVal) > 0 && Math.abs(matchVal) < YUZHI_HIGH) {
             System.out.println("找到啦");
             return true;
         } else {
@@ -48,7 +48,7 @@ public class ImageReconizeUtil {
 
     public static boolean isWholeTemplateMatch(String sourcePic, String targetPic) {
         double matchVal = templete(Imgproc.TM_SQDIFF_NORMED, sourcePic, targetPic, false);
-        if (Math.abs(matchVal) < YUZHI_HIGH) {
+        if (Math.abs(matchVal) > 0 && Math.abs(matchVal) < YUZHI_HIGH) {
             System.out.println("找到啦"+targetPic);
             return true;
         } else {
@@ -103,11 +103,11 @@ public class ImageReconizeUtil {
             matchVal = mmr.maxVal;
         }
 
-        System.out.println("匹配度=="+matchVal);
+        System.out.println("匹配度=="+matchVal+", target="+targetPic);
         System.out.println("x="+x+", y=" + y);
         //我们匹配的图像在左上角,考虑到用户可能拖动窗口,但是不应该偏差很大。 这里增加判断标准:坐标处在左上方。
 
-//        if (Math.abs(matchVal) < YUZHI) {
+//        if (Math.abs(matchVal) < YUZHI_NORMAL) {
 //            Imgproc.rectangle(templete,new Point(x,y),new Point(x+demo.cols(),y+demo.rows()),new Scalar( 0, 0, 255),2,Imgproc.LINE_AA);
 //            Imgproc.putText(templete,"Match Success",new Point(x,y),Imgproc.FONT_HERSHEY_SCRIPT_COMPLEX, 1.0, new Scalar(0, 255, 0),1,Imgproc.LINE_AA);
 //            // 8 显示结果