Two CSI cameras on TX2

Hello.
We bought two cameras(IMX185) from the Leopard Imaging.
We installed these two cameras on TX2.
Our goal is to output 1080p@30FPS from these two cameras.
However, this only outputs 15 FPS.

Our system is OpenCV 3.3 and L4T is 28.1
Here is our code.

VideoCapture cap1("nvcamerasrc sensor-id=1 ! video/x-raw(memory:NVMM), width=1280, height=720,format=NV12, framerate=30/1 ! nvvidconv ! video/x-raw,format=I420 ! appsink");

VideoCapture cap2("nvcamerasrc sensor-id=2 ! video/x-raw(memory:NVMM), width=1280, height=720,format=NV12, framerate=30/1 ! nvvidconv ! video/x-raw,format=I420 ! appsink");

while (1) {
          cap1 >> frame1;
          cap2 >> frame2;
          Mat bgr1, bgr2;
          cvtColor (frame1, bgr1, CV_YUV2BGR_I420);
          cvtColor (frame2, bgr2, CV_YUV2BGR_I420);
          imshow ("frame1", bgr1);
          imshow ("frame2", bgr2);
          waitKey (1);
}

And the following commands were all used.

sudo ./jetson_clocks.sh
sudo nvpmodel -m 0

I am wondering if it is impossible to output 1080p @ 30FPS with two cameras or there are other problems.

Thanks.

Gyu-Cheol Lee

@gyucheol0116
Could you help try if the fps drop while only run the gst pipeline only.

@ShaneCCC
Sorry, I can not understand your words. Could you explain it again?

I would like to check which component cause the frame drop.
If below command can get 30fps that means the problem cause at OpenCv process.

GST_DEBUG=fpsdisplaysink:5 gst-launch-1.0 nvcamerasrc num-buffers=200 sensor-id=0 ! 'video/x-raw(memory:NVMM), framerate=(fraction)30/1' ! queue ! fpsdisplaysink video-sink=fakesink sync=false async=true & GST_DEBUG=fpsdisplaysink:5 gst-launch-1.0 nvcamerasrc num-buffers=200 sensor-id=1 ! 'video/x-raw(memory:NVMM), framerate=(fraction)30/1' ! queue ! fpsdisplaysink video-sink=fakesink sync=false async=true

@ShaneCCC
I got a result from your command. Here is the message.

[1] 4818

(gst-plugin-scanner:4821): GStreamer-WARNING **: Failed to load plugin '/usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstvaapi.so': /usr/lib/aarch64-linux-gnu/libva-drm.so.1: undefined symbol: drmGetClient

(gst-plugin-scanner:4820): GStreamer-WARNING **: Failed to load plugin '/usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstvaapi.so': /usr/lib/aarch64-linux-gnu/libva-drm.so.1: undefined symbol: drmGetClient

(gst-plugin-scanner:4820): GStreamer-WARNING **: Failed to load plugin '/usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstclutter.so': /usr/lib/aarch64-linux-gnu/libgbm.so.1: undefined symbol: drmGetDevice

(gst-plugin-scanner:4821): GStreamer-WARNING **: Failed to load plugin '/usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstclutter.so': /usr/lib/aarch64-linux-gnu/libgbm.so.1: undefined symbol: drmGetDevice
Setting pipeline to PAUSED ...
0:00:00.879878434  4819       0x746f20 DEBUG         fpsdisplaysink fpsdisplaysink.c:440:fps_display_sink_start:<fpsdisplaysink0> Use text-overlay? 1
Setting pipeline to PAUSED ...
0:00:00.887346766  4818       0x746f20 DEBUG         fpsdisplaysink fpsdisplaysink.c:440:fps_display_sink_start:<fpsdisplaysink0> Use text-overlay? 1

Available Sensor modes : 
1920 x 1080 FR=30.000000 CF=0x1009208a10 SensorModeType=4 CSIPixelBitDepth=12 DynPixelBitDepth=12
1920 x 1080 FR=30.000000 CF=0x1009208a10 SensorModeType=4 CSIPixelBitDepth=10 DynPixelBitDepth=10
1920 x 1080 FR=60.000000 CF=0x1009208a10 SensorModeType=4 CSIPixelBitDepth=12 DynPixelBitDepth=12
1920 x 1080 FR=60.000000 CF=0x1009208a10 SensorModeType=4 CSIPixelBitDepth=10 DynPixelBitDepth=10
1920 x 1080 FR=30.000000 CF=0x1009208a10 SensorModeType=5 CSIPixelBitDepth=12 DynPixelBitDepth=16
1280 x 720 FR=120.000000 CF=0x1009208a10 SensorModeType=4 CSIPixelBitDepth=10 DynPixelBitDepth=10
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock

Available Sensor modes : 
1920 x 1080 FR=30.000000 CF=0x1009208a10 SensorModeType=4 CSIPixelBitDepth=12 DynPixelBitDepth=12
1920 x 1080 FR=30.000000 CF=0x1009208a10 SensorModeType=4 CSIPixelBitDepth=10 DynPixelBitDepth=10
1920 x 1080 FR=60.000000 CF=0x1009208a10 SensorModeType=4 CSIPixelBitDepth=12 DynPixelBitDepth=12
1920 x 1080 FR=60.000000 CF=0x1009208a10 SensorModeType=4 CSIPixelBitDepth=10 DynPixelBitDepth=10
1920 x 1080 FR=30.000000 CF=0x1009208a10 SensorModeType=5 CSIPixelBitDepth=12 DynPixelBitDepth=16
1280 x 720 FR=120.000000 CF=0x1009208a10 SensorModeType=4 CSIPixelBitDepth=10 DynPixelBitDepth=10
Pipeline is live and does not need PREROLL ...

NvCameraSrc: Trying To Set Default Camera Resolution. Selected sensorModeIndex = 4 WxH = 1920x1080 FrameRate = 30.000000 ...

Setting pipeline to PLAYING ...
New clock: GstSystemClock

NvCameraSrc: Trying To Set Default Camera Resolution. Selected sensorModeIndex = 4 WxH = 1920x1080 FrameRate = 30.000000 ...

0:00:02.638932970  4818       0x7fd4a0 DEBUG         fpsdisplaysink fpsdisplaysink.c:372:display_current_fps:<fpsdisplaysink0> Updated max-fps to 35.821352
0:00:02.639022666  4818       0x7fd4a0 DEBUG         fpsdisplaysink fpsdisplaysink.c:376:display_current_fps:<fpsdisplaysink0> Updated min-fps to 35.821352
0:00:02.678172314  4819       0x7fd4a0 DEBUG         fpsdisplaysink fpsdisplaysink.c:372:display_current_fps:<fpsdisplaysink0> Updated max-fps to 37.826326
0:00:02.678249434  4819       0x7fd4a0 DEBUG         fpsdisplaysink fpsdisplaysink.c:376:display_current_fps:<fpsdisplaysink0> Updated min-fps to 37.826326
0:00:03.149118164  4818       0x7fd4a0 DEBUG         fpsdisplaysink fpsdisplaysink.c:376:display_current_fps:<fpsdisplaysink0> Updated min-fps to 29.401090
0:00:03.209198483  4819       0x7fd4a0 DEBUG         fpsdisplaysink fpsdisplaysink.c:376:display_current_fps:<fpsdisplaysink0> Updated min-fps to 30.130442
0:00:03.724752567  4819       0x7fd4a0 DEBUG         fpsdisplaysink fpsdisplaysink.c:376:display_current_fps:<fpsdisplaysink0> Updated min-fps to 29.095351
0:00:04.695653408  4818       0x7fd4a0 DEBUG         fpsdisplaysink fpsdisplaysink.c:376:display_current_fps:<fpsdisplaysink0> Updated min-fps to 29.390387
0:00:08.344451749  4818       0x7fd4a0 DEBUG         fpsdisplaysink fpsdisplaysink.c:376:display_current_fps:<fpsdisplaysink0> Updated min-fps to 29.279375
Got EOS from element "pipeline0".
Execution ended after 0:00:07.242061101
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Got EOS from element "pipeline0".
Execution ended after 0:00:07.248143299
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...

Anything wrong?

The camera pipeline output is good. It could be the OpenCV processing cause the frame drop. I think it could be the cvtColor (frame1, bgr1, CV_YUV2BGR_I420); take much time cause the frame drop.