I am looking to use adb screencap
utility without the -p
flag. I imagined output will be dumped in raw format, but doesn\'t look like it. My attempts o
To read adb screencap raw format in python:
from PIL import Image
Image.frombuffer('RGBA', (1920, 1080), raw[12:], 'raw', 'RGBX', 0, 1)
The most important part is skipping the header, as mentioned in @Emmanuel's answer
Note that (1920, 1080) are your device resolution which can be obtained with
adb shell wm size
Hopefully this will save someone 12 hours investigating why cv2.matchTemplate has different match on almost identical images.