Exemplo n.º 1
0
 def _cv_match(self, screen):
     # in case image file not exist in current directory:
     image = self._imread()
     image = self._resize_image(image, screen, ST.RESIZE_METHOD)
     ret = None
     for method in ST.CVSTRATEGY:
         # get function definition and execute:
         func = MATCHING_METHODS.get(method, None)
         if func is None:
             raise InvalidMatchingMethodError(
                 "Undefined method in CVSTRATEGY: '%s', try 'kaze'/'brisk'/'akaze'/'orb'/'surf'/'sift'/'brief' instead."
                 % method)
         else:
             if method == "mstpl":
                 ret = self._try_match(func,
                                       self._imread(),
                                       screen,
                                       threshold=self.threshold,
                                       rgb=self.rgb,
                                       resolution=self.resolution,
                                       scale_max=self.scale_max,
                                       scale_step=self.scale_step)
             else:
                 ret = self._try_match(func,
                                       image,
                                       screen,
                                       threshold=self.threshold,
                                       rgb=self.rgb)
         if ret:
             break
     return ret
Exemplo n.º 2
0
Arquivo: cv.py Projeto: smqh-smqh/kwai
 def _cv_match(self, screen):
     # in case image file not exist in current directory:
     image = self._imread()
     image = self._resize_image(image, screen, ST.RESIZE_METHOD)
     G.LOGGING.debug("RESIZE_METHOD%s" % ST.RESIZE_METHOD)
     ret = None
     for method in ST.CVSTRATEGY:
         # get function definition and execute:
         func = MATCHING_METHODS.get(method, None)
         if func is None:
             raise InvalidMatchingMethodError(
                 "Undefined method in CVSTRATEGY: '%s', try 'kaze'/'brisk'/'akaze'/'orb'/'surf'/'sift'/'brief' instead."
                 % method)
         else:
             ret = self._try_match(func,
                                   image,
                                   screen,
                                   threshold=self.threshold,
                                   rgb=self.rgb)
         if ret:
             break
     G.LOGGING.debug("func 具体%s" % func)
     G.LOGGING.debug("match结果%s" % ret)
     return ret