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

Kane

  • Newbie
  • *
  • Posts: 3
    • 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:[email protected]' 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: 36
    • 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: 2
    • 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.

Kane

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Accessing the live feed of the camera using Python and OpenCV
« Reply #3 on: January 31, 2023, 09:02:44 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.

Thank you Jan, it seems good but does not seem to work. What package do you use for "from component.base_component import BaseComponent" as everything I download does not work and removing it does not help either. Thanks sorry it's been a long reply

jan_do

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Accessing the live feed of the camera using Python and OpenCV
« Reply #4 on: February 02, 2023, 05:50:20 AM »
Oh, thats just a abtract class is used. I deleted that part for you.