initial commit

This commit is contained in:
2025-02-19 16:09:44 +08:00
commit 9eb3879aab
19 changed files with 1426 additions and 0 deletions

21
test_recv.py Normal file
View File

@@ -0,0 +1,21 @@
import serial_module
import cv2
import numpy as np
serial_module.init("/dev/ttyUSB1")
while True:
try:
data = serial_module.receive()
# print("Received data:", data)
if data:
frame = np.frombuffer(data, np.uint8)
# 将数据转换为图像
image = cv2.imdecode(frame, cv2.IMREAD_COLOR)
# 显示图像
cv2.imshow('Received Image', image)
cv2.imwrite('test_recv.jpg', image)
# 等待按键输入
if cv2.waitKey(1) & 0xFF == ord('q'):
break
except Exception as e:
print("Error:", e)