LoginSignup
10
7

More than 1 year has passed since last update.

Jetsonで使えるカメラ

Last updated at Posted at 2021-07-01

Jetsonで使えるカメラ

Jetsonを購入したはいいが、いったいどのカメラが対応していて、どのカメラが対応していないのかが、わからない人は多いのではないでしょうか? Jetsonに接続できるカメラは、CSI端子のカメラとUSB端子のカメラに集約されます。

CSI端子のカメラ

CSI端子のカメラは、SONYのIMX219搭載のものが標準で対応しています。それ以外のカメラは、Driver周りを独自にインストールする必要があり、茨の道です。

IMX219搭載のカメラが、世の中にはたくさんあるので、そこから選択するといいでしょう。RaspberryPi Camera V2などもIMX219が搭載されています。

USB端子のカメラ

USBカメラの場合は、USB-UVCに対応したものの多くが使用できます。したがって、USBカメラならほとんどがJetsonに接続できるでしょう。 

USBカメラを取り込むポイントとして、GStreamerのv4l2srcを使って取り込みます。この取り込み時のパラメーター調整で多くのカメラを対応させる事が可能です。

sudo apt install v4l-utils 

接続されているカメラ一覧を表示するには、下記のコマンドを使います。

v4l2-ctl --list-device 

カメラのパラメーターを取得するには、下記のコマンドを使います。

v4l2-ctl -d /dev/video0 --list-formats-ext

Logitech C270n

logi.jpg

v4l2-ctl -d /dev/video0 --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
    Index       : 0
    Type        : Video Capture
    Pixel Format: 'YUYV'
    Name        : YUYV 4:2:2
        Size: Discrete 640x480
            Interval: Discrete 0.033s (30.000 fps)
            Interval: Discrete 0.040s (25.000 fps)
            Interval: Discrete 0.050s (20.000 fps)
            Interval: Discrete 0.067s (15.000 fps)
            Interval: Discrete 0.100s (10.000 fps)
            Interval: Discrete 0.200s (5.000 fps)
...
        Size: Discrete 1280x720
            Interval: Discrete 0.133s (7.500 fps)
            Interval: Discrete 0.200s (5.000 fps)
        Size: Discrete 1280x960
            Interval: Discrete 0.133s (7.500 fps)
            Interval: Discrete 0.200s (5.000 fps)

    Index       : 1
    Type        : Video Capture
    Pixel Format: 'MJPG' (compressed)
    Name        : Motion-JPEG
        Size: Discrete 640x480
            Interval: Discrete 0.033s (30.000 fps)
            Interval: Discrete 0.040s (25.000 fps)
            Interval: Discrete 0.050s (20.000 fps)
            Interval: Discrete 0.067s (15.000 fps)
            Interval: Discrete 0.100s (10.000 fps)
            Interval: Discrete 0.200s (5.000 fps)
...
        Size: Discrete 1280x720
            Interval: Discrete 0.033s (30.000 fps)
            Interval: Discrete 0.040s (25.000 fps)
            Interval: Discrete 0.050s (20.000 fps)
            Interval: Discrete 0.067s (15.000 fps)
            Interval: Discrete 0.100s (10.000 fps)
            Interval: Discrete 0.200s (5.000 fps)
        Size: Discrete 1280x960
            Interval: Discrete 0.033s (30.000 fps)
            Interval: Discrete 0.040s (25.000 fps)
            Interval: Discrete 0.050s (20.000 fps)
            Interval: Discrete 0.067s (15.000 fps)
            Interval: Discrete 0.100s (10.000 fps)
            Interval: Discrete 0.200s (5.000 fps)

Logitech C270nは、フォーマットがYUYVとMJPEGに対応しています。

YUYVで 640x480 30fpsで取り込んで画面に表示

gst-launch-1.0 v4l2src device="/dev/video0" ! \
'video/x-raw, width=640, height=480, framerate=30/1' ! \
videoconvert ! \
nv3dsink

MJPEGで 1280x720 30fpsで取り込んで画面に表示

gst-launch-1.0 v4l2src device="/dev/video0" ! \
'image/jpeg, width=1280, height=720, framerate=30/1' ! \
jpegdec ! \
nv3dsink

BUFFALO BSWHD06MWH

buffalo.jpg

v4l2-ctl -d /dev/video0 --list-formats-ext

BUFFALO BSWHD06MWHも、フォーマットがYUYVとMJPEGに対応しています。

YUYVで 640x480 30fpsで取り込んで画面に表示

gst-launch-1.0 v4l2src device="/dev/video0" ! \
'video/x-raw, width=640, height=480, framerate=30/1' ! \
videoconvert ! \
nv3dsink

MJPEGで 1280x720 30fpsで取り込んで画面に表示

gst-launch-1.0 v4l2src device="/dev/video0" ! \
'image/jpeg, width=1280, height=720, framerate=30/1' ! \
jpegdec ! \
nv3dsink

ELECON OCAM-VRU01BK

elecom.png

ELECOMのスマフォ用の360度もつないでテスト

v4l2-ctl -d /dev/video0 --list-formats-ext

ioctl: VIDIOC_ENUM_FMT
    Index       : 0
    Type        : Video Capture
    Pixel Format: 'MJPG' (compressed)
    Name        : Motion-JPEG
        Size: Discrete 1472x736
            Interval: Discrete 0.033s (30.000 fps)
        Size: Discrete 2176x1088
            Interval: Discrete 0.033s (30.000 fps)
        Size: Discrete 3008x1504
            Interval: Discrete 0.033s (30.000 fps)

    Index       : 1
    Type        : Video Capture
    Pixel Format: 'H264' (compressed)
    Name        : H.264
        Size: Discrete 1920x960
            Interval: Discrete 0.033s (30.000 fps)
            Interval: Discrete 0.042s (24.000 fps)
            Interval: Discrete 0.050s (20.000 fps)
        Size: Discrete 2560x1280
            Interval: Discrete 0.033s (30.000 fps)
            Interval: Discrete 0.042s (24.000 fps)
            Interval: Discrete 0.050s (20.000 fps)

MJPEG, 1472x636 30fpsで取り込み

gst-launch-1.0 v4l2src device="/dev/video0" ! \
'image/jpeg, width=1472, height=736, framerate=30/1' ! \
jpegdec ! \
nv3dsink

H264、1920x960 30fpsで取り込み(速度がでない?)

gst-launch-1.0 v4l2src device="/dev/video0" io-mode=2 ! \
'video/x-h264, width=1920, height=960, framerate=30/1' ! \
queue ! \
nvv4l2decoder !  \
nv3dsink

Insta 360 AIR

instra360_2.jpeg

Insta 360 AIRとELECON OCAM-VRU01BKは中身は同じっぽい?

v4l2-ctl -d /dev/video0 --list-formats-ext

ioctl: VIDIOC_ENUM_FMT
    Index       : 0
    Type        : Video Capture
    Pixel Format: 'MJPG' (compressed)
    Name        : Motion-JPEG
        Size: Discrete 1472x736
            Interval: Discrete 0.033s (30.000 fps)
        Size: Discrete 2176x1088
            Interval: Discrete 0.033s (30.000 fps)
        Size: Discrete 3008x1504
            Interval: Discrete 0.033s (30.000 fps)

    Index       : 1
    Type        : Video Capture
    Pixel Format: 'H264' (compressed)
    Name        : H.264
        Size: Discrete 1920x960
            Interval: Discrete 0.033s (30.000 fps)
            Interval: Discrete 0.042s (24.000 fps)
            Interval: Discrete 0.050s (20.000 fps)
        Size: Discrete 2560x1280
            Interval: Discrete 0.033s (30.000 fps)
            Interval: Discrete 0.042s (24.000 fps)
            Interval: Discrete 0.050s (20.000 fps)

MJPEG, 1472x636 30fpsで取り込み

gst-launch-1.0 v4l2src device="/dev/video0" ! \
'image/jpeg, width=1472, height=736, framerate=30/1' ! \
jpegdec ! \
nv3dsink

H264、1920x960 30fpsで取り込み(速度がでない?)

gst-launch-1.0 v4l2src device="/dev/video0" io-mode=2 ! \
'video/x-h264, width=1920, height=960, framerate=30/1' ! \
queue ! \
nvv4l2decoder !  \
nv3dsink

Jiusion Digital Microscope

micro.png

Amazonで売っている安いUSB-UVC対応の顕微鏡。

v4l2-ctl -d /dev/video0 --list-formats-ext

ioctl: VIDIOC_ENUM_FMT
    Index       : 0
    Type        : Video Capture
    Pixel Format: 'YUYV'
    Name        : YUYV 4:2:2
        Size: Discrete 640x480
            Interval: Discrete 0.040s (25.000 fps)
        Size: Discrete 160x120
            Interval: Discrete 0.040s (25.000 fps)
        Size: Discrete 176x144
            Interval: Discrete 0.040s (25.000 fps)
        Size: Discrete 320x240
            Interval: Discrete 0.040s (25.000 fps)
        Size: Discrete 352x288
            Interval: Discrete 0.040s (25.000 fps)
        Size: Discrete 640x480
            Interval: Discrete 0.040s (25.000 fps)

YUYVのみサポート

gst-launch-1.0 v4l2src device="/dev/video0" ! \
'video/x-raw, width=640, height=480, framerate=25/1' ! \
videoconvert ! \
nv3dsink

USB Scope

scope2.png

v4l2-ctl -d /dev/video0 --list-formats-ext

ioctl: VIDIOC_ENUM_FMT
    Index       : 0
    Type        : Video Capture
    Pixel Format: 'MJPG' (compressed)
    Name        : Motion-JPEG
        Size: Discrete 640x480
            Interval: Discrete 0.033s (30.000 fps)
        Size: Discrete 352x288
            Interval: Discrete 0.033s (30.000 fps)
        Size: Discrete 320x240
            Interval: Discrete 0.033s (30.000 fps)
        Size: Discrete 176x144
            Interval: Discrete 0.033s (30.000 fps)
        Size: Discrete 160x120
            Interval: Discrete 0.033s (30.000 fps)
        Size: Discrete 960x540
            Interval: Discrete 0.033s (30.000 fps)
        Size: Discrete 1024x768
            Interval: Discrete 0.033s (30.000 fps)
        Size: Discrete 1280x720
            Interval: Discrete 0.033s (30.000 fps)
        Size: Discrete 1280x960
            Interval: Discrete 0.033s (30.000 fps)

    Index       : 1
    Type        : Video Capture
    Pixel Format: 'YUYV'
    Name        : YUYV 4:2:2
        Size: Discrete 640x480
            Interval: Discrete 0.033s (30.000 fps)
        Size: Discrete 352x288
            Interval: Discrete 0.033s (30.000 fps)
        Size: Discrete 320x240
            Interval: Discrete 0.033s (30.000 fps)
        Size: Discrete 176x144
            Interval: Discrete 0.033s (30.000 fps)
        Size: Discrete 160x120
            Interval: Discrete 0.033s (30.000 fps)

MJPEG

gst-launch-1.0 v4l2src device="/dev/video0" ! \
'image/jpeg, width=1280, height=720, framerate=30/1' ! \
jpegdec ! \
nv3dsink

H264

gst-launch-1.0 v4l2src device="/dev/video0" ! \
'video/x-raw, width=640, height=480, framerate=30/1' ! \
videoconvert ! \
nv3dsink

その他のUSB カメラ

IMX291搭載カメラ, IMX317搭載カメラ, OV4689搭載カメラなどもUSB UVCに対応しているので、Jetsonで動作可能です。

10
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
7