image_grid.py 583 B

123456789101112131415161718192021222324252627
  1. # This Python file uses the following encoding: utf-8
  2. # @author runhey
  3. # github https://github.com/runhey
  4. import numpy as np
  5. from module.atom.image import RuleImage
  6. class ImageGrid:
  7. def __init__(self, images: list[RuleImage]):
  8. self.images = images
  9. def find_anyone(self, img: np.array) -> RuleImage or None:
  10. """
  11. 在这些图片中找到其中一个
  12. :param img:
  13. :return: 如果没有找到返回None
  14. """
  15. for image in self.images:
  16. if image.match(img):
  17. return image
  18. return None