KronTalk

Chronos => Chronos User Discussion => Topic started by: Kane on May 09, 2022, 02:01:57 AM

Title: Python OpenCV and Chronos
Post by: Kane on May 09, 2022, 02:01:57 AM
I've been trying to connect to Chronos 1.4 camera with OpenCV library using the IP address and micro USB.

Has anyone else had any success using openCV with the camera?

If I want to use Python with the camera should I not be using OpenCV. I did see there was some code on Github but I was unsure if it was a library or example code.

Thanks


 
Title: Re: Python OpenCV and Chronos
Post by: Visualtec on May 19, 2022, 01:38:41 PM
If you treat the camera as a cctv camera you could live view it I think but I don't think it would be at high frame rate.
Try this code

You will need to pip install the CV2 Opencv library

then

import cv2

cap = cv2.VideoCapture('rtsp://USERNAME:PASSWORD @ IP ADDRESS/1')     

while True:

    #print('About to start the Read command')
    ret, frame = cap.read()
    resized_image = cv2.resize(frame, (800, 550))

    #print('About to show frame of Video.')
    cv2.imshow('capture', resized_image)
    #cv2.imshow("Capturing",frame)
    #print('Running..')

    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

cap.release()
cv2.destroyAllWindows()




I've not tried this but will have a look tomorrow if I get chance this should allow you to view the live view on the pc


rtsp://admin:[email protected]:554/1  this is an example of the line of code you need to modify to suit your camera
Use q to kill the window