我想使用Android IP摄像机在OpenCV中进行实时流,我一直在尝试使用此代码,但它不起作用。我应该在此代码中更改什么?
camera=cv.CaptureFromFile("http://192.168.0.10:8080/videofeed")
while True :
img =cv.QueryFrame(camera)
cv.ShowImage('Video',img)
if cv.WaitKey(0):
break
cv.ReleaseCapture(camera)
import cv2
import numpy as np
import urllib
url = 'http://192.168.1.183:8080/shot.jpg'
while True:
imgResp = urllib.urlopen(url)
img = np.array(bytearray(imgResp.read()), dtype=np.uint8)
img1 = cv2.imdecode(img, -1)
#hsv = cv2.cvtColor(img1, cv2.COLOR_BGR2HSV)
#lower_red = np.array([30,150,50])
#upper_red = np.array([255,255,180])
#mask = cv2.inRange(hsv, lower_red, upper_red)
#res = cv2.bitwise_and(img1, img1, mask=mask)
cv2.imshow('img',img1)
cv2.waitKey(10)