OpenCV and WIFI IP Camera Issue

Discussion in 'Python' started by Sam Berry, Feb 14, 2013.

  1. Sam Berry

    Sam Berry Guest

    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.

    Thanks, Sam
    Sam Berry, Feb 14, 2013
    #1
    1. Advertising

  2. Sam Berry

    MRAB Guest

    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.
    MRAB, Feb 14, 2013
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Selie Peter

    select WiFi interface in Java

    Selie Peter, Feb 27, 2006, in forum: Java
    Replies:
    0
    Views:
    378
    Selie Peter
    Feb 27, 2006
  2. Newbie
    Replies:
    6
    Views:
    465
    The Artist Formerly Known as Kap'n Salty
    Feb 2, 2005
  3. Replies:
    14
    Views:
    667
    Paul Boddie
    Dec 2, 2005
  4. chen selina
    Replies:
    0
    Views:
    692
    chen selina
    Jul 7, 2010
  5. Pola
    Replies:
    1
    Views:
    104
    Jeff Cochran
    Jun 29, 2004
Loading...

Share This Page