我正在使用PiCam获取视频流,但是想尝试将该流传输到C++进行处理。
Python代码:
Python代码:
import time
import picamera
import picamera.array
import cv2
with picamera.PiCamera() as camera:
camera.start_preview()
time.sleep(2)
with picamera.array.PiRGBArray(camera) as stream:
camera.capture(stream, format='bgr')
# At this point the image is available as stream.array
image = stream.array
那么,在我的.cpp文件中该怎么做呢? 我一直在研究boost::python,但他们的文档很烂。
将numpy数组发送是否比在Python代码中直接转换为Cv.Mat并从C++调用它有任何好处吗? 像这样。
有任何问题吗? 非常感谢您的帮助!
编辑:忘记提到了,已经尝试过this,但没有成功。 现在找到了pyopencv_to()和pyopencv_from(),但不确定如何使用?抱歉,我是新手。 (会链接上面的pyopencv_,但不能发布超过两个链接。)