XIMEA, OpenCV and CUDA don't work together as they should

I am having trouble running the cuda samples. For example i tried running this one:

nvidia@ubuntu:~/cuda/samples/5_Simulations/nbody$ ls
bodysystemcpu.h        doc             NsightEclipse.xml
bodysystemcpu_impl.h   findgllib.mk    readme.txt
bodysystemcuda.cu      galaxy_20K.bin  render_particles.cpp
bodysystemcuda.h       Makefile        render_particles.h
bodysystemcuda_impl.h  nbody           render_particles.o
bodysystemcuda.o       nbody.cpp       tipsy.h
bodysystem.h           nbody.o
nvidia@ubuntu:~/cuda/samples/5_Simulations/nbody$ ./nbody
Run "nbody -benchmark [-numbodies=<numBodies>]" to measure performance.
        -fullscreen       (run n-body simulation in fullscreen mode)
        -fp64             (use double precision floating point values for simula                                     tion)
        -hostmem          (stores simulation data in host memory)
        -benchmark        (run benchmark to measure performance)
        -numbodies=<N>    (number of bodies (>= 1) to run in simulation)
        -device=<d>       (where d=0,1,2.... for the CUDA device to use)
        -numdevices=<i>   (where i=(number of CUDA devices > 0) to use for simul                                     ation)
        -compare          (compares simulation results running once on the defau                                     lt GPU and once on the CPU)
        -cpu              (run n-body simulation on the CPU)
        -tipsy=<file.bin> (load a tipsy model file for simulation)

NOTE: The CUDA Samples are not meant for performance measurements. Results may v                                     ary when GPU Boost is enabled.

Error: only 0 Devices available, 1 requested.  Exiting.

I am having similiar problems when trying to run anything else using cuda.

I bought an expensive version of the TX2 from XIMEA. It’s called XeC2 and should work with cameras. It has some libraries preinstalled that i don’t want to remove or have to rebuild for the device. How ever the XeC2 does not have cuda or openCV preinstalled even though their examples need both to compile.

I plugged in the jetson to my ubuntu host and installed the sdk toolkit without flashing the jetson. So i could have cuda but not having to rebuild the whole system.

I also needed openCV with CUDA support. So i compiled openCV from source (took 11 hours…) with this Cmake flags:

cmake -D CMAKE_BUILD_TYPE=Release \
      -D WITH_TBB=ON \
      -D WITH_CUDA=ON \
      -D ENABLE_FAST_MATH=ON \
      -D CUDA_FAST_MATH=ON \
      -D WITH_NVCUVID=ON \
      -D WITH_CUBLAS=ON \
      -D WITH_V4L=ON \
      -D WITH_OPENGL=ON \
      -D WITH_QT=ON \
      -D WITH_GSTREAMER=ON \
      -D BUILD_opencv_cudacodec=ON \
      -D OPENCV_ENABLE_NONFREE=ON \
      -D OPENCV_GENERATE_PKGCONFIG=ON \
      -D PYTHON_DEFAULT_EXECUTABLE=$(which python3) \
      -D OPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules \
      -D WITH_WEBP=OFF \
      ..

after running 'sudo make install’and waiting 11 hours it finally finished. I tried using the cuda and openCV together but i am getting lots of errors.
I am running a code from Ximea support that should increase my camera fps from 5 to 50. However it does not compile on the jetson:

code:

#include <m3api/xiApi.h>
#include <iostream>
#include <opencv2/highgui.hpp>
#include <opencv2/cudaimgproc.hpp>
#include <opencv2/cudaarithm.hpp>
#include <cuda_runtime.h>


// Define the number of images acquired, processed and shown in this example
#define NUMBER_OF_IMAGES 1000

// Define parameters for a static white balance
#define WB_BLUE 2
#define WB_GREEN 1
#define WB_RED 1.3


using namespace cv;
using namespace std;

int main(){
  // Initialize XI_IMG structure
  XI_IMG image;
  memset(&image, 0, sizeof(XI_IMG));
  image.size = sizeof(XI_IMG);

  HANDLE xiH = NULL;
  XI_RETURN stat = XI_OK;

  // Simplyfied error handling (just for demonstration)
  try{
    int cfa = 0;
    int OCVbayer = 0;

    // Get device handle for the camera
    stat = xiOpenDevice(0, &xiH);
    if (stat != XI_OK)
      throw "Opening device failed";

    // Get type of camera color filter
    stat = xiGetParamInt(xiH, XI_PRM_COLOR_FILTER_ARRAY, &cfa);
    if (stat != XI_OK)
      throw "Could not get color filter array from camera";

    // Set correct demosaicing type according to camera color filter
    switch (cfa) {
        case XI_CFA_BAYER_RGGB:
        {
                cout << "BAYER_RGGB color filter." << endl;
                OCVbayer = COLOR_BayerRG2BGR;
                break;
        }
        case XI_CFA_BAYER_BGGR:
        {
                cout << "BAYER_BGGR color filter." << endl;
                OCVbayer = COLOR_BayerBG2BGR;
                break;
        }
        case XI_CFA_BAYER_GRBG:
        {
                cout<<"BAYER_GRBG color filter." << endl;
                OCVbayer = COLOR_BayerGR2BGR;
                break;
        }
        case XI_CFA_BAYER_GBRG:
        {
                cout<<"BAYER_GBRG color filter." << endl;
                OCVbayer = COLOR_BayerGB2BGR;
                break;
        }
        default:
        {
                throw "Not supported color filter for demosaicing.";
        }
    }

    // Use transport data format (no processing done by the API)
    stat = xiSetParamInt(xiH, XI_PRM_IMAGE_DATA_FORMAT, XI_FRM_TRANSPORT_DATA);
    if (stat != XI_OK)
      throw "Setting image data format failed";

    // Make data from the camera stream to zerocopy memory
    stat = xiSetParamInt(xiH, XI_PRM_TRANSPORT_DATA_TARGET, XI_TRANSPORT_DATA_TARGET_ZEROCOPY);
    if (stat != XI_OK)
      throw "Setting transport data target failed";

    // Using 8-bit images here
    stat = xiSetParamInt(xiH, XI_PRM_OUTPUT_DATA_BIT_DEPTH, 8);
    if (stat != XI_OK)
      throw "Setting bit depth failed";

    // Exposure 10 ms
    stat = xiSetParamInt(xiH, XI_PRM_EXPOSURE, 10000);
    if (stat != XI_OK)
      throw "Setting exposure failed";

    // Get width of image
    int width = -1;
    stat = xiGetParamInt(xiH, XI_PRM_WIDTH, &width);
    if (stat != XI_OK)
      throw "Could not get image width from camera";

    // Get height of image
    int height = -1;
    stat = xiGetParamInt(xiH, XI_PRM_HEIGHT, &height);
    if (stat != XI_OK)
      throw "Could not get image height from camera";

    // Start the image acquisition
    cout << "this runs"  << endl;
    stat = xiStartAcquisition(xiH);
    if (stat != XI_OK)
      throw "Starting image acquisition failed";
    cout << "this doesn't run"  << endl;

    // Create a GUI window with OpenGL support
    namedWindow("XIMEA camera", WINDOW_OPENGL);
    resizeWindow("XIMEA camera", width/3, height/3);

    // Define pointer used for data on GPU
    void *imageGpu;
    // Create GpuMat for the result images
    cuda::GpuMat gpu_mat_color(height, width, CV_8UC3);

    // Acquire a number of images, process and render them
    for (int i = 0; i < NUMBER_OF_IMAGES; i++){
      // Get host-pointer to image data
      stat = xiGetImage(xiH, 5000, &image);
      if (stat != XI_OK)
        throw "Getting image from camera failed";

      // Convert to device pointer
      cudaHostGetDevicePointer(&imageGpu, image.bp, 0);
      // Create GpuMat from the device pointer
      cuda::GpuMat gpu_mat_raw(height, width, CV_8UC1, imageGpu);
      // Demosaic raw bayer image to color image
      cuda::demosaicing(gpu_mat_raw, gpu_mat_color, OCVbayer);
      // Apply static white balance by multiplying the channels
      cuda::multiply(gpu_mat_color, cv::Scalar(WB_BLUE, WB_GREEN, WB_RED), gpu_mat_color);
      // Render image to the screen (using OpenGL)
      imshow("XIMEA camera", gpu_mat_color);
      waitKey(1);
    }

    // Stop image acquitsition and close device
    xiStopAcquisition(xiH);
    xiCloseDevice(xiH);

    // Print errors
   }catch(const char* message){
    std::cerr << message << std::endl;
   }
}

It fails with this ourput:

terminate called after throwing an instance of 'cv::Exception'
  what():  OpenCV(4.5.1-pre) /home/nvidia/moebus/openCVinstall/opencv/modules/core/src/cuda/gpu_mat.cu:116: error: (-217:Gpu API call) CUDA driver version is insufficient for CUDA runtime version in function 'allocate'

i am confused as i am running the cuda version 10.2 that came from the nvidiaSDK running on my host ubuntu. The same version that was installed when building openCV.

Here is my output of my build settings:

>>> import cv2
>>> print(cv2.getBuildInformation())

General configuration for OpenCV 4.5.1-pre =====================================
  Version control:               4.5.0-266-gef0eed8d3c

  Extra modules:
    Location (extra):            /home/nvidia/moebus/openCVinstall/opencv/opencv_contrib/modules
    Version control (extra):     4.5.0-47-g960714d4

  Platform:
    Timestamp:                   2020-12-01T19:07:20Z
    Host:                        Linux 4.9.140-tegra aarch64
    CMake:                       3.10.2
    CMake generator:             Unix Makefiles
    CMake build tool:            /usr/bin/make
    Configuration:               Release

  CPU/HW features:
    Baseline:                    NEON FP16
      required:                  NEON
      disabled:                  VFPV3

  C/C++:
    Built as dynamic libs?:      YES
    C++ standard:                11
    C++ Compiler:                /usr/bin/c++  (ver 7.5.0)
    C++ flags (Release):         -fsigned-char -ffast-math -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections    -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG  -DNDEBUG
    C++ flags (Debug):           -fsigned-char -ffast-math -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections    -fvisibility=hidden -fvisibility-inlines-hidden -g  -O0 -DDEBUG -D_DEBUG
    C Compiler:                  /usr/bin/cc
    C flags (Release):           -fsigned-char -ffast-math -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections    -fvisibility=hidden -O3 -DNDEBUG  -DNDEBUG
    C flags (Debug):             -fsigned-char -ffast-math -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections    -fvisibility=hidden -g  -O0 -DDEBUG -D_DEBUG
    Linker flags (Release):      -Wl,--gc-sections -Wl,--as-needed
    Linker flags (Debug):        -Wl,--gc-sections -Wl,--as-needed
    ccache:                      NO
    Precompiled headers:         NO
    Extra dependencies:          m pthread /usr/lib/aarch64-linux-gnu/libGL.so /usr/lib/aarch64-linux-gnu/libGLU.so cudart_static dl rt nppc nppial nppicc nppicom nppidei nppif nppig nppim nppist nppisu nppitc npps cublas cudnn cufft -L/usr/local/cuda-10.2/lib64 -L/usr/lib/aarch64-linux-gnu
    3rdparty dependencies:

  OpenCV modules:
    To be built:                 alphamat aruco bgsegm bioinspired calib3d ccalib core cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev cvv datasets dnn dnn_objdetect dnn_superres dpm face features2d flann freetype fuzzy gapi hfs highgui img_hash imgcodecs imgproc intensity_transform line_descriptor mcc ml objdetect optflow phase_unwrapping photo plot python2 python3 quality rapid reg rgbd saliency shape stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab xfeatures2d ximgproc xobjdetect xphoto
    Disabled:                    world
    Disabled by dependency:      -
    Unavailable:                 cnn_3dobj hdf java js julia matlab ovis sfm viz
    Applications:                tests perf_tests apps
    Documentation:               NO
    Non-free algorithms:         YES

  GUI:
    QT:                          YES (ver 5.9.5)
      QT OpenGL support:         YES (Qt5::OpenGL 5.9.5)
    GTK+:                        NO
    OpenGL support:              YES (/usr/lib/aarch64-linux-gnu/libGL.so /usr/lib/aarch64-linux-gnu/libGLU.so)
    VTK support:                 NO

  Media I/O:
    ZLib:                        /usr/lib/aarch64-linux-gnu/libz.so (ver 1.2.11)
    JPEG:                        /usr/lib/aarch64-linux-gnu/libjpeg.so (ver 80)
    PNG:                         /usr/lib/aarch64-linux-gnu/libpng.so (ver 1.6.34)
    TIFF:                        /usr/lib/aarch64-linux-gnu/libtiff.so (ver 42 / 4.0.9)
    JPEG 2000:                   build (ver 2.3.1)
    OpenEXR:                     /usr/lib/aarch64-linux-gnu/libImath.so /usr/lib/aarch64-linux-gnu/libIlmImf.so /usr/lib/aarch64-linux-gnu/libIex.so /usr/lib/aarch64-linux-gnu/libHalf.so /usr/lib/aarch64-linux-gnu/libIlmThread.so (ver 2_2)
    HDR:                         YES
    SUNRASTER:                   YES
    PXM:                         YES
    PFM:                         YES

  Video I/O:
    DC1394:                      YES (2.2.5)
    FFMPEG:                      YES
      avcodec:                   YES (57.107.100)
      avformat:                  YES (57.83.100)
      avutil:                    YES (55.78.100)
      swscale:                   YES (4.8.100)
      avresample:                YES (3.7.0)
    GStreamer:                   YES (1.14.5)
    v4l/v4l2:                    YES (linux/videodev2.h)

  Parallel framework:            TBB (ver 2017.0 interface 9107)

  Trace:                         YES (with Intel ITT)

  Other third-party libraries:
    Lapack:                      YES (/usr/lib/aarch64-linux-gnu/liblapack.so /usr/lib/aarch64-linux-gnu/libcblas.so /usr/lib/aarch64-linux-gnu/libatlas.so)
    Eigen:                       YES (ver 3.3.4)
    Custom HAL:                  YES (carotene (ver 0.0.1))
    Protobuf:                    build (3.5.1)

  NVIDIA CUDA:                   YES (ver 10.2, CUFFT CUBLAS FAST_MATH)
    NVIDIA GPU arch:             53 62 72 70
    NVIDIA PTX archs:

  cuDNN:                         YES (ver 8.0.0)

  OpenCL:                        YES (no extra features)
    Include path:                /home/nvidia/moebus/openCVinstall/opencv/3rdparty/include/opencl/1.2
    Link libraries:              Dynamic load

  Python 2:
    Interpreter:                 /usr/bin/python2.7 (ver 2.7.17)
    Libraries:                   /usr/lib/aarch64-linux-gnu/libpython2.7.so (ver 2.7.17)
    numpy:                       /usr/lib/python2.7/dist-packages/numpy/core/include (ver 1.13.3)
    install path:                lib/python2.7/dist-packages/cv2/python-2.7

  Python 3:
    Interpreter:                 /usr/bin/python3 (ver 3.6.9)
    Libraries:                   /usr/lib/aarch64-linux-gnu/libpython3.6m.so (ver 3.6.9)
    numpy:                       /usr/local/lib/python3.6/dist-packages/numpy/core/include (ver 1.19.4)
    install path:                lib/python3.6/dist-packages/cv2/python-3.6

  Python (for build):            /usr/bin/python3

  Java:
    ant:                         NO
    JNI:                         NO
    Java wrappers:               NO
    Java tests:                  NO

  Install to:                    /usr/local
-----------------------------------------------------------------

I am lost as to what exactly is broken and startet making tests within openCV. For this i went into my opencv build folder and typed (as of time of writing the tests are still running and some take alot of time, i will update this post to insert the new test results as they roll in):

 nvidia@ubuntu:~/openCVinstall/opencv/build$ make test
Running tests...
Test project /home/nvidia/openCVinstall/opencv/build
        Start   1: opencv_test_cudev
  1/125 Test   #1: opencv_test_cudev .................***Failed    0.87 sec
        Start   2: opencv_test_core
  2/125 Test   #2: opencv_test_core ..................***Failed  170.37 sec
        Start   3: opencv_perf_core
  3/125 Test   #3: opencv_perf_core ..................   Passed  1092.67 sec
        Start   4: opencv_sanity_core
  4/125 Test   #4: opencv_sanity_core ................***Failed  198.56 sec
        Start   5: opencv_test_cudaarithm
  5/125 Test   #5: opencv_test_cudaarithm ............***Exception: SegFault  0.81 sec
        Start   6: opencv_perf_cudaarithm
  6/125 Test   #6: opencv_perf_cudaarithm ............***Exception: Child aborted  0.55 sec
        Start   7: opencv_sanity_cudaarithm
  7/125 Test   #7: opencv_sanity_cudaarithm ..........***Exception: Child aborted  0.57 sec
        Start   8: opencv_test_flann
  8/125 Test   #8: opencv_test_flann .................   Passed    0.05 sec
        Start   9: opencv_test_imgproc
  9/125 Test   #9: opencv_test_imgproc ...............***Failed  121.18 sec
        Start  10: opencv_perf_imgproc
 10/125 Test  #10: opencv_perf_imgproc ...............***Failed  1603.99 sec
        Start  11: opencv_sanity_imgproc
 11/125 Test  #11: opencv_sanity_imgproc .............***Failed  207.54 sec
        Start  12: opencv_test_intensity_transform
 12/125 Test  #12: opencv_test_intensity_transform ...***Failed    0.04 sec
        Start  13: opencv_test_ml
 13/125 Test  #13: opencv_test_ml ....................***Failed    7.43 sec
        Start  14: opencv_test_phase_unwrapping
 14/125 Test  #14: opencv_test_phase_unwrapping ......   Passed    0.58 sec
        Start  15: opencv_test_quality
 15/125 Test  #15: opencv_test_quality ...............***Failed    0.06 sec
        Start  16: opencv_test_reg
 16/125 Test  #16: opencv_test_reg ...................***Failed    0.05 sec
        Start  17: opencv_perf_reg
 17/125 Test  #17: opencv_perf_reg ...................   Passed    4.46 sec
        Start  18: opencv_sanity_reg
 18/125 Test  #18: opencv_sanity_reg .................   Passed    0.69 sec
        Start  19: opencv_test_cudafilters
 19/125 Test  #19: opencv_test_cudafilters ...........***Exception: SegFault  0.61 sec
        Start  20: opencv_perf_cudafilters
 20/125 Test  #20: opencv_perf_cudafilters ...........***Exception: Child aborted  0.59 sec
        Start  21: opencv_sanity_cudafilters
 21/125 Test  #21: opencv_sanity_cudafilters .........***Exception: Child aborted  0.57 sec
        Start  22: opencv_test_cudaimgproc
 22/125 Test  #22: opencv_test_cudaimgproc ...........***Exception: SegFault  0.62 sec
        Start  23: opencv_perf_cudaimgproc
 23/125 Test  #23: opencv_perf_cudaimgproc ...........***Exception: Child aborted  0.59 sec
        Start  24: opencv_sanity_cudaimgproc
 24/125 Test  #24: opencv_sanity_cudaimgproc .........***Exception: Child aborted  0.57 sec
        Start  25: opencv_test_cudawarping
 25/125 Test  #25: opencv_test_cudawarping ...........***Exception: SegFault  0.57 sec
        Start  26: opencv_perf_cudawarping
 26/125 Test  #26: opencv_perf_cudawarping ...........***Exception: Child aborted  0.55 sec
        Start  27: opencv_sanity_cudawarping
 27/125 Test  #27: opencv_sanity_cudawarping .........***Exception: Child aborted  0.53 sec
        Start  28: opencv_test_dnn
 28/125 Test  #28: opencv_test_dnn ...................***Failed    1.01 sec
        Start  29: opencv_perf_dnn
 29/125 Test  #29: opencv_perf_dnn ...................***Failed   83.30 sec
        Start  30: opencv_sanity_dnn
 30/125 Test  #30: opencv_sanity_dnn .................***Failed    5.54 sec
        Start  31: opencv_test_dnn_superres
 31/125 Test  #31: opencv_test_dnn_superres ..........***Failed    0.06 sec
        Start  32: opencv_perf_dnn_superres
 32/125 Test  #32: opencv_perf_dnn_superres ..........***Failed    0.15 sec
        Start  33: opencv_sanity_dnn_superres
 33/125 Test  #33: opencv_sanity_dnn_superres ........***Failed    0.08 sec
        Start  34: opencv_test_features2d
 34/125 Test  #34: opencv_test_features2d ............***Failed   55.69 sec
        Start  35: opencv_perf_features2d
 35/125 Test  #35: opencv_perf_features2d ............***Failed  123.02 sec
        Start  36: opencv_sanity_features2d
 36/125 Test  #36: opencv_sanity_features2d ..........***Failed    4.09 sec
        Start  37: opencv_test_fuzzy
 37/125 Test  #37: opencv_test_fuzzy .................***Failed    0.07 sec
        Start  38: opencv_test_img_hash
 38/125 Test  #38: opencv_test_img_hash ..............   Passed    0.10 sec
        Start  39: opencv_test_imgcodecs
 39/125 Test  #39: opencv_test_imgcodecs .............***Failed   33.08 sec
        Start  40: opencv_perf_imgcodecs
 40/125 Test  #40: opencv_perf_imgcodecs .............   Passed    0.11 sec
        Start  41: opencv_sanity_imgcodecs
 41/125 Test  #41: opencv_sanity_imgcodecs ...........   Passed    0.03 sec
        Start  42: opencv_test_line_descriptor
 42/125 Test  #42: opencv_test_line_descriptor .......***Failed    2.07 sec
        Start  43: opencv_perf_line_descriptor
 43/125 Test  #43: opencv_perf_line_descriptor .......   Passed   12.02 sec
        Start  44: opencv_sanity_line_descriptor
 44/125 Test  #44: opencv_sanity_line_descriptor .....   Passed    0.26 sec
        Start  45: opencv_test_photo
 45/125 Test  #45: opencv_test_photo .................***Failed    0.57 sec
        Start  46: opencv_perf_photo
 46/125 Test  #46: opencv_perf_photo .................***Exception: Child aborted  0.56 sec
        Start  47: opencv_sanity_photo
 47/125 Test  #47: opencv_sanity_photo ...............***Exception: Child aborted  0.56 sec
        Start  48: opencv_test_saliency
 48/125 Test  #48: opencv_test_saliency ..............   Passed    0.05 sec
        Start  49: opencv_test_text
 49/125 Test  #49: opencv_test_text ..................***Failed    0.07 sec
        Start  50: opencv_test_videoio
 50/125 Test  #50: opencv_test_videoio ...............***Failed    2.85 sec
        Start  51: opencv_perf_videoio
 51/125 Test  #51: opencv_perf_videoio ...............***Failed    0.27 sec
        Start  52: opencv_sanity_videoio
 52/125 Test  #52: opencv_sanity_videoio .............***Failed    0.19 sec
        Start  53: opencv_test_xphoto
 53/125 Test  #53: opencv_test_xphoto ................***Failed    0.28 sec
        Start  54: opencv_perf_xphoto
 54/125 Test  #54: opencv_perf_xphoto ................   Passed   11.76 sec
        Start  55: opencv_sanity_xphoto
 55/125 Test  #55: opencv_sanity_xphoto ..............***Failed    1.41 sec
        Start  56: opencv_test_calib3d
     56/125 Test  #56: opencv_test_calib3d ...............***Failed  170.83 sec
        Start  57: opencv_perf_calib3d
 57/125 Test  #57: opencv_perf_calib3d ...............***Failed  174.21 sec
        Start  58: opencv_sanity_calib3d
 58/125 Test  #58: opencv_sanity_calib3d .............***Failed    9.38 sec
        Start  59: opencv_test_cudacodec
 59/125 Test  #59: opencv_test_cudacodec .............***Exception: SegFault  0.56 sec
        Start  60: opencv_perf_cudacodec
 60/125 Test  #60: opencv_perf_cudacodec .............***Exception: Child aborted  0.54 sec
        Start  61: opencv_sanity_cudacodec
 61/125 Test  #61: opencv_sanity_cudacodec ...........***Exception: Child aborted  0.52 sec
        Start  62: opencv_test_cudafeatures2d
 62/125 Test  #62: opencv_test_cudafeatures2d ........***Exception: SegFault  0.61 sec
        Start  63: opencv_perf_cudafeatures2d
 63/125 Test  #63: opencv_perf_cudafeatures2d ........***Exception: Child aborted  0.56 sec
        Start  64: opencv_sanity_cudafeatures2d
 64/125 Test  #64: opencv_sanity_cudafeatures2d ......***Exception: Child aborted  0.55 sec
        Start  65: opencv_test_cudastereo
 65/125 Test  #65: opencv_test_cudastereo ............***Exception: SegFault  0.55 sec
        Start  66: opencv_perf_cudastereo
 66/125 Test  #66: opencv_perf_cudastereo ............***Exception: Child aborted  0.52 sec
        Start  67: opencv_sanity_cudastereo
 67/125 Test  #67: opencv_sanity_cudastereo ..........***Exception: Child aborted  0.54 sec
        Start  68: opencv_test_cvv
 68/125 Test  #68: opencv_test_cvv ...................   Passed    0.04 sec
        Start  69: opencv_test_highgui
 69/125 Test  #69: opencv_test_highgui ...............***Failed    0.10 sec
        Start  70: opencv_test_mcc
 70/125 Test  #70: opencv_test_mcc ...................***Failed    0.45 sec
        Start  71: opencv_test_objdetect
 71/125 Test  #71: opencv_test_objdetect .............***Failed    2.29 sec
        Start  72: opencv_perf_objdetect
 72/125 Test  #72: opencv_perf_objdetect .............***Failed   89.92 sec
        Start  73: opencv_sanity_objdetect
 73/125 Test  #73: opencv_sanity_objdetect ...........***Failed    9.17 sec
        Start  74: opencv_test_rapid
 74/125 Test  #74: opencv_test_rapid .................   Passed    0.09 sec
        Start  75: opencv_test_rgbd
  75/125 Test  #75: opencv_test_rgbd ..................***Failed   30.46 sec
    Start  76: opencv_perf_rgbd
 76/125 Test  #76: opencv_perf_rgbd ..................   Passed   52.86 sec
    Start  77: opencv_sanity_rgbd
 77/125 Test  #77: opencv_sanity_rgbd ................   Passed   52.69 sec
    Start  78: opencv_test_shape
 78/125 Test  #78: opencv_test_shape .................***Failed    0.05 sec
    Start  79: opencv_test_structured_light
 79/125 Test  #79: opencv_test_structured_light ......***Failed    3.32 sec
    Start  80: opencv_test_video
 80/125 Test  #80: opencv_test_video .................***Failed    5.76 sec
    Start  81: opencv_perf_video
 81/125 Test  #81: opencv_perf_video .................***Failed   49.63 sec
    Start  82: opencv_sanity_video
 82/125 Test  #82: opencv_sanity_video ...............***Failed    3.58 sec
    Start  83: opencv_test_xfeatures2d
 83/125 Test  #83: opencv_test_xfeatures2d ...........***Failed    0.31 sec
    Start  84: opencv_perf_xfeatures2d
 84/125 Test  #84: opencv_perf_xfeatures2d ...........***Exception: Child aborted  0.59 sec
    Start  85: opencv_sanity_xfeatures2d
 85/125 Test  #85: opencv_sanity_xfeatures2d .........***Exception: Child aborted  0.59 sec
    Start  86: opencv_test_ximgproc
 86/125 Test  #86: opencv_test_ximgproc ..............***Failed  146.00 sec
    Start  87: opencv_perf_ximgproc
 87/125 Test  #87: opencv_perf_ximgproc ..............***Failed  474.28 sec
    Start  88: opencv_sanity_ximgproc
 88/125 Test  #88: opencv_sanity_ximgproc ............***Failed  275.99 sec
    Start  89: opencv_test_aruco
 89/125 Test  #89: opencv_test_aruco .................   Passed    2.69 sec
    Start  90: opencv_test_bgsegm
 90/125 Test  #90: opencv_test_bgsegm ................***Failed    0.12 sec
    Start  91: opencv_test_bioinspired
 91/125 Test  #91: opencv_test_bioinspired ...........***Failed    0.07 sec
    Start  92: opencv_perf_bioinspired
 92/125 Test  #92: opencv_perf_bioinspired ...........***Failed    0.21 sec
    Start  93: opencv_sanity_bioinspired
 93/125 Test  #93: opencv_sanity_bioinspired .........***Failed    0.05 sec
    Start  94: opencv_test_cudabgsegm
 94/125 Test  #94: opencv_test_cudabgsegm ............***Exception: SegFault  0.58 sec
    Start  95: opencv_perf_cudabgsegm
 95/125 Test  #95: opencv_perf_cudabgsegm ............***Exception: Child aborted  0.56 sec
    Start  96: opencv_sanity_cudabgsegm
 96/125 Test  #96: opencv_sanity_cudabgsegm ..........***Exception: Child aborted  0.54 sec
    Start  97: opencv_test_cudalegacy
 97/125 Test  #97: opencv_test_cudalegacy ............***Failed    0.12 sec
    Start  98: opencv_perf_cudalegacy
 98/125 Test  #98: opencv_perf_cudalegacy ............***Exception: Child aborted  0.57 sec
    Start  99: opencv_sanity_cudalegacy
 99/125 Test  #99: opencv_sanity_cudalegacy ..........***Exception: Child aborted  0.56 sec
    Start 100: opencv_test_cudaobjdetect
100/125 Test #100: opencv_test_cudaobjdetect .........***Exception: SegFault  0.61 sec
    Start 101: opencv_perf_cudaobjdetect
101/125 Test #101: opencv_perf_cudaobjdetect .........***Exception: Child aborted  0.63 sec
    Start 102: opencv_sanity_cudaobjdetect
102/125 Test #102: opencv_sanity_cudaobjdetect .......***Exception: Child aborted  0.61 sec
    Start 103: opencv_test_face
103/125 Test #103: opencv_test_face ..................***Failed    0.49 sec
    Start 104: opencv_test_gapi
104/125 Test #104: opencv_test_gapi ..................***Failed  244.45 sec
    Start 105: opencv_perf_gapi
105/125 Test #105: opencv_perf_gapi ..................***Failed  1115.30 sec
        Start 106: opencv_sanity_gapi
106/125 Test #106: opencv_sanity_gapi ................***Failed  241.21 sec
    Start 107: opencv_test_optflow
107/125 Test #107: opencv_test_optflow ...............***Failed    2.12 sec
    Start 108: opencv_perf_optflow
108/125 Test #108: opencv_perf_optflow ...............***Failed   11.86 sec
    Start 109: opencv_sanity_optflow
109/125 Test #109: opencv_sanity_optflow .............***Failed   12.90 sec
    Start 110: opencv_test_stitching
110/125 Test #110: opencv_test_stitching .............***Failed    0.13 sec
    Start 111: opencv_perf_stitching
111/125 Test #111: opencv_perf_stitching .............***Failed   68.47 sec
    Start 112: opencv_sanity_stitching
112/125 Test #112: opencv_sanity_stitching ...........***Failed    6.72 sec
    Start 113: opencv_test_tracking
113/125 Test #113: opencv_test_tracking ..............***Failed    4.98 sec
    Start 114: opencv_perf_tracking
114/125 Test #114: opencv_perf_tracking ..............***Failed    0.27 sec
    Start 115: opencv_sanity_tracking
115/125 Test #115: opencv_sanity_tracking ............***Failed    0.20 sec
    Start 116: opencv_test_cudaoptflow
116/125 Test #116: opencv_test_cudaoptflow ...........***Exception: SegFault  0.61 sec
    Start 117: opencv_perf_cudaoptflow
117/125 Test #117: opencv_perf_cudaoptflow ...........***Exception: Child aborted  0.58 sec
    Start 118: opencv_sanity_cudaoptflow
118/125 Test #118: opencv_sanity_cudaoptflow .........***Exception: Child aborted  0.57 sec
    Start 119: opencv_test_stereo
119/125 Test #119: opencv_test_stereo ................***Failed    0.08 sec
    Start 120: opencv_perf_stereo
120/125 Test #120: opencv_perf_stereo ................   Passed   15.83 sec
    Start 121: opencv_sanity_stereo
121/125 Test #121: opencv_sanity_stereo ..............   Passed    1.83 sec
    Start 122: opencv_test_superres
122/125 Test #122: opencv_test_superres ..............   Passed    0.03 sec
    Start 123: opencv_perf_superres
123/125 Test #123: opencv_perf_superres ..............***Exception: Child aborted  0.72 sec
    Start 124: opencv_sanity_superres
124/125 Test #124: opencv_sanity_superres ............***Exception: Child aborted  0.73 sec
    Start 125: opencv_test_videostab
125/125 Test #125: opencv_test_videostab .............   Passed    6.40 sec

17% tests passed, 104 tests failed out of 125

Label Time Summary:
Accuracy                      = 1024.02 sec*proc (55 tests)
Extra                         = 1153.07 sec*proc (86 tests)
Main                          = 5903.79 sec*proc (39 tests)
Performance                   = 4992.71 sec*proc (35 tests)
Sanity                        = 1040.14 sec*proc (35 tests)
opencv_aruco                  =   2.69 sec*proc (1 test)
opencv_bgsegm                 =   0.12 sec*proc (1 test)
opencv_bioinspired            =   0.33 sec*proc (3 tests)
opencv_calib3d                = 354.42 sec*proc (3 tests)
opencv_core                   = 1461.59 sec*proc (3 tests)
opencv_cudaarithm             =   1.94 sec*proc (3 tests)
opencv_cudabgsegm             =   1.68 sec*proc (3 tests)
opencv_cudacodec              =   1.63 sec*proc (3 tests)
opencv_cudafeatures2d         =   1.73 sec*proc (3 tests)
opencv_cudafilters            =   1.78 sec*proc (3 tests)
opencv_cudaimgproc            =   1.77 sec*proc (3 tests)
opencv_cudalegacy             =   1.25 sec*proc (3 tests)
opencv_cudaobjdetect          =   1.84 sec*proc (3 tests)
opencv_cudaoptflow            =   1.76 sec*proc (3 tests)
opencv_cudastereo             =   1.62 sec*proc (3 tests)
opencv_cudawarping            =   1.65 sec*proc (3 tests)
opencv_cudev                  =   0.87 sec*proc (1 test)
opencv_cvv                    =   0.04 sec*proc (1 test)
opencv_dnn                    =  89.85 sec*proc (3 tests)
opencv_dnn_superres           =   0.29 sec*proc (3 tests)
opencv_face                   =   0.49 sec*proc (1 test)
opencv_features2d             = 182.79 sec*proc (3 tests)
opencv_flann                  =   0.05 sec*proc (1 test)
opencv_fuzzy                  =   0.07 sec*proc (1 test)
opencv_gapi                   = 1600.97 sec*proc (3 tests)
opencv_highgui                =   0.10 sec*proc (1 test)
opencv_img_hash               =   0.10 sec*proc (1 test)
opencv_imgcodecs              =  33.23 sec*proc (3 tests)
opencv_imgproc                = 1932.71 sec*proc (3 tests)
opencv_intensity_transform    =   0.04 sec*proc (1 test)
opencv_line_descriptor        =  14.35 sec*proc (3 tests)
opencv_mcc                    =   0.45 sec*proc (1 test)
opencv_ml                     =   7.43 sec*proc (1 test)
opencv_objdetect              = 101.37 sec*proc (3 tests)
opencv_optflow                =  26.89 sec*proc (3 tests)
opencv_phase_unwrapping       =   0.58 sec*proc (1 test)
opencv_photo                  =   1.70 sec*proc (3 tests)
opencv_quality                =   0.06 sec*proc (1 test)
opencv_rapid                  =   0.09 sec*proc (1 test)
opencv_reg                    =   5.20 sec*proc (3 tests)
opencv_rgbd                   = 136.01 sec*proc (3 tests)
opencv_saliency               =   0.05 sec*proc (1 test)
opencv_shape                  =   0.05 sec*proc (1 test)
opencv_stereo                 =  17.74 sec*proc (3 tests)
opencv_stitching              =  75.31 sec*proc (3 tests)
opencv_structured_light       =   3.32 sec*proc (1 test)
opencv_superres               =   1.48 sec*proc (3 tests)
opencv_text                   =   0.07 sec*proc (1 test)
opencv_tracking               =   5.46 sec*proc (3 tests)
opencv_video                  =  58.96 sec*proc (3 tests)
opencv_videoio                =   3.31 sec*proc (3 tests)
opencv_videostab              =   6.40 sec*proc (1 test)
opencv_xfeatures2d            =   1.49 sec*proc (3 tests)
opencv_ximgproc               = 896.27 sec*proc (3 tests)
opencv_xphoto                 =  13.45 sec*proc (3 tests)

Total Test time (real) = 7058.10 sec

The following tests FAILED:
      1 - opencv_test_cudev (Failed)
      2 - opencv_test_core (Failed)
      4 - opencv_sanity_core (Failed)
      5 - opencv_test_cudaarithm (SEGFAULT)
      6 - opencv_perf_cudaarithm (Child aborted)
      7 - opencv_sanity_cudaarithm (Child aborted)
      9 - opencv_test_imgproc (Failed)
     10 - opencv_perf_imgproc (Failed)
     11 - opencv_sanity_imgproc (Failed)
     12 - opencv_test_intensity_transform (Failed)
     13 - opencv_test_ml (Failed)
     15 - opencv_test_quality (Failed)
     16 - opencv_test_reg (Failed)
     19 - opencv_test_cudafilters (SEGFAULT)
     20 - opencv_perf_cudafilters (Child aborted)
     21 - opencv_sanity_cudafilters (Child aborted)
     22 - opencv_test_cudaimgproc (SEGFAULT)
     23 - opencv_perf_cudaimgproc (Child aborted)
     24 - opencv_sanity_cudaimgproc (Child aborted)
     25 - opencv_test_cudawarping (SEGFAULT)
     26 - opencv_perf_cudawarping (Child aborted)
     27 - opencv_sanity_cudawarping (Child aborted)
     28 - opencv_test_dnn (Failed)
     29 - opencv_perf_dnn (Failed)
     30 - opencv_sanity_dnn (Failed)
     31 - opencv_test_dnn_superres (Failed)
     32 - opencv_perf_dnn_superres (Failed)
     33 - opencv_sanity_dnn_superres (Failed)
     34 - opencv_test_features2d (Failed)
     35 - opencv_perf_features2d (Failed)
     36 - opencv_sanity_features2d (Failed)
     37 - opencv_test_fuzzy (Failed)
     39 - opencv_test_imgcodecs (Failed)
     42 - opencv_test_line_descriptor (Failed)
     45 - opencv_test_photo (Failed)
     46 - opencv_perf_photo (Child aborted)
     47 - opencv_sanity_photo (Child aborted)
     49 - opencv_test_text (Failed)
     50 - opencv_test_videoio (Failed)
     51 - opencv_perf_videoio (Failed)
     52 - opencv_sanity_videoio (Failed)
     53 - opencv_test_xphoto (Failed)
     55 - opencv_sanity_xphoto (Failed)
     56 - opencv_test_calib3d (Failed)
     57 - opencv_perf_calib3d (Failed)
     58 - opencv_sanity_calib3d (Failed)
     59 - opencv_test_cudacodec (SEGFAULT)
     60 - opencv_perf_cudacodec (Child aborted)
     61 - opencv_sanity_cudacodec (Child aborted)
     62 - opencv_test_cudafeatures2d (SEGFAULT)
     63 - opencv_perf_cudafeatures2d (Child aborted)
     64 - opencv_sanity_cudafeatures2d (Child aborted)
     65 - opencv_test_cudastereo (SEGFAULT)
     66 - opencv_perf_cudastereo (Child aborted)
     67 - opencv_sanity_cudastereo (Child aborted)
     69 - opencv_test_highgui (Failed)
     70 - opencv_test_mcc (Failed)
     71 - opencv_test_objdetect (Failed)
     72 - opencv_perf_objdetect (Failed)
     73 - opencv_sanity_objdetect (Failed)
     75 - opencv_test_rgbd (Failed)
     78 - opencv_test_shape (Failed)
     79 - opencv_test_structured_light (Failed)
     80 - opencv_test_video (Failed)
     81 - opencv_perf_video (Failed)
     82 - opencv_sanity_video (Failed)
     83 - opencv_test_xfeatures2d (Failed)
     84 - opencv_perf_xfeatures2d (Child aborted)
     85 - opencv_sanity_xfeatures2d (Child aborted)
     86 - opencv_test_ximgproc (Failed)
     87 - opencv_perf_ximgproc (Failed)
     88 - opencv_sanity_ximgproc (Failed)
     90 - opencv_test_bgsegm (Failed)
     91 - opencv_test_bioinspired (Failed)
     92 - opencv_perf_bioinspired (Failed)
     93 - opencv_sanity_bioinspired (Failed)
     94 - opencv_test_cudabgsegm (SEGFAULT)
     95 - opencv_perf_cudabgsegm (Child aborted)
     96 - opencv_sanity_cudabgsegm (Child aborted)
     97 - opencv_test_cudalegacy (Failed)
     98 - opencv_perf_cudalegacy (Child aborted)
     99 - opencv_sanity_cudalegacy (Child aborted)
    100 - opencv_test_cudaobjdetect (SEGFAULT)
    101 - opencv_perf_cudaobjdetect (Child aborted)
    102 - opencv_sanity_cudaobjdetect (Child aborted)
    103 - opencv_test_face (Failed)
    104 - opencv_test_gapi (Failed)
    105 - opencv_perf_gapi (Failed)
    106 - opencv_sanity_gapi (Failed)
    107 - opencv_test_optflow (Failed)
    108 - opencv_perf_optflow (Failed)
    109 - opencv_sanity_optflow (Failed)
    110 - opencv_test_stitching (Failed)
    111 - opencv_perf_stitching (Failed)
    112 - opencv_sanity_stitching (Failed)
    113 - opencv_test_tracking (Failed)
    114 - opencv_perf_tracking (Failed)
    115 - opencv_sanity_tracking (Failed)
    116 - opencv_test_cudaoptflow (SEGFAULT)
    117 - opencv_perf_cudaoptflow (Child aborted)
    118 - opencv_sanity_cudaoptflow (Child aborted)
    119 - opencv_test_stereo (Failed)
    123 - opencv_perf_superres (Child aborted)
    124 - opencv_sanity_superres (Child aborted)
Errors while running CTest
Makefile:106: recipe for target 'test' failed
make: *** [test] Error 8

As you can see most tests fail. What does that mean and how can i fix it? Not all tests fail, which is weird…

Can anyone tell me what is broken and how i fix it? I can’t put all those clues together myself and need someone who knows more than me.

Just for good measure i also include the info tab of jtop for the reader. maybe it does help someone to understand my problem:

NVIDIA Jetson TX2 - Jetpack 4.2.2 [L4T 32.2.1]
Cuda ARCH: 6.2
CUDA: 10.2.89
OpenCV: 4.5.1-pcompiled CUDA: YES

Also here is my nvcc output:

$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Wed_Oct_23_21:14:42_PDT_2019
Cuda compilation tools, release 10.2, V10.2.89

I can’t really reflash the jetson because i would loose all kinds of other libraries and programs that came with the device. It would be lots of work to make them all work again. So if at all possible i would like to fix this without a reflash of the jetson…

Hi,

Do you pick up a cuda from jetpack4.4.x to jetpack4.2.2?

i used the nvidia sdk version 4.4.x

HI,

You should only use the suitable cuda version for specific driver package.

NVIDIA Jetson TX2 - Jetpack 4.2.2 [L4T 32.2.1]

If your version is 4.2.2, then you should pick the cuda from jetpack4.2.2 but not directly use something from 4.4.

how would i downgrade to 4.4.2?

in addition. Can i just reinstall the cuda from 4.4.2 over the already existing installment?

edit:

ok i restarted nvidia sdk and chose 4.2.2 (rev1) this time. I selected to install the ´jeston sdk cmoponents´ which included cuda, ai, computer vision, nvidia container runtime and multimedia. All of them got a red exclamation mark with the word error next to it. The only one that worked was CUDA.

here is the terminal output from ´export logs´:

SDKM_logs_JetPack_4.2.2_(rev.1)_Linux_for_Jetson_TX2_2020-12-07_13-06-35.zip (184.0 KB)

how can i install it now? Do i need to remove the colliding files manually? and if so would´t it break everything?

Hello,

There are two kinds of error from your log.

  1. Host component installation error
    OpenCV and VisionWorks: There are old version of OpenCV, which is causing installation conflict. Please uninstall old version of JetPack first, then reinstall.

  2. Target components installation error.
    Again, please make sure you are really using the same jetpack version between sdk and BSP.
    I don’t know what BSP base XIMEA provided. Please ask them to make sure the BSP version first. Also, you can ask them if they have any special method to install the sdk.

It worked.

I just rebuild openCV with my flags and it worked. I can run cuda samples etc.

However running the XIMEA example i only get a black image. But no errors on cuda or version conflicts.

1 Like

I think this would only work with GTK2 backend, not QT.
So you may try rebuilding opencv with: -D WITH_GTK=ON -D WITH_GTK_2_X=ON instead of -D WITH_QT=1.
Before this, it would be quicker to confirm this cause just downloading the GpuMat into a CPU Mat and use the latter one for imshow.

1 Like

That sounds like it might be it. Being new to cuda: how would i download a GpuMat to Cpu?

If i run the example not with transport layer but with RGB24 for example then i can see the video but of course with 5fps.

Unable to test now, but you may try:

...
// Apply static white balance by multiplying the channels
cuda::multiply(gpu_mat_color, cv::Scalar(WB_BLUE, WB_GREEN, WB_RED), gpu_mat_color);

// download to cpu mat
 cv::Mat cpuFrame;
gpu_mat_color.download(cpuFrame);

// Render image to the screen (using CPU mat)
imshow("XIMEA camera", cpuFrame);
waitKey(1);
...
1 Like

The code snippet seemed to work fine but the window was still black

this is how my code looks like:

  // Apply static white balance by multiplying the channels
  cuda::multiply(gpu_mat_color, cv::Scalar(WB_BLUE, WB_GREEN, WB_RED), gpu_mat_color);

  // download to cpu mat
  cv::Mat cpuFrame;
  gpu_mat_color.download(cpuFrame);

  // Render image to the screen (using CPU mat)
  imshow("XIMEA camera", cpuFrame);


  // Render image to the screen (using OpenGL)
  //imshow("XIMEA camera", gpu_mat_color);
  waitKey(1);

I missed that, but probably you would have to remove cv::WINDOW_OPENGL flag for the window if using a CPU Mat:

...
namedWindow("XIMEA camera", cv::WINDOW_NORMAL);
...
1 Like

that worked!
The fps is still limited but i think if i rebuild openCV with openGL this might be fixed. Thank you. I will reply when i have tried it with openGL.

I´m having troubles rebuilding with the new flags:

cmake -D CMAKE_BUILD_TYPE=Release \
      -D WITH_TBB=ON \
      -D WITH_CUDA=ON \
      -D WITH_NVCUVID=ON \
      -D WITH_CUBLAS=ON \
      -D WITH_V4L=ON \
      -D WITH_OPENGL=ON \
      -D WITH_GTK=ON \
      -D WITH_GTK_2_X=ON \
      -D WITH_GSTREAMER=ON \
      -D BUILD_opencv_cudacodec=ON \
      -D OPENCV_ENABLE_NONFREE=ON \
      -D OPENCV_GENERATE_PKGCONFIG=ON \
      -D PYTHON_DEFAULT_EXECUTABLE=$(which python3) \
      -D OPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules \
      -D WITH_WEBP=OFF \
      -D BUILD_TEST=OFF \
      -D BUILD_PERF_TEST=OFF \
      -D BUILD_DOCS=OFF \
       ..

i disabled some tests just so it compiles faster.

openGl support is set to NO:

--   GUI: 
--     GTK+:                        YES (ver 2.24.32)
--       GThread :                  YES (ver 2.56.4)
--       GtkGlExt:                  NO
--     OpenGL support:              NO
--     VTK support:                 NO

EDIT:

installed a missing library with

sudo apt-get install libgtkglext1-dev

now it says it has opengl support:

--   GUI: 
--     GTK+:                        YES (ver 2.24.32)
--       GThread :                  YES (ver 2.56.4)
--       GtkGlExt:                  YES (ver 1.2.0)
--     OpenGL support:              YES (/usr/lib/aarch64-linux-gnu/libGL.so /usr/lib/aarch64-linux-gnu/libGLU.so)
--     VTK support:                 NO