Cuda opencv in docker

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU) AGX Xavier/1080Ti
• DeepStream Version 5.0
• JetPack Version (valid for Jetson only) 4.4
• NVIDIA GPU Driver Version (valid for GPU only) 440.100

Refer to my question here, I am developing deepstream plugin in a docker container (docker pull nvcr.io/nvidia/deepstream:5.0-20.07-triton) running on my PC using 1080Ti on ubuntu 18.04. Then deploy to my AGX Xavier. I recently installed cuda opencv on my AGX Xavier to enable gstdsexample plugin to run opencv filter in cuda. (see the jetson cuda opencv installation script here)

Question: is there a script that I can install the cuda opencv (or equivalent) in my docker container that run on dGPU? such that I can develop deepstream plug in in my PC instead and once mature, deploy to AGX Xavier. Thank you very much for your help

is there a script that I can install the cuda opencv (or equivalent) in my docker container that run on dGPU?

could try below script to build the opencv-3.4.0

 $ mkdir build
 $ cd build
 $ cmake -D CMAKE_BUILD_TYPE=RELEASE   -D WITH_CUDA=on -D ENABLE_FAST_MATH=1 -D CUDA_FAST_MATH=1 -D WITH_CUBLAS=1 -D WITH_NVCUVID=on -D CUDA_GENERATION=Auto   -D WITH_OPENCL=off -D WITH_OPENCL_SVM=off -D WITH_OPENCLAMDFFT=off -D WITH_OPENCLAMDBLAS=off -D BUILD_opencv_cudacodec=OFF ..
 $ make -j8
 $ make install

Thanks for the info. And try it. It fails with following error message:

root@06836899da24:/home/cuda_opencv/build# cmake -D CMAKE_BUILD_TYPE=RELEASE   -D WITH_CUDA=on -D ENABLE_FAST_MATH=1 -D CUDA_FAST_MATH=1 -D WITH_CUBLAS=1 -D WITH_NVCUVID=on -D CUDA_GENERATION=Auto   -D WITH_OPENCL=off -D WITH_OPENCL_SVM=off -D WITH_OPENCLAMDFFT=off -D WITH_OPENCLAMDBLAS=off -D BUILD_opencv_cudacodec=OFF ..
CMake Error: The source directory "/home/cuda_opencv" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.

what’s your exatc steps to build OpenCV? Please share as detail as you can

Thank you for the following up.

Now I am able to install cuda opencv on the docker using exactly the same script.

1 Like

Hi ynjiun, could you share your dockerFile? I’va issues to compile opencv with the script. My dockerfile is:

FROM nvcr.io/nvidia/deepstream-l4t:5.0-20.07-samples
COPY install_opencv4.3.0_Jetson.sh .
RUN ./install_opencv4.3.0_Jetson.sh /user/local/src

To RUN the script I have to delete all “sudo” in the file and add unzip the install list.
Everything goes well but CMAKE faild in the process
Thanks a lot! Hernán.

did you install cmake?

The following are the steps I install my cuda opencv:

  1. edit install_opencv4.3.0_Jetson.sh to remove all “sudo” and uncomment “make install”
  2. apt install zip unzip
  3. apt install cmake
  4. mkdir build
  5. ./install_opencv4.3.0_Jetson.sh build

I hope it helps.

Thanks a lot ynjiun :).
I forget to launch the docker build process with the runtime=nvidia :). Now its complete the process.
Thanks!