I'd reckon like 3 seconds of latency...my FPS is great, it's just that there has to be some problems with the buffer
Code:
import cv2
import urllib
import numpy as np
stream=urllib.urlopen('http://10.25.76.11/mjpg/video.mjpg')
bytes=''
while True:
bytes+=stream.read(16384)
a = bytes.find('\xff\xd8')
b = bytes.find('\xff\xd9')
if a!=-1 and b!=-1:
jpg = bytes[a:b+2]
bytes= bytes[b+2:]
i = cv2.imdecode(np.fromstring(jpg, dtype=np.uint8),cv2.CV_LOAD_IMAGE_COLOR)
cv2.imshow('i',i)
if cv2.waitKey(1) ==27:
exit(0)
I got the code from StackOverflow. I had tried using a simple VideoCapture(ip), and got it to work on C++, but Python just throws up some errors:
Code:
Traceback (most recent call last):
File "C:\Users\Lucas\Documents\opencv\opencv\webcam.py", line 7, in <module>
cv2.imshow("window", img)
error: C:\slave\WinInstallerMegaPack\src\opencv\modules\core\src\array.cpp:2482: error: (-206) Unrecognized or unsupported array type
And when I print out the value of "ret" (the first variable outputted by VideoCapture::read()), I get False, which indicates that there is no image being captured (duh).
Any ideas?