1

I'm working on a project in which a picamera records to stdout. I'm adding object detection to the video and need to write these frames to stdout in h264. So far I've got this:

for frame in self.camera.capture_continuous(rawCapture, format="bgr",use_video_port=True):
    #while True:

        # grab the raw NumPy array representing the image, then 
        # initialize the timestamp and occupied/unoccupied text
        frame = frame.array

        if frame is None:
            break

        object_detector_frame = self.object_detector.draw_boxes(frame)
        
        sys.stdout.write(object_detector_frame.tostring())
        #writer.write(frame)
        rawCapture.truncate(0)

CV2's video writer doesn't seem to be able to write bytes straight to stdout.

Thanks in advance.

Louis
  • 40
  • 8

0 Answers0