Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #38869 > unrolled thread

OpenCV and WIFI IP Camera Issue

Started bySam Berry <sambez_14@hotmail.co.uk>
First post2013-02-14 09:25 -0800
Last post2013-02-14 18:12 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  OpenCV and WIFI IP Camera Issue Sam Berry <sambez_14@hotmail.co.uk> - 2013-02-14 09:25 -0800
    Re: OpenCV and WIFI IP Camera Issue MRAB <python@mrabarnett.plus.com> - 2013-02-14 18:12 +0000

#38869 — OpenCV and WIFI IP Camera Issue

FromSam Berry <sambez_14@hotmail.co.uk>
Date2013-02-14 09:25 -0800
SubjectOpenCV and WIFI IP Camera Issue
Message-ID<66afe6f9-c89f-4944-8102-57bae76c358d@googlegroups.com>
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

[toc] | [next] | [standalone]


#38873

FromMRAB <python@mrabarnett.plus.com>
Date2013-02-14 18:12 +0000
Message-ID<mailman.1773.1360865533.2939.python-list@python.org>
In reply to#38869
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.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web