Giter VIP home page Giter VIP logo

opencv-cuda-docker's Issues

Problem when using Opencv with CUDA

I started my docker with

docker run julianassmann/opencv-cuda:cuda-10.2-opencv-4.2

Then have the following error message when I try to execute a program while using GpuMats
I could built perfectly my code but then..

terminate called after throwing an instance of 'cv::Exception'
what(): OpenCV(4.2.0) /opt/opencv-4.2.0/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'

How to build a simple opencv example inside the container?

I have successfully build one of the images in the repo (I had to change the base though since the one here in the repo does not exist anymore)

I want to try it by building a simple example of opencv using cuda. For example

#include <iostream>
#include "opencv2/opencv.hpp"
   
int main (int argc, char* argv[])
{
    //Read Two Images 
    cv::Mat h_img1 = cv::imread("images/cameraman.tif");
    cv::Mat h_img2 = cv::imread("images/circles.png");
    //Create Memory for storing Images on device
    cv::cuda::GpuMat d_result1,d_img1, d_img2;
    cv::Mat h_result1;
    //Upload Images to device     
    d_img1.upload(h_img1);
    d_img2.upload(h_img2);
​
    cv::cuda::add(d_img1,d_img2, d_result1);
    //Download Result back to host
    d_result1.download(h_result1);
    cv::imshow("Image1 ", h_img1);
    cv::imshow("Image2 ", h_img2);
    cv::imshow("Result addition ", h_result1);
    cv::imwrite("images/result_add.png", h_result1);
    cv::waitKey();
    return 0;
}

I tried to build this with

g++ -std=c++11 -o image_addition one.cpppkg-config --cflags --libs opencv

but it failed

Package opencv was not found in the pkg-config search path.
Perhaps you should add the directory containing `opencv.pc'
to the PKG_CONFIG_PATH environment variable
No package 'opencv' found
one.cpp:2:10: fatal error: opencv2/opencv.hpp: No such file or directory
    2 | #include "opencv2/opencv.hpp"
      |          ^~~~~~~~~~~~~~~~~~~~
compilation terminated

so my question is, how do you build opencv source code with your container??
It seems pkg-config does not find opencv

Please advice.

Error when building due to GPG key

Hi Julian,,

when building the image I get this error message:

Sending build context to Docker daemon 4.096kB
Step 1/4 : FROM nvidia/cuda:11.1-devel-ubuntu20.04
---> 0185bd6d8ed9
Step 2/4 : ARG OPENCV_VERSION=4.5.0
---> Using cache
---> bc03e2b25986
Step 3/4 : RUN apt-get update && apt-get upgrade -y && apt-get install -y python3-pip build-essential cmake git wget unzip yasm pkg-config libswscale-dev libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libavformat-dev libpq-dev libxine2-dev libglew-dev libtiff5-dev zlib1g-dev libjpeg-dev libavcodec-dev libavformat-dev libavutil-dev libpostproc-dev libswscale-dev libeigen3-dev libtbb-dev libgtk2.0-dev pkg-config python3-dev python3-numpy && rm -rf /var/lib/apt/lists/*
---> Running in dbd39bcc9b3e
Get:1 http://archive.ubuntu.com/ubuntu focal InRelease [265 kB]
Get:2 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Get:3 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64 InRelease [1581 B]
Get:4 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB]
Err:3 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64 InRelease
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY A4B469963BF863CC
Ign:6 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu2004/x86_64 InRelease
Get:7 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu2004/x86_64 Release [564 B]
Get:8 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu2004/x86_64 Release.gpg [833 B]
Get:9 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages [1816 kB]
Get:10 http://archive.ubuntu.com/ubuntu focal/universe amd64 Packages [11.3 MB]
Get:11 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu2004/x86_64 Packages [2445 B]
Get:12 http://security.ubuntu.com/ubuntu focal-security/universe amd64 Packages [874 kB]
Get:13 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 Packages [27.5 kB]
Get:14 http://security.ubuntu.com/ubuntu focal-security/restricted amd64 Packages [1174 kB]
Get:15 http://archive.ubuntu.com/ubuntu focal/restricted amd64 Packages [33.4 kB]
Get:16 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 Packages [177 kB]
Get:17 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages [1275 kB]
Get:18 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [2245 kB]
Get:19 http://archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 Packages [30.2 kB]
Get:20 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [1161 kB]
Get:21 http://archive.ubuntu.com/ubuntu focal-updates/restricted amd64 Packages [1252 kB]
Get:22 http://archive.ubuntu.com/ubuntu focal-backports/main amd64 Packages [51.2 kB]
Get:23 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 Packages [26.0 kB]
Reading package lists...
W: GPG error: https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64 InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY A4B469963BF863CC
E: The repository 'https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64 InRelease' is not signed.
The command '/bin/sh -c apt-get update && apt-get upgrade -y && apt-get install -y python3-pip build-essential cmake git wget unzip yasm pkg-config libswscale-dev libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libavformat-dev libpq-dev libxine2-dev libglew-dev libtiff5-dev zlib1g-dev libjpeg-dev libavcodec-dev libavformat-dev libavutil-dev libpostproc-dev libswscale-dev libeigen3-dev libtbb-dev libgtk2.0-dev pkg-config python3-dev python3-numpy && rm -rf /var/lib/apt/lists/*' returned a non-zero code: 100

I hope you can help.

Errors when build

Hello I have tried your docker file for ubuntu18.04 and OPENCV_VERSION=4.3.0 and got this error:

image

Can you help? I build image on Ubuntu 18.04 with 16 CPU cores and Docker version 20.10.7

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.