guibot.imagelogger module

class guibot.imagelogger.ImageLogger[source]

Bases: object

Logger for the image matching process with the help of images.

It always contains the current match case: the needle and haystack images/targets being matched and the hotmap (an image with additional drawn information on it), the matched similarity and the matched coordinates.

Generally, each finder class takes care of its own image logging, performing drawing or similar operations on the spot and deciding which hotmaps (also their names and order) to dump.

step = 1

number of the current step

accumulate_logging = False

switch to stop logging and later on log all accumulated dumps at once

logging_level = 40

level for the image logging

logging_destination = './imglog'

destination for the image logging in order to dump images (the executing code decides when to clean this directory)

step_width = 3

number of digits for the counter of logged steps

__init__()[source]

Build an imagelogger object.

printable_step

Getter for readonly attribute.

Returns:step number prepended with zeroes to obtain a fixed length enumeration
Return type:str
debug()[source]

Log images with a DEBUG logging level.

info()[source]

Log images with an INFO logging level.

warning()[source]

Log images with a WARNING logging level.

error()[source]

Log images with an ERROR logging level.

critical()[source]

Log images with a CRITICAL logging level.

dump_matched_images()[source]

Write file with the current needle and haystack.

The current needle and haystack (matched images) are stored as needle and haystack attributes.

dump_hotmap(name, hotmap)[source]

Write a file the given hotmap.

Parameters:
  • name (str) – filename to use for the image
  • hotmap (PIL.Image or numpy.ndarray) – image (with matching results) to write
clear()[source]

Clear all accumulated logging including hotmaps, similarities, and locations.