Author Topic: Accessing the live feed of the camera using Python and OpenCV  (Read 182 times)

Kane

  • Newbie
  • *
  • Posts: 2
    • View Profile
Accessing the live feed of the camera using Python and OpenCV
« on: September 21, 2022, 04:12:03 AM »
I have connected to the camera via the IP address, which has allowed me to use the web application to control the camera and record footage.

However, I want to use OpenCV in Python to use the frames in real-time.

Currently, I use the following code to connect to the camera:

cap = cv2.VideoCapture('rtsp://192.168.110.101')     
   while True:
           ret, frame = cap.read()

And it connects but "frame" is none.

I've seen other posts that use 'rtsp://admin:admin@192.168.110.101' But that makes no difference the frame is always none.

Is this a problem with how the Chronos works or an OpenCV problem?

Thanks :)

Visualtec

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Accessing the live feed of the camera using Python and OpenCV
« Reply #1 on: September 21, 2022, 04:41:10 AM »
I have done a bit with openCV but not with my Chronus, You need to find the IP config for your particular camera. The open frame is because openCV is not talking to the camera. the IP usually contains an IP address and the port you are using . There are 2 main protocols rtsp and http.  rtsp sometimes uses port 554, http uses 80 or 8000 but these can change also there can be user and pass word info like your second example admin admin included if your camera requires them.Then there are different configs on how it reads that information and what number camera it is at the end of the string but these are not always needed. I would be interested in knowing this info too for my camera! If I get a bit of time I will see if I can work it out.

jan_do

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: Accessing the live feed of the camera using Python and OpenCV
« Reply #2 on: November 25, 2022, 06:27:46 AM »
Hello, I had the same problems. Unfortunately I did not find a way to access the livestream directly with OpenCV. I have attached my basic file. I have a class for the REST API comminication and for the livestream images a RTSP class. I have attached the RTSP class. Maybe this will help you. I found a good RTSP library, then it was not difficult.