Python gattlib和OpenCV之间有冲突吗?

时间:2019-05-09 07:29:15

标签: python opencv raspberry-pi3 bluetooth-gatt gattlib

我想创建一个Python程序,用OpenCV打开摄像头,并用Raspberry Pi上的gattlib控制蓝牙设备。这是代码:

import cv2
import threading
from gattlib import GATTRequester
from time import sleep

cap = cv2.VideoCapture(0)
cap.set(3, 320)
cap.set(4, 240)

while(True):
    print(1)
    ret, frame = cap.read()
    print(2)
    cv2.imshow('frame', frame)
    print(3)
    key = cv2.waitKey(1) & 0xFF
    print(4)
    if key == ord('q'):
        break

# When everything done, release the capture
cap.release()
cv2.destroyAllWindows()

奇怪的是它将阻塞key = cv2.waitKey(1) & 0xFF处的线程。

enter image description here

如果我删除from gattlib import GATTRequester,代码可以正常工作。

有人知道这是怎么回事吗?

谢谢!

0 个答案:

没有答案