我的原始代码是
import cv2.cv as cv
import time
cv.NamedWindow("camera", 1)
capture = cv.CaptureFromCAM(0)
while True:
img = cv.QueryFrame(capture)
cv.ShowImage("camera", img)
if cv.WaitKey(10) == 27:
break
cv.DestroyAllWindows()
我改变了什么,而不是相机的ip是20.0.0.14
答案 0 :(得分:1)
从列表https://www.ispyconnect.com/sources.aspx中找出您的相机型号。并改变这样的代码。我假设使用HoneyWell相机。
import cv2
capture = cv2.VideoCapture("http://IPADDRESS/axis-cgi/mjpg/video.cgi")
while True:
img,ret = capture.read()
cv2.imshow("camera", img)
if cv.WaitKey(10) == 27:
break
cv2.destroyAllWindows()