IMX CSI: Difference between revisions

From Variscite Wiki
Line 56: Line 56:
  # gst-launch-1.0 imxv4l2videosrc device=/dev/video1  imx-capture-mode=4 ! imxpxpvideosink
  # gst-launch-1.0 imxv4l2videosrc device=/dev/video1  imx-capture-mode=4 ! imxpxpvideosink


== Testing Camera JPEG Snapshot / Taking Single Picture ==
== Example: Taking a JPEG snapshot from the camera ==
To Capture JPEG snapshot run any of below pipeline depending upon the resolution you want to take picture.
To capture and encode a JPEG snapshot from the camera, run one of the below pipelines depending on the wanted resolution:


* For 640x480:
* For 640x480:
Line 73: Line 73:
* For 2592x1944:
* For 2592x1944:
  # gst-launch-1.0 imxv4l2videosrc device=/dev/video1  imx-capture-mode=4 num-buffers=1 ! jpegenc ! filesink location=/tmp/test.jpg
  # gst-launch-1.0 imxv4l2videosrc device=/dev/video1  imx-capture-mode=4 num-buffers=1 ! jpegenc ! filesink location=/tmp/test.jpg
Note:<br>
The jpegenc gstreamer element is an open-source software jpeg encoder.<br>
It encodes the images using the CPU, without utilizing the JPEG hardware acceleration.

Revision as of 11:57, 5 October 2018

VAR-SOM-MX7 - Camera

Testing our MIPI cameras

Before you start any of below pipeline make sure you have camera connected. IMX family of processor uses gstreamer as multimedia framework. Please refer to https://gstreamer.freedesktop.org/

Camera Probe

Run below command to see if you have got the camera detected

# v4l2-ctl --list-devices

This should output below

i.MX6S_CSI (platform:30710000.csi):
        /dev/video1

pxp (pxp_v4l2_out):
        /dev/video0

As you can see above i.MX6S_CSI (platform:30710000.csi): is camera and pxp (pxp_v4l2_out): pixel procesing engine for overlay on display

How to check whether I have the right camera stack / gstreamer plugin installed on my filesystem ?

Checking whether you have got the imx platform plugins installed on your filesystem: Run below command to check whether you have the IMX platform specific gstreamer plugin installed or not.

# gst-inspect-1.0  | grep "imx"
imxpxp:  imxpxpvideotransform: Freescale PxP video transform
imxpxp:  imxpxpvideosink: Freescale PxP video sink
imxv4l2videosrc:  imxv4l2videosrc: V4L2 CSI Video Source
imxaudio:  imxmp3audioenc: Freescale i.MX MP3 encoder
imxaudio:  imxuniaudiodec: Freescale i.MX uniaudio decoder
  • imxv4l2videosrc: is the IMX family CSI camera v4l2 community plugin. Currently devkits only supports OV5640 as YUV input.

where sensor process incoming light and converts it to YUV 4:2:2 format data. MIPI data is captured by the MIPI CSI input of the devkit. Bayer processing not supported.

Testing Camera Loopback / Camera Preview on Display

The below pipelines are suitable for the fslc based Yocto releases for the VAR-SOM-MX7 (Yocto Morty and newer).

  • For 640x480@30fps:
# gst-launch-1.0 imxv4l2videosrc device=/dev/video1  imx-capture-mode=0 ! imxpxpvideosink
  • For 720x480@30fps:
# gst-launch-1.0 imxv4l2videosrc device=/dev/video1  imx-capture-mode=1 ! imxpxpvideosink
  • For 1280x720@30fps :
# gst-launch-1.0 imxv4l2videosrc device=/dev/video1  imx-capture-mode=2 ! imxpxpvideosink
  • For 1920x1080@30fps:
# gst-launch-1.0 imxv4l2videosrc device=/dev/video1  imx-capture-mode=3 ! imxpxpvideosink
  • For 2592x1944@15fps:
# gst-launch-1.0 imxv4l2videosrc device=/dev/video1  imx-capture-mode=4 ! imxpxpvideosink

Example: Taking a JPEG snapshot from the camera

To capture and encode a JPEG snapshot from the camera, run one of the below pipelines depending on the wanted resolution:

  • For 640x480:
# gst-launch-1.0 imxv4l2videosrc device=/dev/video1  imx-capture-mode=0 num-buffers=1 ! jpegenc ! filesink location=/tmp/test.jpg
  • For 720x480:
# gst-launch-1.0 imxv4l2videosrc device=/dev/video1  imx-capture-mode=1 num-buffers=1 ! jpegenc ! filesink location=/tmp/test.jpg
  • For 1280x720:
# gst-launch-1.0 imxv4l2videosrc device=/dev/video1  imx-capture-mode=2 num-buffers=1 ! jpegenc ! filesink location=/tmp/test.jpg
  • For 1920x1080:
# gst-launch-1.0 imxv4l2videosrc device=/dev/video1  imx-capture-mode=3 num-buffers=1 ! jpegenc ! filesink location=/tmp/test.jpg
  • For 2592x1944:
# gst-launch-1.0 imxv4l2videosrc device=/dev/video1  imx-capture-mode=4 num-buffers=1 ! jpegenc ! filesink location=/tmp/test.jpg