Examples on how to use the Jetson Carrier Board camera module?

Hello,

I may have missed something, but there doesn’t seem to be much documentation when it comes to the Jetson Carrier Board’s camera module (shown below).

https://i1.wp.com/www.technobyte.org/wp-content/uploads/2017/04/Jetson-TX2-camera-module-e1490989742820.jpg

For reference, the TX2 documentation shows that the camera connector having the following signals:
CSI, 2-lane x6
CAM I2C
CAM MCLK x4
GPIOs/Control

Is there an existing API, Linux utility, or sample code to receive an input stream from this particular camera module?

Thanks!

You can access the onboard camera in several ways.

With gstreamer : You have to build a pipeline from your source to your sink through different plugins such as codecs.
Here is a basic pipe for reading your camera and view it in a GUI window

gst-launch-1.0 nvcamerasrc ! 'video/x-raw(memory:NVMM), width=640, height=480, framerate=30/1, format=NV12' ! nvvidconv flip-method=2 ! nvegltransform ! nveglglessink -e

Here nvvidconv flip-method=2 rotates 180° (image is natively updside down)

With tegra multimedia API: have a look to samples in /home/ubuntu/tegra_multimedia_api/samples

Thank you!

Tegra Multimedia API’s won’t work.
Has anyone had a luck with execution of sample 12:
Example:
./camera_v4l2_cuda -d /dev/video0 -s 640x480 -f YUYV -n 30 -c
?

hello Andrey1984,

please refer to the L4T Multimedia API Reference, camera_v4l2_cuda only support V4L2 Camera, USB or YUV Camera with the format YUYV/YVYU/UYVY/VYUY.
default Jetson carrier board camera module is a bayer sensor, please using usb-camera for this example instead, thanks

is there a way to run:
5_simulations OceanFFT?
How should it be compiled?
drwxr-xr-x 2 nvidia nvidia 4096 Apr 24 10:44 data/
drwxr-xr-x 2 nvidia nvidia 4096 Apr 24 10:44 doc/
-rw-r–r-- 1 nvidia nvidia 6784 Apr 24 10:46 findgllib.mk
-rw-r–r-- 1 nvidia nvidia 9682 Apr 24 10:46 Makefile
-rw-r–r-- 1 nvidia nvidia 3069 Apr 24 10:46 NsightEclipse.xml
-rw-r–r-- 1 nvidia nvidia 26585 Apr 24 10:46 oceanFFT.cpp
-rw-r–r-- 1 nvidia nvidia 4891 Apr 24 10:46 oceanFFT_kernel.cu
-rw-r–r-- 1 nvidia nvidia 32616 Apr 24 10:44 oceanFFT_kernel.o
-rw-r–r-- 1 nvidia nvidia 203 Apr 24 10:46 readme.txt

nvidia@tegra-ubuntu:~/NVIDIA_CUDA-8.0_Samples/5_Simulations/oceanFFT$ nvcc oceanFFT_kernel.cu 
nvcc warning : The 'compute_20', 'sm_20', and 'sm_21' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
/usr/lib/gcc/aarch64-linux-gnu/5/../../../aarch64-linux-gnu/crt1.o: In function `_start':
(.text+0x30): undefined reference to `main'
collect2: error: ld returned 1 exit status
nvidia@tegra-ubuntu:~/NVIDIA_CUDA-8.0_Samples/5_Simulations/oceanFFT$ make
/usr/local/cuda-8.0/bin/nvcc -ccbin g++ -I../../common/inc  -m64    -gencode arch=compute_53,code=sm_53 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_62,code=sm_62 -gencode arch=compute_62,code=compute_62 -o oceanFFT.o -c oceanFFT.cpp
oceanFFT.cpp: In function ‘void display()’:
oceanFFT.cpp:522:5: error: reference to ‘glClientActiveTexture’ is ambiguous
     glClientActiveTexture(GL_TEXTURE0);
     ^
In file included from ../../common/inc/helper_gl.h:23:0,
                 from oceanFFT.cpp:37:
/usr/include/GL/gl.h:1825:23: note: candidates are: void glClientActiveTexture(GLenum)
 GLAPI void GLAPIENTRY glClientActiveTexture( GLenum texture );
                       ^
In file included from oceanFFT.cpp:37:0:
../../common/inc/helper_gl.h:107:17: note:                 void (* __HelperGL::glClientActiveTexture)(GLenum)
     USE_GL_FUNC(glClientActiveTexture, PFNGLACTIVETEXTUREPROC);
                 ^
../../common/inc/helper_gl.h:45:44: note: in definition of macro ‘USE_GL_FUNC’
     #define USE_GL_FUNC(name, proto) proto name = (proto) glXGetProcAddress ((c
                                            ^
oceanFFT.cpp:527:5: error: reference to ‘glClientActiveTexture’ is ambiguous
     glClientActiveTexture(GL_TEXTURE1);
     ^
In file included from ../../common/inc/helper_gl.h:23:0,
                 from oceanFFT.cpp:37:
/usr/include/GL/gl.h:1825:23: note: candidates are: void glClientActiveTexture(GLenum)
 GLAPI void GLAPIENTRY glClientActiveTexture( GLenum texture );
                       ^
In file included from oceanFFT.cpp:37:0:
../../common/inc/helper_gl.h:107:17: note:                 void (* __HelperGL::glClientActiveTexture)(GLenum)
     USE_GL_FUNC(glClientActiveTexture, PFNGLACTIVETEXTUREPROC);
                 ^
../../common/inc/helper_gl.h:45:44: note: in definition of macro ‘USE_GL_FUNC’
     #define USE_GL_FUNC(name, proto) proto name = (proto) glXGetProcAddress ((c
                                            ^
oceanFFT.cpp:579:5: error: reference to ‘glClientActiveTexture’ is ambiguous
     glClientActiveTexture(GL_TEXTURE0);
     ^
In file included from ../../common/inc/helper_gl.h:23:0,
                 from oceanFFT.cpp:37:
/usr/include/GL/gl.h:1825:23: note: candidates are: void glClientActiveTexture(GLenum)
 GLAPI void GLAPIENTRY glClientActiveTexture( GLenum texture );
                       ^
In file included from oceanFFT.cpp:37:0:
../../common/inc/helper_gl.h:107:17: note:                 void (* __HelperGL::glClientActiveTexture)(GLenum)
     USE_GL_FUNC(glClientActiveTexture, PFNGLACTIVETEXTUREPROC);
                 ^
../../common/inc/helper_gl.h:45:44: note: in definition of macro ‘USE_GL_FUNC’
     #define USE_GL_FUNC(name, proto) proto name = (proto) glXGetProcAddress ((c
                                            ^
oceanFFT.cpp:581:5: error: reference to ‘glClientActiveTexture’ is ambiguous
     glClientActiveTexture(GL_TEXTURE1);
     ^
In file included from ../../common/inc/helper_gl.h:23:0,
                 from oceanFFT.cpp:37:
/usr/include/GL/gl.h:1825:23: note: candidates are: void glClientActiveTexture(GLenum)
 GLAPI void GLAPIENTRY glClientActiveTexture( GLenum texture );
                       ^
In file included from oceanFFT.cpp:37:0:
../../common/inc/helper_gl.h:107:17: note:                 void (* __HelperGL::glClientActiveTexture)(GLenum)
     USE_GL_FUNC(glClientActiveTexture, PFNGLACTIVETEXTUREPROC);
                 ^
../../common/inc/helper_gl.h:45:44: note: in definition of macro ‘USE_GL_FUNC’
     #define USE_GL_FUNC(name, proto) proto name = (proto) glXGetProcAddress ((c
                                            ^
Makefile:270: recipe for target 'oceanFFT.o' failed
make: *** [oceanFFT.o] Error 1

hello Andrey1984,

since you met the building failure for OceanFFT, which is an extend issue here.
i would suggest you to initial a new topic with CUDA example building failure.
BTW, here’s patch to fix the OceanFFT compiler failure for your reference.
https://devtalk.nvidia.com/default/topic/999381/
thanks

Hi JerryChang.
Thank you for your update.
I am just wondering if there is a chance to use the camera with hangouts\webskype.

That depends on what hangouts or webskype (or the browsers that run them) demand of the camera.
If they are written to work okay with Bayer-style sensor data (as in, they insert the appropriate conversion code) then that should work.
If they don’t, it won’t.

I’m reviving this thread, since I have some issues using the onboard camera module. I can succesfully get a stream by running:

gst-launch-1.0 nvcamerasrc ! 'video/x-raw(memory:NVMM), width=640, height=480, framerate=30/1, format=NV12' ! nvvidconv flip-method=2 ! nvegltransform ! nveglglessink -e

But I’m not capable of watching the stream with python, I have not installed the opencv4tegra, but instead used jetsonhacks opencv script, where failed to flag gstreamer to begin with, but afterwards went in cmake-gui and flagged it and “sudo make install” afterwards, so that should work now.

Could anyone please provide a step-by-step on how to get opencv and the onboard camera to work with tx2?

For example of using onboard camera with gstreamer in opencv, you may have a look to https://devtalk.nvidia.com/default/topic/1001696/jetson-tx1/failed-to-open-tx1-on-board-camera/post/5117370/#5117370.

When i run that code, it successfully compile, but it says “Failed to open camera.”

If it fails to open camera, maybe the opencv version found by the linker doesn’t have gstreamer support. Have you built and installed your own opencv library enabling gstreamer-1.0 support ?
Do you still have opencv4tegra installed ?

You may also add

putenv("GST_DEBUG=*:3");

before cv::VideoCapture cap(gst) to see if gstreamer is invoked and its messages, although these are not easy to understand.