Example #1
0
def test_find_template(region_and_template):
    region, template = region_and_template
    region = Region(*region)

    library = Images()
    library.matcher = TemplateMatcher(opencv=True)

    matches = library.find_template_in_image(image=IMAGES / "source.png",
                                             template=IMAGES / template,
                                             limit=1)

    assert len(matches) == 1
    match = matches[0]
    assert match.center == region.center
Example #2
0
def test_find_template(region_and_template):
    region, template = region_and_template
    region = Region(*region)

    library = Images()
    matches = library.find_template_in_image(
        image=IMAGES / "source.png",
        template=IMAGES / template,
        tolerance=0.8,
    )

    assert len(matches) == 1
    match = matches[0]
    assert match.center == region.center