封装识别接口

This commit is contained in:
2025-03-28 18:19:25 +08:00
parent a587bd804e
commit 553f5a48b0
3 changed files with 29 additions and 12 deletions

View File

@@ -1,4 +1,5 @@
import ctypes
from predict import solve
def shot(target, width, height):
@@ -20,9 +21,11 @@ def shot(target, width, height):
if error_ptr:
print(ctypes.string_at(error_ptr).decode())
else:
result = ctypes.string_at(data, length.value)
with open('./screen/0.png', 'wb') as f:
f.write(result)
image_bytes = ctypes.string_at(data, length.value)
result = solve(image_bytes)
# with open('./screen/0.png', 'wb') as f:
# f.write(result)
lib.Free(data)