python for IP camera problem

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

python for IP camera problem

bubifengyun
This post has NOT been accepted by the mailing list yet.
This post was updated on .
OpenCV, 2.4.9, Python 2.7

The IP Camera was an Android phone with a software which downloads from http://www.haban.cn/.

The IP Camera can be seen in FireFox by http://admin:admin@10.42.0.53:8081 in the WLAN. IP video's format over http is mjpeg.

And, from the HTML source, i know the jpeg file is http://admin:admin@10.42.0.53:8081/video.
In browser, i can see the picture of http://admin:admin@10.42.0.53:8081/video changing swiftly.

ref http://stackoverflow.com/questions/5968508/problem-with-python-and-ip-camera, i code this

------------------python code-------
import sys
import cv
 
video="http://admin:admin@10.42.0.53:8081/video"
capture =cv.CaptureFromFile(video)
cv.NamedWindow('Video Stream', 1 )
while True:
  # capture the current frame
  frame = cv.QueryFrame(capture)
  if frame is None:
    break
  else:
    #detect(frame)
    cv.ShowImage('Video Stream', frame)
  if k == 0x1b: # ESC
    print 'ESC pressed. Exiting ...'
    break

-------------------------------------

But failure. Nothing show in the windows. Can you help me? thank you.
Loading...