参考にさせていただきました。
https://qiita.com/tsutof/items/2d2248ec098c1b8d3e32
今回で画面が緑色になってしまう問題を解決できるか!
試運転:shellからでは映像が出力できています。
1 |
$ gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM), width=1920, height=1080, format=(string)NV12, framerate=(fraction)30/1' ! nvoverlaysink -e |
Python3から nano_cam_test.py を実行してみるとエラーが出ます。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
import cv2 GST_STR = 'nvarguscamerasrc \ ! video/x-raw(memory:NVMM), width=3280, height=2464, format=(string)NV12, framerate=(fraction)30/1 \ ! nvvidconv ! video/x-raw, width=(int)1920, height=(int)1080, format=(string)BGRx \ ! videoconvert \ ! appsink' WINDOW_NAME = 'Camera Test' def main(): cap = cv2.VideoCapture(GST_STR, cv2.CAP_GSTREAMER) while True: ret, img = cap.read() if ret != True: break cv2.imshow(WINDOW_NAME, img) key = cv2.waitKey(10) if key == 27: # ESC break if __name__ == "__main__": main() |
エラー:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
nak@jetson:~/scripts$ python3 nano_cam_test.py GST_ARGUS: Creating output stream CONSUMER: Waiting until producer is connected... GST_ARGUS: Available Sensor modes : GST_ARGUS: 3264 x 2464 FR = 21.000000 fps Duration = 47619048 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000; GST_ARGUS: 3264 x 1848 FR = 28.000001 fps Duration = 35714284 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000; GST_ARGUS: 1920 x 1080 FR = 29.999999 fps Duration = 33333334 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000; GST_ARGUS: 1280 x 720 FR = 59.999999 fps Duration = 16666667 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000; GST_ARGUS: 1280 x 720 FR = 120.000005 fps Duration = 8333333 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000; Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, threadExecute:243 Stream failed to connect. Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, threadFunction:177 (propagating) (Argus) Error InvalidState: (propagating from src/eglstream/FrameConsumerImpl.cpp, function streamEventThread(), line 135) (Argus) Error InvalidState: (propagating from src/eglstream/FrameConsumerImpl.cpp, function streamEventThreadStatic(), line 177) Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, execute:654 Frame Rate specified is greater than supported Segmentation fault (core dumped) |
たぶん、カメラが対応している解像度と違うからでしょう。
直してみましょう。