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
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
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
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.
[url]https://devtalk.nvidia.com/default/topic/999381/[/url]
thanks
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.
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?
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.