我在pyimagesearch上学习了实时对象检测,并且可以借助“ imutils.video.VideoStream”获得视频流。我继续在while循环中读取VideoStream帧。
下面是我的代码:
print("[INFO] starting video stream...")
vs = VideoStream(src=0).start()
time.sleep(2.0)
fps = FPS().start()
while True:
# grab the frame from the threaded video stream and resize it
# to have a maximum width of 400 pixels
frame = vs.read()
frame = imutils.resize(frame, width=400)
# grab the frame dimensions and convert it to a blob
(h, w) = frame.shape[:2]
blob = cv2.dnn.blobFromImage(cv2.resize(frame, (300, 300)),
0.007843, (300, 300), 127.5)
# pass the blob through the network and obtain the detections and
# predictions
net.setInput(blob)
detections = net.forward()
...
但是,我想让我的IP摄像机的视频流不在屋外,而不是网络摄像机。但是我对IP摄像机没有任何经验和知识。
任何人都可以帮助我解决这个问题。
非常感谢您!