1. Home
  2. Docs
  3. Jetson Cameras
  4. Native Jetson Cameras – IMX219/IMX477
  5. IMX219 – 8MP Camera

IMX219 – 8MP Camera

IMX219 is a 1/4″ 8MP MIPI CSI-2 image sensor, it was adopted by the Raspberry pi V2 camera module back since 2016. Now the IMX219 camera is natively supported by the Jetson Nano and Xavier NX out of the box. Arducam made a lot of variation of this camera to address different use-cases for Jetson fans.

General Specifications

  • Optical Size: 1/4″
  • Resolution: 3280×2464
  • Pixel Size: 1.12um x 1.12um
  • CSI-2 Data Output: 2-lane mode
  • Data Format: Raw Bayer 10bit

Supported Resolution and Frame Rate

Using v4l2-ctl --list-formats-ext command to list the supported resolution and frame rate combination on Jetson.

$ v4l2-ctl --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
	Index       : 0
	Type        : Video Capture
	Pixel Format: 'RG10'
	Name        : 10-bit Bayer RGRG/GBGB
		Size: Discrete 3280x2464
			Interval: Discrete 0.048s (21.000 fps)
		Size: Discrete 3280x1848
			Interval: Discrete 0.036s (28.000 fps)
		Size: Discrete 1920x1080
			Interval: Discrete 0.033s (30.000 fps)
		Size: Discrete 1280x720
			Interval: Discrete 0.017s (60.000 fps)
		Size: Discrete 1280x720
			Interval: Discrete 0.017s (60.000 fps)

IMX219 Camera Module Selection Guide

ModelFeature
IMX219-stock lens (SKU:B0191)Low cost
IMX219-drop-in-replacement (SKU:B0184)Low distortion
IMX219-drop-in-replacement (SKU:B0180)Wide angle 175 diagonal degrees
IMX219-drop-in-replacement (SKU:B0182)Auto focus (visible light)
IMX219-drop-in-replacement (SKU:B0190)Auto focus (IR sensitive)
IMX219 M12 mounts (SKU:B0103)More M12 lens options (visible light)
IMX219 M12 mounts NOIR (SKU:B0152)More M12 lens options (IR sensitive)
IMX219 M12 mounts IRC (SKU:B0154)Both daylight and night vision
IMX219 CS mount NOIR (SKU:B0102More CS lens options (visible light)
IMX219 CS mount NOIR (SKU:B0153)More CS lens options (IR sensitive)
IMX219 PTZ (SKU:B01678MP)Pan/Tilt/Zoom

Examples of command line Gstreamer script

The following GStreamer examples help you to do a quite test on IMX219 for verification purposes. The sensor_id parameter selects the camera: 0 or 1 on Jetson Nano B01/Xavier NX.

$ gst-launch-1.0 nvarguscamerasrc sensor_id=0 ! nvoverlaysink

More specific – width, height and framerate are from supported video modes. Example also shows sensor_mode parameter to nvarguscamerasrc. See below for example video modes of example sensor.

$ DISPLAY=:0.0 gst-launch-1.0 nvarguscamerasrc sensor_id=0 ! \
   'video/x-raw(memory:NVMM),width=3280, height=2464, framerate=21/1, format=NV12' ! \
   nvvidconv flip-method=0 ! 'video/x-raw,width=960, height=720' ! \
   nvvidconv ! nvegltransform ! nveglglessink -e

For some reason, the required resolution doesn’t match with driver settings, you should adjust accordingly. As an example, for 3264×2464 @ 21 fps on sensor_id 1 of a Jetson Nano B01 or Xavier NX:

$ DISPLAY=:0.0 gst-launch-1.0 nvarguscamerasrc sensor_id=1 ! \
   '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

Using the nvvidconv flip-method parameter, it can rotate/flip the image, that is useful when the mounting of the camera with different orientation.

flip-method         : video flip methods
                        flags: readable, writable, controllable
                        Enum "GstNvVideoFlipMethod" Default: 0, "none"
                           (0): none             - Identity (no rotation)
                           (1): counterclockwise - Rotate counter-clockwise 90 degrees
                           (2): rotate-180       - Rotate 180 degrees
                           (3): clockwise        - Rotate clockwise 90 degrees
                           (4): horizontal-flip  - Flip horizontally
                           (5): upper-right-diagonal - Flip across upper right/lower left diagonal
                           (6): vertical-flip    - Flip vertically
                           (7): upper-left-diagonal - Flip across upper left/low

Python Example

The following is the python example grabbed from JetsonHacks.

# MIT License
# Copyright (c) 2019 JetsonHacks
# See license
# Using a CSI camera (such as the Raspberry Pi Version 2) connected to a
# NVIDIA Jetson Nano Developer Kit using OpenCV
# Drivers for the camera and OpenCV are included in the base image

import cv2

# gstreamer_pipeline returns a GStreamer pipeline for capturing from the CSI camera
# Defaults to 1280x720 @ 60fps
# Flip the image by setting the flip_method (most common values: 0 and 2)
# display_width and display_height determine the size of the window on the screen


def gstreamer_pipeline(
    capture_width=1280,
    capture_height=720,
    display_width=1280,
    display_height=720,
    framerate=60,
    flip_method=0,
):
    return (
        "nvarguscamerasrc ! "
        "video/x-raw(memory:NVMM), "
        "width=(int)%d, height=(int)%d, "
        "format=(string)NV12, framerate=(fraction)%d/1 ! "
        "nvvidconv flip-method=%d ! "
        "video/x-raw, width=(int)%d, height=(int)%d, format=(string)BGRx ! "
        "videoconvert ! "
        "video/x-raw, format=(string)BGR ! appsink"
        % (
            capture_width,
            capture_height,
            framerate,
            flip_method,
            display_width,
            display_height,
        )
    )


def show_camera():
    # To flip the image, modify the flip_method parameter (0 and 2 are the most common)
    print(gstreamer_pipeline(flip_method=0))
    cap = cv2.VideoCapture(gstreamer_pipeline(flip_method=0), cv2.CAP_GSTREAMER)
    if cap.isOpened():
        window_handle = cv2.namedWindow("CSI Camera", cv2.WINDOW_AUTOSIZE)
        # Window
        while cv2.getWindowProperty("CSI Camera", 0) >= 0:
            ret_val, img = cap.read()
            cv2.imshow("CSI Camera", img)
            # This also acts as
            keyCode = cv2.waitKey(30) & 0xFF
            # Stop the program on the ESC key
            if keyCode == 27:
                break
        cap.release()
        cv2.destroyAllWindows()
    else:
        print("Unable to open camera")


if __name__ == "__main__":
    show_camera()

Was this article helpful to you? Yes No 1