ConsoleUser

Copyright (c) 2010-2023 Skaion Corporarion, www.skaion.com

This project was developed in part by numerous sponsorships from the U.S. Government. The U.S. Government is authorized to reproduce and distribute reprints of Governmental purposes notwithstanding any copyright notation thereon.

All content reflects those of the authors and should not be interpreted as necessarily representing the official policies or endorsements, either expressed or implied, of the U.S. Government or Skaion Corporation.

class RegionMatcher.RegionMatcher(config, strategy=None)

I am the public inteface to do RegionMatching. My actually matching strategy can be selected at load time by specifing it in the config.

Parameters:

match(haystack, needle, rect)

Look for matches of the needle within the haystack, optionally restricted to only those within the given rectangle.

Parameters:

  • haystack: an <no title> to search

  • needle: an <no title> to look for

  • rect: if specified as a 4 element list (or tuple) those are the coordinates of a rectangle to bound the search, otherwise it is ignored, if this argument has only 2 elements they are assumed to be the coordinates of the upper left corner, the remaining corners can be derived from the needle

Return: a list of tuples which are the upper left coordinates that are the start of a match of the needle

match_at(haystack, needle, corner)

Check at a particular location to see if we match the given needle.

Parameters:

  • haystack: a <no title> to search in

  • needle: a <no title> to look for

  • corner: a tuple containing the upper left corner to start the match (tuple is in X,Y notation, not Row,Col)

Return: True if the needle is matched there, False otherwise

use_exact_matching()

Have this matching strategy use exact matches only.