FGO-One icon indicating copy to clipboard operation
FGO-One copied to clipboard

my problem

Open xiuluoxiuluo1 opened this issue 6 years ago • 4 comments
trafficstars

=========== RESTART: C:\Users\Shinelon\Desktop\FGO-master\main.py =========== Traceback (most recent call last): File "C:\Users\Shinelon\Desktop\FGO-one-master\main.py", line 21, in end = s.recognize() File "C:\Users\Shinelon\Desktop\FGO-one-master\interface\Major.py", line 70, in recognize back = self.get_basic() File "C:\Users\Shinelon\Desktop\FGO-one-master\interface\Major.py", line 27, in get_basic if analyze(self.screenshot, basic_scene, self.threshold) == 1: File "C:\Users\Shinelon\Desktop\FGO-one-master\util\cvs.py", line 43, in analyze res = cv2.matchTemplate(sh, tmp, cv2.TM_CCOEFF_NORMED) cv2.error: OpenCV(4.0.0) C:\projects\opencv-python\opencv\modules\imgproc\src\templmatch.cpp:589: error: (-215:Assertion failed) corrsize.height <= img.rows + templ.rows - 1 && corrsize.width <= img.cols + templ.cols - 1 in function 'cv::crossCorr'

I AM NOT GOOD AT ENGLISH(thank you in advance.) I can find a picture which is called "sh"(screen shot) in my floder then I checked something about opencv and adb , but there is nothing wrong(I can't find where the problem is)

xiuluoxiuluo1 avatar Jan 22 '19 11:01 xiuluoxiuluo1

Try to check the following items:

  1. check whether the folder assets exists or not, and make sure every item in the folder is the same as those on GitHub

  2. check the paths, in the file Major.py , there would be some lines look that this:

self.basic_scenes = [cv2.imread(f"./assets/scene/{basic_scene}.png", 0) for basic_scene in basic_scenes]
self.battle_scenes = [cv2.imread(f"./assets/battle/{battle_scene}.png", 0) for battle_scene in battle_scenes]
self.support_scene = cv2.imread(f"./assets/scene/{support_scene}.png", 0)
self.finish_scenes = [cv2.imread(f"./assets/scene/{finish_scene}.png", 0) for finish_scene in finish_scenes]
self.loading_scenes = [cv2.imread(f"./assets/scene/{loading_scene}.png", 0) for loading_scene in loading_scenes]

try removing "./"

self.basic_scenes = [cv2.imread(f"assets/scene/{basic_scene}.png", 0) for basic_scene in basic_scenes]
self.battle_scenes = [cv2.imread(f"assets/battle/{battle_scene}.png", 0) for battle_scene in battle_scenes]
self.support_scene = cv2.imread(f"assets/scene/{support_scene}.png", 0)
self.finish_scenes = [cv2.imread(f"assets/scene/{finish_scene}.png", 0) for finish_scene in finish_scenes]
self.loading_scenes = [cv2.imread(f"assets/scene/{loading_scene}.png", 0) for loading_scene in loading_scenes]

However, I'm not sure whether these measures would work :(

Meowcolm024 avatar Jan 26 '19 14:01 Meowcolm024

I’m sorry, but even I did it by your suggestion, It still wrong. QAQ So sad

xiuluoxiuluo1 avatar Jan 27 '19 12:01 xiuluoxiuluo1

I have the same question as xiuluoxiuluo1 has and i tried your suggestion but it still didn‘t work QAQ

onkenbun avatar Apr 14 '19 04:04 onkenbun

It seems that this bug is caused by a larger template image than the captured one. I have a pull request #7 to fix this by resizing the template image.

RingZEROtlf avatar Jul 25 '19 07:07 RingZEROtlf