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 RegionMatcherImpl.RegionMatcherImpl(config, strategy=None)

I am the abstract parent of all Region matching strategies.

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

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)

Rather than searching the entire haystack for the needle, look at the location starting with the given corner (upper left) and see if there is a match that starts right there.

Parameters:

  • haystack: the <no title> to search for the needle

  • needle: the <no title> to find in the haystack

  • corner: the coordinates (in X,Y order, not Row,Col) of the upper left corner of the expected match

Return: True if there is a match at that corner, False otherwise

use_exact_matching()

No matter the default, use a threshold of 0 to accept only exact matches.

RegionMatcherImpl.get_matcher(config)

I am a Factory method to build <no title> instances of the correct type.

Parameters:

  • config: either a <no title> object or the type of ImageMatcherImpl

Return: a concrete subclass of RegionMatcherImpl to do image matching