Skip to content

Commit

Permalink
fix find pic bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
WallBreaker2 committed Aug 27, 2019
1 parent ac35210 commit 2e6bf07
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions op/ImageLoc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,10 @@ template<bool nodfcolor>
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<uint>(i + y) + x;
auto p2 = timg->ptr<uint>(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)
Expand All @@ -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<uchar>(i + y) + x * 4;
auto p2 = timg->ptr<uchar>(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)
Expand Down

0 comments on commit 2e6bf07

Please sign in to comment.