2020年12月23日星期三

Read a udp stream in python using open-cv

i have a udp stream of the form

{candidateType: "host", ip: "3.XXX.XXX.XXX", port: XXXXX, priority: XXXXXXXXXX, protocol: "udp",…}

Instead of X, they are actual numbers, i have masked them for security purpose...

i want to read this stream in python using open cv to run machine learning models on it

here is my code so far, it throws the error Couldn't read video stream from file "udp://3.XXX.XXX.XXX:XXXXX"

import cv2    cascPath = 'haarcascade_frontalface_dataset.xml'  # dataset  faceCascade = cv2.CascadeClassifier(cascPath)    video_capture = cv2.VideoCapture('udp://3.235.111.201:15585')      while (video_capture.isOpened()):       # Capture frame-by-frame      _, frame = video_capture.read()      print(_)      print(frame)      cv2.imshow("frame", frame)            if cv2.waitKey(1) & 0xFF == ord('q'):          break    # When everything is done, release the capture  video_capture.release()  cv2.destroyAllWindows()    
https://stackoverflow.com/questions/65433462/read-a-udp-stream-in-python-using-open-cv December 24, 2020 at 11:03AM

没有评论:

发表评论