我目前正在尝试设置一个 python 脚本,该脚本应该通过 tcp 套接字检测来自 raspberrypi 的对象。这就是我目前在窗口中显示图像的方式:
global footage_socket, font, frame_num, fps
context = zmq.Context()
footage_socket = context.socket(zmq.SUB)
footage_socket.bind('tcp://*:5555')
footage_socket.setsockopt_string(zmq.SUBSCRIBE, np.unicode(''))
while True:
frame = footage_socket.recv_string()
img = base64.b64decode(frame)
npimg = np.frombuffer(img, dtype=np.uint8)
source = cv2.imdecode(npimg, 1)
cv2.imshow("Livebild des RaspTanks", source)
cv2.waitKey(1)
但是问题来了:尝试使用cvlib的 detect_common_objects 实现对象识别时,出现以下错误:
cv2.error: OpenCV(4.1.2) C:\projects\opencv-
python\opencv\modules\dnn\src\darknet\darknet_importer.cpp:207: error: (-212:Parsing error) Failed to
parse NetParameter file: C:\Users\Büro\.cvlib\object_detection\yolo\yolov3\yolov3.cfg in function
'cv::dnn::dnn4_v20190902::readNetFromDarknet
我认为这是因为我的用户名中的“ü”。有没有办法改变yolov3路径或其他解决这个问题的方法?