import cv2 import pyarrow as pa from dora import Node node = Node() # TCP stream URL (replace with your stream URL) # TCP_STREAM_URL = "tcp://192.168.2.1:40922" STREAM_URL = "tcp://192.168.2.1:40921" # TCP_STREAM_URL = "/home/peiji/截图/截图 2024-02-22 10-48-33.png" # Global variables, change it to adapt your needs CAMERA_WIDTH = 1920 CAMERA_HEIGHT = 1080 # Create a VideoCapture object using the TCP stream URL cap = cv2.VideoCapture(STREAM_URL) # Check if the VideoCapture object opened successfully assert cap.isOpened(), "Error: Could not open video capture." # print(cap.isOpened()) while True: # Read a frame from the stream ret, frame = cap.read() if not ret: break # Break the loop when no more frames are available frame = cv2.resize(frame, (CAMERA_WIDTH, CAMERA_HEIGHT)) node.send_output("image", pa.array(frame.ravel())) # Release the VideoCapture object and any OpenCV windows cap.release() cv2.destroyAllWindows()