Skip to content

sumeetoc/docker_python-opencv-ffmpeg

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Docker: Python-OpenCV-FFmpeg(-CUDA)

Repository for clean Dockerfile containing FFmpeg, OpenCV4 and Python2/3, based on Ubuntu 18.04 LTS.

Tags

  • :base Python 2.x/3.x, OpenCV 4.3.0, FFmpeg
  • :cuda Python 2.x/3.x, OpenCV 4.3.0, FFmpeg with CUDA 10.1 support

Build

Build Status CircleCI

First you need to install docker on your local computer, see following tutorial. Note, for running the docker properly you have be logged as superuser otherwise you will face many partial issues which sometimes does not make much sense.

You can build it on your own, note it takes lots of time, be prepared.

git clone <git-repository>
cd docker_python-opencv-ffmpeg
docker image build -t python-opencv-ffmpeg:py36 -f cpu/Dockerfile --build-arg PYTHON_VERSION=3.6 .

To build other versions, select different Dockerfile.

docker image list
docker run --rm -it python-opencv-ffmpeg:py36 bash
docker image rm python-opencv-ffmpeg:py36

Other option is using already build image from DockerHub which is significantly faster. it basically download the already build image.

docker pull borda/docker_python-opencv-ffmpeg

Cleaning In case you fail with some builds, you may need to clean your local storage.

docker image prune

or Docker - How to cleanup (unused) resources

docker images | grep "none"
docker rmi $(docker images | grep "none" | awk '/ / { print $3 }')

or remove all - Some way to clean up

docker rm -vf $(docker ps -aq)
docker rmi -f $(docker images -aq)
docker volume prune -f

Usage

Image has OpenCV4, Python2.7/3.6 and FFmpeg ready to use. Example:

docker run --rm -it -v $PWD:/srv borda/docker_python-opencv-ffmpeg python
>>> import cv2; cv2.VideoCapture(0).read()
# truncated for transparency
(True, array([[[ 0, 43, 37], ...]], dtype=uint8))

Note, server usually doe not have webcam :)

About

Dockerfile containing FFmpeg, OpenCV4 and Python2/3, based on Ubuntu LTS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dockerfile 100.0%