Esempio n. 1
0
def test_match_template():
    image1 = toolbox.imread(IMAGE_PATH)
    image2 = toolbox.imread(IMAGE_PATH)
    ret = toolbox.match_template_with_object(image1, image2)
    assert ret["ok"]

    ret = toolbox.match_template_with_path(IMAGE_PATH, image2)
    assert ret["ok"]
Esempio n. 2
0
    def contain_image(self,
                      *,
                      image_path: str = None,
                      image_object: np.ndarray = None,
                      **kwargs) -> typing.Dict[str, typing.Any]:
        assert image_path or (
            image_object is not None), "should fill image_path or image_object"

        if image_path:
            logger.debug(f"found image path, use it first: {image_path}")
            return toolbox.match_template_with_path(image_path, self.data,
                                                    **kwargs)
        image_object = toolbox.turn_grey(image_object)
        return toolbox.match_template_with_object(image_object, self.data,
                                                  **kwargs)