diff --git a/autojs/src/main/java/com/stardust/autojs/core/accessibility/UiSelector.java b/autojs/src/main/java/com/stardust/autojs/core/accessibility/UiSelector.java index d8aed883..2f627f33 100644 --- a/autojs/src/main/java/com/stardust/autojs/core/accessibility/UiSelector.java +++ b/autojs/src/main/java/com/stardust/autojs/core/accessibility/UiSelector.java @@ -73,6 +73,7 @@ public class UiSelector extends UiGlobalSelector { public UiObjectCollection find() { ensureAccessibilityServiceEnabled(); AccessibilityNodeInfo root = mAccessibilityBridge.getRootInActiveWindow(); + Log.d(TAG, "find: root = " + root); if (root == null) { return UiObjectCollection.EMPTY; } diff --git a/autojs/src/main/java/com/stardust/autojs/core/image/TemplateMatching.java b/autojs/src/main/java/com/stardust/autojs/core/image/TemplateMatching.java index 053a2fd5..14c29071 100644 --- a/autojs/src/main/java/com/stardust/autojs/core/image/TemplateMatching.java +++ b/autojs/src/main/java/com/stardust/autojs/core/image/TemplateMatching.java @@ -1,5 +1,6 @@ package com.stardust.autojs.core.image; +import android.util.Log; import android.util.Pair; import android.util.TimingLogger; @@ -65,8 +66,8 @@ public class TemplateMatching { if (!isFirstMatching && !shouldContinueMatching(level, maxLevel)) { break; } - if (matchResult != null) - matchResult.release(); + // if (matchResult != null) + // matchResult.release(); matchResult = matchTemplate(src, currentTemplate, matchMethod); Pair bestMatched = getBestMatched(matchResult, matchMethod, weakThreshold); p = bestMatched.first; @@ -74,8 +75,8 @@ public class TemplateMatching { } else { //根据上一轮的匹配点,计算本次匹配的区域 Rect r = getROI(p, src, currentTemplate); - if (matchResult != null) - matchResult.release(); + // if (matchResult != null) + // matchResult.release(); Mat m = new Mat(src, r); matchResult = matchTemplate(m, currentTemplate, matchMethod); m.release(); @@ -171,6 +172,8 @@ public class TemplateMatching { public static Mat matchTemplate(Mat img, Mat temp, int match_method) { int result_cols = img.cols() - temp.cols() + 1; int result_rows = img.rows() - temp.rows() + 1; + Log.d(LOG_TAG, "matchTemplate: cols = " + result_cols + ", rows = " + result_rows); + Log.d(LOG_TAG, "matchTemplate: img = " + img + ", temp = " + temp); Mat result = new Mat(result_rows, result_cols, CvType.CV_32FC1); Imgproc.matchTemplate(img, temp, result, match_method); return result; diff --git a/autojs/src/main/java/com/stardust/autojs/runtime/api/Images.java b/autojs/src/main/java/com/stardust/autojs/runtime/api/Images.java index 5dd8a326..c2555a25 100644 --- a/autojs/src/main/java/com/stardust/autojs/runtime/api/Images.java +++ b/autojs/src/main/java/com/stardust/autojs/runtime/api/Images.java @@ -10,6 +10,7 @@ import android.os.Build; import android.os.Handler; import android.support.annotation.RequiresApi; import android.util.Base64; +import android.util.Log; import android.view.Display; import android.view.Surface; import android.view.WindowManager; @@ -251,6 +252,7 @@ public class Images { if (rect != null) { src = new Mat(src, rect); } + Log.d("Images", "matchTemplate: img = " + src + ", temp = " + template.getMat()); org.opencv.core.Point point = TemplateMatching.fastTemplateMatching(src, template.getMat(), TemplateMatching.MATCHING_METHOD_DEFAULT, weakThreshold, threshold, maxLevel); if (point != null) {