From 2e6bf078ea4b3c71a68118224c6183eb7c6a243e Mon Sep 17 00:00:00 2001 From: wallbreaker2 <784942619@qq.com> Date: Tue, 27 Aug 2019 21:23:51 +0800 Subject: [PATCH] fix find pic bugs --- op/ImageLoc.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/op/ImageLoc.cpp b/op/ImageLoc.cpp index 5bb92ff..a3ef02e 100644 --- a/op/ImageLoc.cpp +++ b/op/ImageLoc.cpp @@ -163,10 +163,10 @@ template long ImageBase::simple_match(long x, long y, Image* timg, color_t dfcolor, int max_error) { int err_ct = 0, k; if (nodfcolor) { - for (int i = 0; i < timg->width; ++i) { + for (int i = 0; i < timg->height; ++i) { auto p1 = _src.ptr(i + y) + x; auto p2 = timg->ptr(i); - for (int j = 0; j < timg->height; ++j) { + for (int j = 0; j < timg->width; ++j) { if (*p1++!=*p2++) ++err_ct; if (err_ct > max_error) @@ -175,10 +175,10 @@ long ImageBase::simple_match(long x, long y, Image* timg, color_t dfcolor, int m } } else { - for (int i = 0; i < timg->width; ++i) { + for (int i = 0; i < timg->height; ++i) { auto p1 = _src.ptr(i + y) + x * 4; auto p2 = timg->ptr(i); - for (int j = 0; j < timg->height; ++j) { + for (int j = 0; j < timg->width; ++j) { if (*(color_t*)p1 - *(color_t*)p2 > dfcolor) ++err_ct; if (err_ct > max_error)