mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-04-17 03:31:40 +08:00
Fix: Gray scale GIF has has multiple channels started at the 2nd frame
This commit is contained in:
@@ -175,7 +175,7 @@ class Button(Resource):
|
|||||||
self._button_offset = area_offset(self._button, offset[:2] + np.array(point))
|
self._button_offset = area_offset(self._button, offset[:2] + np.array(point))
|
||||||
return similarity > threshold
|
return similarity > threshold
|
||||||
|
|
||||||
def match_appear_on(self, image, threshold=10):
|
def match_appear_on(self, image, threshold=30):
|
||||||
"""
|
"""
|
||||||
Args:
|
Args:
|
||||||
image: Screenshot.
|
image: Screenshot.
|
||||||
|
|||||||
@@ -29,8 +29,16 @@ class Template(Resource):
|
|||||||
if self._image is None:
|
if self._image is None:
|
||||||
if self.is_gif:
|
if self.is_gif:
|
||||||
self._image = []
|
self._image = []
|
||||||
|
channel = 0
|
||||||
for image in imageio.mimread(self.file):
|
for image in imageio.mimread(self.file):
|
||||||
image = image[:, :, :3].copy() if len(image.shape) == 3 else image
|
if not channel:
|
||||||
|
channel = len(image.shape)
|
||||||
|
if channel == 3:
|
||||||
|
image = image[:, :, :3].copy()
|
||||||
|
elif len(image.shape) == 3:
|
||||||
|
# Follow the first frame
|
||||||
|
image = image[:, :, 0].copy()
|
||||||
|
|
||||||
image = self.pre_process(image)
|
image = self.pre_process(image)
|
||||||
self._image += [image, cv2.flip(image, 1)]
|
self._image += [image, cv2.flip(image, 1)]
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user