julianassmann / opencv-cuda-docker Goto Github PK
View Code? Open in Web Editor NEWDockerfiles for OpenCV compiled with CUDA, opencv_contrib modules and Python 3 bindings
License: MIT License
Dockerfiles for OpenCV compiled with CUDA, opencv_contrib modules and Python 3 bindings
License: MIT License
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'
at start of Dockerfile do:
ENV TZ=Europe/Kiev
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
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.cpp
pkg-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.
Please add a table with available versions to the README.
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.