Skip to content
This repository has been archived by the owner on Sep 3, 2020. It is now read-only.

my problem #4

Open
xiuluoxiuluo1 opened this issue Jan 22, 2019 · 4 comments
Open

my problem #4

xiuluoxiuluo1 opened this issue Jan 22, 2019 · 4 comments
Labels
bug Something isn't working openCV problems related to openCV Windows exceptions on windows

Comments

@xiuluoxiuluo1
Copy link

=========== 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)

@Meowcolm024 Meowcolm024 added bug Something isn't working Windows exceptions on windows openCV problems related to openCV labels Jan 22, 2019
@Meowcolm024
Copy link
Owner

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 :(

@xiuluoxiuluo1
Copy link
Author

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

@onkenbun
Copy link

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

@RingZEROtlf
Copy link
Contributor

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.

Meowcolm024 added a commit that referenced this issue Sep 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working openCV problems related to openCV Windows exceptions on windows
Projects
None yet
Development

No branches or pull requests

4 participants