驅動JetBot的CSI相機

安裝v4l-utils套件來管理相機

#sudo apt-get install v4l-utils

檢查列出攝影機

#v4l2-ctl --list-devices

攝影機的支援格式

#v4l2-ctl --list-formats-ext

測試相機是否可用,會開啟攝影機並顯示出來

#gst-launch-1.0 nvarguscamerasrc sensor_id=0 ! 'video/x-raw(memory:NVMM),width=3264, height=2464, framerate=21/1, format=NV12' ! nvvidconv flip-method=0 ! 'video/x-raw, width=816, height=616' !  nvvidconv ! nvegltransform ! nveglglessink -e


使用gstreamer驅動相機,使用cv2顯示出來

開啟相機使用OpenCV辨識人臉與眼睛

如果出現「 Failed to create CaptureSession」,可以考慮相機伺服器重新啟動服務

#sudo service nvargus-daemon restart

說明如下:參考網址https://docs.nvidia.com/jetson/l4t/index.html#page/Tegra%20Linux%20Driver%20Package%20Development%20Guide/jetson_xavier_camera_soft_archi.html#wwpID0E0OB0HA

Infinite Timeout Support

This use case is different from typical camera use cases, where the camera sensor streams frames continuously and finite timeouts for the camera driver and associated hardware waiting for camera frames.

In this use case a camera sensor is triggered to generate a specified number of frames, after which it stops streaming indefinitely. Whenever it resumes streaming, the camera driver must resume capturing without timeout issues. The camera driver and hardware must always be ready to capture frames coming from the CSI sensor. Since the camera driver does not know when streaming will start again, it must wait indefinitely for incoming frames.

To support this use case, the camera sensor hardware module must support suspending and resuming streaming.

To enable this feature, run the camera server (i.e. the nvargus-daemon service) by setting an environment variable:

參考資料https://github.com/JetsonHacksNano/CSI-Camera