kdb355: IMX274 setup with OpenCV on Connect Tech Jetson™ Carriers

Introduction

The following is a guide on how to set up the IMX274 MIPI CSI device using OpenCV on Connect Tech Jetson™ carriers.

Setup

Prerequisites

Gstreamer

  • sudo apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
  • Grab remaining GST plugins using the following:
    • sudo apt-get install gstreamer1.0-plugins*

GTK

  • sudo apt-get install libgtk2.0-dev

CMake

  • sudo apt-get install cmake

OpenCV

You may compile/build your OpenCV on your TX1 device as this is what will be accomplished in this guide, alternatively you may cross-compile. To acquire the current build of OpenCV, you will need to git clone the repository with the following command.

git clone https://github.com/opencv/opencv.git

When the Git repository is complete, proceed into the OpenCV directory and type the following command:

cmake CMakeLists.txt

This will generate a corresponding make file with all the provided libraries available on your system, please ensure the following is enabled in the final output log:

-- GUI:
-- QT: NO
-- GTK+ 2.x: YES (ver 2.24.30)
-- GThread : YES (ver 2.48.1)
-- GtkGlExt: NO
-- OpenGL support: NO
-- VTK support: NO
--
--
-- Video I/O:
-- GStreamer:
-- base: YES (ver 1.8.3)
-- video: YES (ver 1.8.3)
-- app: YES (ver 1.8.3)
-- riff: YES (ver 1.8.3)
-- pbutils: YES (ver 1.8.3)

When complete you may build and install OpenCV on your TX1 device with the following:

make install -J4

Gstreamer integration

To have the camera input directly into OpenCV when standard capture methods will not function or fail, you will be required to use gstreamer as the capture method to provide a suitable video input for OpenCV.

The following code segment is required to have the IMX274 camera as an input source for OpenCV. If you are using a different camera, this code can be used as a template.

VideoCapture cap("nvcamerasrc ! video/x-raw(memory:NVMM), width=1920, height=1080, format=I420, framerate=30/1 ! nvvidconv flip-method=0 ! video/x-raw, format=I420 ! videoconvert ! video/x-raw, format=BGR ! appsink");

Go to Top