【发布时间】:2021-12-09 17:58:13
【问题描述】:
我有以下问题: 我们想使用 raspi 相机的输出作为两个不同进程的输入数据。一个通过 RF 链路发送相机数据,另一个应该使用 opencv 进行一些图像处理
像这样:
#read camera stream using raspivid
raspivid_comm = ["raspivid", "-w", str(width), "-h", str(height), "-fps", str(fps), "-b", str(video_bitrate),
"-g", str(keyframerate), "-t", "0"]
raspivid_comm.extend(extraparams.split())
raspivid_comm.extend(["-o", "-"])
raspivid_task = Popen(raspivid_comm, stdout=subprocess.PIPE, stdin=None, stderr=None, close_fds=True,
shell=False, bufsize=0)
其他两个进程应该使用相同的 stout 作为输入
send_task = Popen(send_via_rf, stdout=None, stdin=raspivid_task.stdout , stderr=None, close_fds=True,
shell=False, bufsize=0)
improc_task = Popen(improc, stdout=None, stdin=raspivid_task.stdout , stderr=None, close_fds=True,
shell=False, bufsize=0)
但问题是两个进程(raspivid_task.stdout)读取同一个管道不起作用。 是否有可能在 python 中复制输出管道? 比如命令“tee”?
【问题讨论】:
标签: python image opencv raspberry-pi pipe