mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-14 05:31:03 +00:00
Use backward search in the screen time
This commit is contained in:
parent
82ac8e5d02
commit
18e81f71ba
|
@ -296,15 +296,24 @@ public class ScreenMatch
|
||||||
Point bestMatch = Point.Empty;
|
Point bestMatch = Point.Empty;
|
||||||
maxCorrelation = 0;
|
maxCorrelation = 0;
|
||||||
|
|
||||||
for (int x = 0; x <= mainWidth - templateWidth; x++)
|
bool searchFromEnd = _params.Contains("backward");
|
||||||
|
|
||||||
|
int startX = searchFromEnd ? mainWidth - templateWidth : 0;
|
||||||
|
int endX = searchFromEnd ? -1 : mainWidth - templateWidth + 1;
|
||||||
|
int stepX = searchFromEnd ? -1 : 1;
|
||||||
|
|
||||||
|
int startY = searchFromEnd ? mainHeight - templateHeight : 0;
|
||||||
|
int endY = searchFromEnd ? -1 : mainHeight - templateHeight + 1;
|
||||||
|
int stepY = searchFromEnd ? -1 : 1;
|
||||||
|
|
||||||
|
for (int x = startX; x != endX; x += stepX)
|
||||||
{
|
{
|
||||||
for (int y = 0; y <= mainHeight - templateHeight; y++)
|
for (int y = startY; y != endY; y += stepY)
|
||||||
{
|
{
|
||||||
if (IsTemplateMatch(mainImage, templateImage, x, y, threshold))
|
if (IsTemplateMatch(mainImage, templateImage, x, y, threshold))
|
||||||
{
|
{
|
||||||
bestMatch = new Point(x, y);
|
bestMatch = new Point(x, y);
|
||||||
maxCorrelation = 1.0;
|
maxCorrelation = 1.0;
|
||||||
|
|
||||||
return bestMatch;
|
return bestMatch;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,9 +11,9 @@ NONFREE_STRICT=false
|
||||||
DISABLE_SCREEN_TIME=false
|
DISABLE_SCREEN_TIME=false
|
||||||
DISABLE_FILE_MONITOR=false
|
DISABLE_FILE_MONITOR=false
|
||||||
; screen or window
|
; screen or window
|
||||||
SCREEN_TIME_MODE=screen
|
SCREEN_TIME_MODE=screen
|
||||||
;filename.exe
|
;filename.exe
|
||||||
SCREEN_TIME_PARAMS=
|
SCREEN_TIME_PARAMS=backward
|
||||||
GRPC_HOST=http://localhost:50051
|
GRPC_HOST=http://localhost:50051
|
||||||
ES_HOST=http://localhost:9200
|
ES_HOST=http://localhost:9200
|
||||||
ES_USER=elastic
|
ES_USER=elastic
|
||||||
|
|
Loading…
Reference in New Issue
Block a user