def __init__(self, original, is_cards_screen=False):
self.original = cv2.cvtColor(original, cv2.COLOR_BGR2GRAY)
(self.original_h, self.original_w) = self.original.shape[:2]
self.threshold = 0.8
self.is_cards_screen = False
self.resized_w = self.original_w
self.resized_h = self.original_h
if self.original_w != TARGET_WIDTH:
self.original = imutils.resize(self.original, width=TARGET_WIDTH)
(self.resized_h, self.resized_w) = self.original.shape[:2]
self.mid_height = int(self.resized_h / 2.0)
# Now can detect if we're on the game-over screen with voting cards, since
# we've scaled the image to the same size from which the 'rate match'
# template was taken.
self.is_cards_screen = self.detect_if_cards_screen()
# Returns a unique list of tuples with x,y coordinates for the top left of
# where the given template appears in the original image. Returns None if the
# template was not detected.
hero_detector.py 文件源码
python
阅读 27
收藏 0
点赞 0
评论 0
评论列表
文章目录