Python 来自子流程的opencv标准输入
我试图运行一个子流程命令,捕获标准输出并将其导入opencv。我发现了一个使用numpy的例子,我想知道这是否是最好的方法。。。到目前为止我一点运气都没有。我就在这里:Python 来自子流程的opencv标准输入,python,opencv,Python,Opencv,我试图运行一个子流程命令,捕获标准输出并将其导入opencv。我发现了一个使用numpy的例子,我想知道这是否是最好的方法。。。到目前为止我一点运气都没有。我就在这里: result = subprocess.run(["gphoto2", "--capture-movie", "--stdout"], stdout=subprocess.PIPE) array = numpy.frombuffer(result.stdout, dtype='uint8') img = cv2.imdeco
result = subprocess.run(["gphoto2", "--capture-movie", "--stdout"],
stdout=subprocess.PIPE)
array = numpy.frombuffer(result.stdout, dtype='uint8')
img = cv2.imdecode(array, 1)
cv2.imshow("window", img)
cv2.waitKey()
这就好像它在第一步就被挂起一样——它是否必须被推到一个线程上,这样它才能进入下一步