Connecting two cameras

I want to connect two cameras to Jetson TX2 for the stereo vsision system, but I have problems:

#include <iostream>

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "opencv2/opencv.hpp"

int main()
//const char *pipeline = "tcambin serial=10710002 ! video/x-raw, format=GRAY8, framerate=30/1, width=640, height=480 ! videoconvert ! appsink";
//const char *pipeline = "v4l2src ! video/x-raw, format=GRAY8, width=640, height=480, framerate=30/1 ! videoconvert ! appsink";
//const char *pipeline = "videotestsrc ! appsink";
const char *pipeline_left =  "tcamsrc serial=19710151 ! video/x-bayer,width=1280,height=960 ! bayer2rgb ! videoconvert ! appsink";
const char *pipeline_right = "tcamsrc serial=19710152 ! video/x-bayer,width=1280,height=960 ! bayer2rgb ! videoconvert ! appsink";
cv::VideoCapture *cap_1 = new cv::VideoCapture(pipeline_left);
cv::VideoCapture *cap_2 = new cv::VideoCapture(pipeline_right);

if (!cap_1->isOpened()&&!cap_2->isOpened())
cv::Mat frame_left;
cv::Mat frame_right;

*cap_1 >> frame_left; // get a new frame from camera
*cap_2 >> frame_right;

cv::imshow("Left", frame_left);
cv::imshow("Right", frame_right);

delete cap_1;
delete cap_2;


OpenCV Error: Assertion failed (size.width>0 && size.height>0) in imshow, file /opt/opencv/modules/highgui/src/window.cpp, line 331
terminate called after throwing an instance of 'cv::Exception'
  what():  /opt/opencv/modules/highgui/src/window.cpp:331: error: (-215) size.width>0 && size.height>0 in function imshow

One camera works very good.

Hi vvvarvolik,

Do you “export DISPLAY=:0” before running app?

Which cameras are you using? How are they connected?

No, don’t export.
I use DFK23UP1300 and hub Goobay, I think, that problems can be called with a hub

Does export that variable help?

No, but I solved this problem, thank you!

You’re probably not the only person who will have this problem!
Google will point people with this problem at this forum thread.
To help the other people who will have this problem (even if it’s an “obvious” problem like missing package, type, etc,) you should post the actual answer to your own question here.
After all, you asked all of us, a bunch of complete strangers, to help you out. Thus, it’s fair that you post the solution you arrived at, so that other complete strangers can in turn be helped.

Please, let us know !
[EDIT: Was it cv::waitKey expecting an argument such as 1 ms ?]

Of course.
I use cameras DFK23UP1300. The problem was with the drivers.
I contacted with technical support and they said that I need to install this version of drivers.

git clone tiscamera-working
cd tiscamera-working
git checkout v-tiscamera-0.9.1
mkdir build
cd build
make -j4
sudo make install