OpenCV and WIFI IP Camera Issue

S

Sam Berry

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
 
M

MRAB

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top