mirror of
https://github.com/TonyJiangWJ/Auto.js.git
synced 2026-06-21 21:01:43 +08:00
fix(images): another mat released causes the mat recycled???
This commit is contained in:
parent
18a2543bb1
commit
0e2a49cd6f
@ -47,7 +47,7 @@ public class CodeEditText extends AppCompatEditText {
|
||||
|
||||
|
||||
static final String LOG_TAG = "CodeEditText";
|
||||
private static final boolean DEBUG = BuildConfig.DEBUG;
|
||||
private static final boolean DEBUG = false;
|
||||
|
||||
// 文字范围
|
||||
protected HVScrollView mParentScrollView;
|
||||
|
||||
@ -66,6 +66,7 @@ public class TemplateMatching {
|
||||
if (!isFirstMatching && !shouldContinueMatching(level, maxLevel)) {
|
||||
break;
|
||||
}
|
||||
// FIXME: 2018/3/31 此处的matchResult.release()某些情况下会导致currentTemplate被释放?
|
||||
// if (matchResult != null)
|
||||
// matchResult.release();
|
||||
matchResult = matchTemplate(src, currentTemplate, matchMethod);
|
||||
@ -172,8 +173,6 @@ 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;
|
||||
|
||||
@ -252,7 +252,6 @@ 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) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user