OpenCV and WIFI IP Camera Issue

MRAB python at mrabarnett.plus.com
Thu Feb 14 19:12:05 CET 2013


On 2013-02-14 17:25, Sam Berry wrote:
> Hey,
>
> Iv installed OpenCV on my windows machine. I can successfully view the
 > camera stream from my laptop so the installation was successful.
 > However when i edited the code adding in the address of my IP camera
 > like so....
>
> import cv2
>
> cv2.namedWindow("preview")
> vc = cv2.VideoCapture('http://192.168.1.72:1025/videostream.cgiUSERNAMEANDPASSWORD')
>
> if vc.isOpened(): # try to get the first frame
>      rval, frame = vc.read()
> else:
>      rval = False
>
> while rval:
>      cv2.imshow("preview", frame)
>      rval, frame = vc.read()
>      key = cv2.waitKey(20)
>      if key == 27: # exit on ESC
>          break
>
> When run, python tries to open the window to display the camera feed
 > then closes  before displaying the feed. Anyone have any ideas why? I
> read somewhere that there is an issue with this been run on windows?
>
> Any insight would be appreciated! Im all googled out.
>
I wonder whether you should be waiting for the key and _then_ reading
the next frame.




More information about the Python-list mailing list