Deepstream 5.0 adding CSI camera support in C++ in the deepstream-nvdsanalytics-test app

Hi, I am working on Jetson nano, with deepstream 5.0, jetpack 4.4 dp, tensorrt 7.1.

I would like to be able to feed the inference, tracking and counting pipeline of the ‘‘deepstream-nvdsanalytics-test’’ C++ app with a CSI camera instead of the native RTSP support or local video files. How can I modify the original C++ program ? Could it read a kind of [source0] … in the config file.txt such as some of the other sample apps ? Thanks

Hi,
You may refer to sources/apps/apps-common/src/deepstream_source_bin.c::create_camera_source_bin
for how to create CSI camera source.

Hi,
Thanks for your reply,

how can I declare NvDsSrcBin ? Sorry I am complete beginner in C++

deepstream_nvdsanalytics_test.cpp:399:47: error: ‘NvDsSrcBin’ has not been declared
set_camera_csi_params (GSliceConfig * config, NvDsSrcBin * bin)
^~~~~~~~~~

You do not need this struct to create camera source element in dsanalytics sample. you just need check in create_camera_source_bin how case NV_DS_SOURCE_CAMERA_CSI implemented.

Tried to implement the same way as the create_camera_source_bin, got that log :

g++ -c -o deepstream_nvdsanalytics_test.o -DPLATFORM_TEGRA -I…/…/…/includes pkg-config --cflags gstreamer-1.0 deepstream_nvdsanalytics_test.cpp
deepstream_nvdsanalytics_test.cpp:69:27: error: ‘NvDsSourceConfig’ was not declared in this scope
create_camera_source_bin (NvDsSourceConfig * config, NvDsSrcBin * bin)
^~~~~~~~~~~~~~~~
deepstream_nvdsanalytics_test.cpp:69:27: note: suggested alternative: ‘GSliceConfig’
create_camera_source_bin (NvDsSourceConfig * config, NvDsSrcBin * bin)
^~~~~~~~~~~~~~~~
GSliceConfig
deepstream_nvdsanalytics_test.cpp:69:46: error: ‘config’ was not declared in this scope
create_camera_source_bin (NvDsSourceConfig * config, NvDsSrcBin * bin)
^~~~~~
deepstream_nvdsanalytics_test.cpp:69:46: note: suggested alternative: ‘cosf64’
create_camera_source_bin (NvDsSourceConfig * config, NvDsSrcBin * bin)
^~~~~~
cosf64
deepstream_nvdsanalytics_test.cpp:69:54: error: ‘NvDsSrcBin’ was not declared in this scope
create_camera_source_bin (NvDsSourceConfig * config, NvDsSrcBin * bin)
^~~~~~~~~~
deepstream_nvdsanalytics_test.cpp:69:67: error: ‘bin’ was not declared in this scope
create_camera_source_bin (NvDsSourceConfig * config, NvDsSrcBin * bin)
^~~
deepstream_nvdsanalytics_test.cpp:69:67: note: suggested alternative: ‘sin’
create_camera_source_bin (NvDsSourceConfig * config, NvDsSrcBin * bin)
^~~
sin
deepstream_nvdsanalytics_test.cpp:69:70: error: expression list treated as compound expression in initializer [-fpermissive]
create_camera_source_bin (NvDsSourceConfig * config, NvDsSrcBin * bin)
^
deepstream_nvdsanalytics_test.cpp: In function ‘int main(int, char**)’:
deepstream_nvdsanalytics_test.cpp:458:29: error: ‘NvDsSourceConfig’ was not declared in this scope
create_camera_source_bin (NvDsSourceConfig * config, NvDsSrcBin * bin)
^~~~~~~~~~~~~~~~
deepstream_nvdsanalytics_test.cpp:458:29: note: suggested alternative: ‘GSliceConfig’
create_camera_source_bin (NvDsSourceConfig * config, NvDsSrcBin * bin)
^~~~~~~~~~~~~~~~
GSliceConfig
deepstream_nvdsanalytics_test.cpp:458:48: error: ‘config’ was not declared in this scope
create_camera_source_bin (NvDsSourceConfig * config, NvDsSrcBin * bin)
^~~~~~
deepstream_nvdsanalytics_test.cpp:458:48: note: suggested alternative: ‘cosf64’
create_camera_source_bin (NvDsSourceConfig * config, NvDsSrcBin * bin)
^~~~~~
cosf64
deepstream_nvdsanalytics_test.cpp:458:56: error: ‘NvDsSrcBin’ was not declared in this scope
create_camera_source_bin (NvDsSourceConfig * config, NvDsSrcBin * bin)
^~~~~~~~~~
deepstream_nvdsanalytics_test.cpp:458:69: error: ‘bin’ was not declared in this scope
create_camera_source_bin (NvDsSourceConfig * config, NvDsSrcBin * bin)
^~~
deepstream_nvdsanalytics_test.cpp:458:69: note: suggested alternative: ‘sin’
create_camera_source_bin (NvDsSourceConfig * config, NvDsSrcBin * bin)
^~~
sin
deepstream_nvdsanalytics_test.cpp:458:72: error: ‘create_camera_source_bin’ cannot be used as a function
create_camera_source_bin (NvDsSourceConfig * config, NvDsSrcBin * bin)
^
Makefile:56: recipe for target ‘deepstream_nvdsanalytics_test.o’ failed
make: *** [deepstream_nvdsanalytics_test.o] Error 1

You do not need to use create_camera_source_bin, it’s called by deepstream-app, you just need the logic within the function.