OpenCV4 C++ development environment (based on Ubuntu)
10K+
The tag is in the form {ubuntu-version}-{opencv-version}.
For eaxmple, the tag 16.04-4.1.0 means the base image is ubuntu:16.04 and contains OpenCV 4.1.0.
OpenCV is built with:
cmake \
-D BUILD_DOCS=OFF \
-D BUILD_EXAMPLES=OFF \
-D BUILD_opencv_apps=OFF \
-D BUILD_PERF_TESTS=OFF \
-D BUILD_TBB=OFF \
-D BUILD_TESTS=OFF \
-D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules \
-D OPENCV_GENERATE_PKGCONFIG=ON ..
All images in this repository contain OpenCV's extra modules (opencv_contrib).
pkg-config uses opencv4 (and not opencv) for OpenCV4.
For example, use pkg-config --cflags --libs opencv4.
main.cpp#include <iostream>
// Even though we are using OpenCV 4,
// the include is still "opencv2".
// This is not a configuration error.
#include <opencv2/opencv.hpp>
int main() {
// Complete build information
std::cout << cv::getBuildInformation() << std::endl;
// Only OpenCV version (major, minor, and patch versions)
std::cout << "OpenCV version: " << CV_VERSION << std::endl;
}
docker run --rm \
-v "$PWD:/app" \
--workdir "/app" \
--user="$(id -u):$(id -g)" \
"jonstonchan/opencv4:20.04-4.5.5" \
bash -c \
'g++ main.cpp -o app $(pkg-config --cflags --libs opencv4) && ./app'
Warning: if you attempt to run ./app outside of Docker without installing OpenCV,
you will get an error (./app: error while loading shared libraries: libopencv_core.so.405: cannot open shared object file: No such file or directory)
Content type
Image
Digest
sha256:0c2c91299…
Size
423.6 MB
Last updated
over 2 years ago
docker pull jonstonchan/opencv4