Skip to content
This repository has been archived by the owner on Dec 15, 2021. It is now read-only.

cv2 error #4

Closed
Heavedistant opened this issue Sep 30, 2019 · 7 comments
Closed

cv2 error #4

Heavedistant opened this issue Sep 30, 2019 · 7 comments

Comments

@Heavedistant
Copy link

Hello again, I've updated to the latest ALAuto version with SED removed. When trying to run the script with the latest ADB platform-tools 1.0.41 version 29.0.4. I get this output.

[2019-09-29 17:26:21] Initializing config module
[2019-09-29 17:26:21] Validating config
[2019-09-29 17:26:21] Starting ALAuto!
* daemon not running; starting now at tcp:5037
* daemon started successfully
[2019-09-29 17:26:36] Sucessfully connected to the service.
error: more than one device/emulator
Traceback (most recent call last):
  File "ALAuto.py", line 143, in <module>
    Utils.update_screen()
  File "G:\AzurLane\ALAuto-master\util\utils.py", line 79, in update_screen
    screen = cv2.imdecode(numpy.fromstring(Adb.exec_out('screencap -p'), dtype=numpy.uint8), 0)
cv2.error: OpenCV(3.4.4) C:\projects\opencv-python\opencv\modules\imgcodecs\src\loadsave.cpp:750: error: (-215:Assertion failed) !buf.empty() && buf.isContinuous() in function 'cv::imdecode_'```

Any insights on what I may have setup incorrectly?
@Egoistically
Copy link
Owner

error: more than one device/emulator

Unlike Nox, most other emulators get automatically connected to the adb server, therefore making the connection made by the bot redundant.
My guess is that after updating to the latest platform-tools your emulator started doing that.

Try commenting this line and let me know if it works as intended.

@Heavedistant
Copy link
Author

That was it! It was definitely related to the ADB version change but I didn't understand the reason. Thank you for the response, I'm back in business!

@Heavedistant
Copy link
Author

Heavedistant commented Sep 30, 2019

Oops it threw a similar error after combat victory. I appreciate the debugging help and please take your time.

py ALAuto.py
[2019-09-29 23:19:20] Initializing config module
[2019-09-29 23:19:20] Validating config
[2019-09-29 23:19:20] Starting ALAuto!
* daemon not running; starting now at tcp:5037
* daemon started successfully
[2019-09-29 23:19:25] Sucessfully connected to the service.
[2019-09-29 23:19:38] Found specified map.
[2019-09-29 23:19:49] Started map clear.
error: more than one device/emulator
[2019-09-29 23:20:02] Current location is: [66, 488]
[2019-09-29 23:20:02] Enemies found at: [[406, 772]]
[2019-09-29 23:20:02] Closest enemy is at [406, 772]
error: more than one device/emulator
[2019-09-29 23:20:06] Moving towards objective.
[2019-09-29 23:20:16] Starting combat.
error: more than one device/emulator
Traceback (most recent call last):
  File "ALAuto.py", line 156, in <module>
    script.run_combat_cycle()
  File "ALAuto.py", line 56, in run_combat_cycle
    result = self.modules['combat'].combat_logic_wrapper()
  File "G:\AzurLane\ALAuto-master\modules\combat.py", line 74, in combat_logic_wrapper
    if not self.clear_map():
  File "G:\AzurLane\ALAuto-master\modules\combat.py", line 281, in clear_map
    self.battle_handler()
  File "G:\AzurLane\ALAuto-master\modules\combat.py", line 105, in battle_handler
    Utils.update_screen()
  File "G:\AzurLane\ALAuto-master\util\utils.py", line 79, in update_screen
    screen = cv2.imdecode(numpy.fromstring(Adb.exec_out('screencap -p'), dtype=numpy.uint8), 0)
cv2.error: OpenCV(3.4.4) C:\projects\opencv-python\opencv\modules\imgcodecs\src\loadsave.cpp:750: error: (-215:Assertion failed) !buf.empty() && buf.isContinuous() in function 'cv::imdecode_'

@Heavedistant Heavedistant reopened this Sep 30, 2019
@Egoistically
Copy link
Owner

Egoistically commented Sep 30, 2019

It is really weird, I'd suggest you sticking to the old adb and sed. It should work just as good.
I added an argument to enable sed on this b36c249 commit.
Remove the comment from the line I told you and launch the bot with -l at the end.

Sorry for not answering earlier, I was sleeping.

@Heavedistant
Copy link
Author

No problem at all, sleep definitely comes first. I will try the commit and can easily revert back to the old ADB and SED version which works just as well. Thank you!

@Heavedistant
Copy link
Author

-l is working great with the latest commit and SED. Thanks again!

@Egoistically
Copy link
Owner

You're welcome!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants