简体   繁体   English

在Python3中的Jetson xavier上使用tx2 dev-kit CSI摄像机

[英]Using tx2 dev-kit CSI camera on the Jetson xavier in Python3

The only way that I am able to accomplish opening a live camera stream on the Xavier is launching gstreamer from console 我能够在Xavier上打开实时摄像头流的唯一方法是从控制台启动gstreamer

gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM),width=1024, height=768, framerate=120/1, format=NV12' ! nvvidconv flip-method=0 ! nvegltransform ! nveglglessink -e

When i try any video capture command in python or c++ i am constantly getting errors about "camera failed to open" or "video stream type error" Ive tried this in opencv 4, 3.4, 3.3 to no avail. 当我在python或c ++中尝试任何视频捕获命令时,我不断收到有关“相机无法打开”或“视频流类型错误”的错误,我在opencv 4、3.4、3.3中尝试了此操作,但无济于事。

I do not think its that way my opencv build is configured but possibly a way that the xavier camera capture must be instanced. 我不认为它是配置opencv构建的方式,但可能是必须实例化xavier摄像机捕获的方式。 Any type of sample python implementation of live video capture using the tx2 dev-kit camera would be highly helpful? 使用tx2 dev-kit相机进行实时视频捕获的任何类型的示例python实现都会非常有帮助吗?

Thanks 谢谢

You need to access the Jetson camera through the gstreamer api. 您需要通过gstreamer api访问Jetson相机。

C++ example C ++示例

cv::VideoCapture capture("nvarguscamerasrc ! 'video/x-raw(memory:NVMM),width=1024, height=768, framerate=120/1, format=NV12' ! nvvidconv flip-method=0 ! appsink");

or Python 或Python

cap = cv2.VideoCapture('nvarguscamerasrc ! 'video/x-raw(memory:NVMM),width=1024, height=768, framerate=120/1, format=NV12' ! nvvidconv flip-method=0 ! appsink')

However, you might be missing gstreamer from your OpenCv build. 但是,您的OpenCv构建中可能缺少gstreamer。 If this is not working you might need to rebuild your OpenCv with all gstreamer features enabled/dependencies solved. 如果这不起作用,则可能需要在启用所有gstreamer功能/解决依赖关系的情况下重建OpenCv。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM