Color stream using opencv on Persee with Ubuntu 16.04?

I installed the ubuntu 16.04 image on the persee and I’m getting a depth stream using the OpenNI SDK, but for the color stream I’ve been reading that you have to use the opencv, so I built opencv with OpenNI2 support (checked the cmake log that it indeed found the openni2 libs), but now I’m still not able to get the color stream going. In my C++ app i simply get false when I check isOpened() on my VideoCapture;

std::shared_ptr<VideoCapture> createColorSource() {
  auto capRef = std::make_shared<VideoCapture>(CAP_OPENNI2); // also fails with argument 0 or 1

  if(!capRef->isOpened()) {
    std::cerr << "Could not open cv::VideoCapture device for color stream" << std::endl;
    return nullptr;
  }

  return capRef;
}

When I try python I get slightly more elaborate responses, but IF I manage to get an opened VideoCapture instance, it always freezes when I try to read from it. Here are some logs:

Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> cap= cv2.VideoCapture(0)
OpenCV(3.4.1-dev) Error: Unspecified error (GStreamer: unable to start pipeline
) in cvCaptureFromCAM_GStreamer, file /home/ubuntu/opencv/modules/videoio/src/cap_gstreamer.cpp, line 890
VIDEOIO(cvCreateCapture_GStreamer(CV_CAP_GSTREAMER_V4L2, reinterpret_cast<char *>(index))): raised OpenCV exception:

OpenCV(3.4.1-dev) /home/ubuntu/opencv/modules/videoio/src/cap_gstreamer.cpp:890: error: (-2) GStreamer: unable to start pipeline
 in function cvCaptureFromCAM_GStreamer

Warning: USB events thread - failed to set priority. This might cause loss of data...
>>> cap.isOpened()
True
>>> while True:
...  check,frame = cap.read()
# this is where the app freezes (and no, it's not because of the while True loop)
...  if check:
...   print('frame: '+str(frame))
...  else:
...   print('no frame')
...
>>> import cv2
>>> cap = cv2.VideoCapture(cv2.CAP_OPENNI2)
OpenCV(3.4.1-dev) Error: Unspecified error (OpenCVKinect: Device open failed see: 	Could not open "2bc5/0403@1/4": Failed to set USB interface!

) in CvCapture_OpenNI2, file /home/ubuntu/opencv/modules/videoio/src/cap_openni2.cpp, line 237
VIDEOIO(cvCreateCameraCapture_OpenNI2(index)): raised OpenCV exception:

OpenCV(3.4.1-dev) /home/ubuntu/opencv/modules/videoio/src/cap_openni2.cpp:237: error: (-2) OpenCVKinect: Device open failed see: 	Could not open "2bc5/0403@1/4": Failed to set USB interface!

 in function CvCapture_OpenNI2

>>> cap.isOpened()
False

Sometimes I get an “open by other component” error;

OpenCV(3.4.1-dev) Error: Unspecified error (GStreamer: unable to start pipeline
) in cvCaptureFromCAM_GStreamer, file /home/ubuntu/opencv/modules/videoio/src/cap_gstreamer.cpp, line 890
VIDEOIO(cvCreateCapture_GStreamer(CV_CAP_GSTREAMER_V4L2, reinterpret_cast<char *>(index))): raised OpenCV exception:

OpenCV(3.4.1-dev) /home/ubuntu/opencv/modules/videoio/src/cap_gstreamer.cpp:890: error: (-2) GStreamer: unable to start pipeline
 in function cvCaptureFromCAM_GStreamer

OpenCV(3.4.1-dev) Error: Unspecified error (CvCapture_OpenNI2::CvCapture_OpenNI2 : Couldn't set depth stream output mode: 	This stream is open by other components. Configuration cannot be changed.

) in toggleStream, file /home/ubuntu/opencv/modules/videoio/src/cap_openni2.cpp, line 299
VIDEOIO(cvCreateCameraCapture_OpenNI2(index)): raised OpenCV exception:

OpenCV(3.4.1-dev) /home/ubuntu/opencv/modules/videoio/src/cap_openni2.cpp:299: error: (-2) CvCapture_OpenNI2::CvCapture_OpenNI2 : Couldn't set depth stream output mode: 	This stream is open by other components. Configuration cannot be changed.

 in function toggleStream

Look familiar to anybody?

Any suggestions about what to pay attention to when building/using opencv would be appreciated!

Or does the Ubuntu 16.04 image for the persee come with prebuilt opencv??

hey Mark, are you able to use OpenCV inside persee and Ubuntu with Astra SDk?