Ошибка при обнаружении объекта камеры в реальном времени в PythonPython

Программы на Python
Anonymous
Ошибка при обнаружении объекта камеры в реальном времени в Python

Сообщение Anonymous »


У меня есть код:

Код: Выделить всё

import cv2
import cvlib as cv
import cvlib.object_detection
from gtts import gTTS
from playsound import playsound

video = cv2.VideoCapture(0)

while (True):
retu, frame0=video.read()
bbox, label, conf = cv.detect_common_objects(frame0)
output_image= cvlib.object_detection.draw_bbox(frame0, bbox, label, conf)

cv2.imshow('Cam', output_image)
if cv2.waitKey(1) & 0xFF==ord('f'):
break
video.release()
cv2.destroyAllWindows()

And I keep getting this Error

Код: Выделить всё

Traceback (most recent call last):
File "C:\Users\wptassembly\PycharmProjects\imageLibrary\.venv\cam.py", line 36, in 
bbox, label, conf = cv.detect_common_objects(frame)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\wptassembly\PycharmProjects\imageLibrary\.venv\Lib\site-packages\cvlib\object_detection.py", line 125, in detect_common_objects
net = cv2.dnn.readNet(weights_file_abs_path, config_file_abs_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cv2.error: OpenCV(4.9.0) D:\a\opencv-python\opencv-python\opencv\modules\dnn\src\darknet\darknet_io.cpp:705: error: (-215:Assertion failed) separator_index < line.size() in function 'cv::dnn::darknet::ReadDarknetFromCfgStream'
The code is to get images from my webcam, detect objects, and then draw a box around them; however I keep getting thrown the Error.


Источник: https://stackoverflow.com/questions/781 ... -in-python

Вернуться в «Python»