![]() |
Python IP camera
Hello,
I am using an axis camera and python to do visual tracking. I have a problem with the set up. There is no problem with the code interpreting. This is my first time using an IP camera so i'm not sure if I'm even doing it correctly. Here's my code(spacing is correct on my computer) import numpy as np import cv2 cap = cv2.VideoCapture() cap.open("http://169.254.197.26/") while(cap.isOpened()): # Capture frame-by-frame ret, frame = cap.read() # Our operations on the frame come here print "hi" # Display the resulting frame cv2.imshow('frame',frame) if cv2.waitKey(1) & 0xFF == ord('q'): break # When everything done, release the capture cap.release() cv2.destroyAllWindows() |
Re: Python IP camera
I don't think this code works. If it does then we really over complicated the way we did it.
Code:
cap = cv2.VideoCapture()https://github.com/Frc2481/paul-buny...Camera/main.py |
Re: Python IP camera
Thanks for your reply,
I tried your program but it's missing a library networktables I'm getting this error Traceback (most recent call last): File "C:/Users/Hamza/Pictures/chiefdelphi/main.py", line 5, in <module> from networktables import NetworkTable ImportError: No module named networktables |
Re: Python IP camera
Using it verbatim might not be the best idea. You can extract the portion that actually reads the image from the camera.
Regardless the README for the repo details how to install networktables https://github.com/Frc2481/paul-bunyan |
Re: Python IP camera
Your URL is incorrect, you need to point at the stream page (I forget the particular URL). Additionally, your OpenCV needs to be linked to libav/ffmpeg for open-by-url to work correctly.
I wouldn't recommend doing it that way anyways, as libav/ffmpeg introduces significant latency because of the way that the stream is decoded (as of the last time I checked, which was 2 years ago). |
Re: Python IP camera
We also decided to use an AXIS IP Camera for this years game. For connecting to our IP Camera we used the following code. Just don't forget to change the IP Address that we have to the one of your camera as it is most likely different.
Code:
import cv2 |
| All times are GMT -5. The time now is 10:15. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi