Skip to content

The Docker image including Ubuntu 18.04, Python 3.6, OpenCV 3.4.5 and Jupyter Notebook to explore computer-vision topics

License

Notifications You must be signed in to change notification settings

jagin/opencv-notebooks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenCV with Jupyter Notebooks Docker Image

The Docker image including Ubuntu 18.04, Python 3.6, OpenCV 3.4.5 and Jupyter Notebook to explore computer-vision topics.

Image content

  • Ubuntu 18.04
  • Python3.6 as default Python interpreter
  • OpenCV 3.4.5 compiled with extra modules, highgui and Python support
  • Jupyter notebook web server
  • Sample Jupyter notebook workspace structure

Quick start

To clone and run this repository you'll need Git and Docker installed on your computer. From your command line:

# Clone this repository
git clone https://github.com/jagin/opencv-notebooks
# Go into the repository
cd opencv-notebooks
# Build the Docker image (be patient it can take an hour or more)
docker build -t opencv-notebooks .
# Run the container
docker run --name opencv-notebooks -p 8888:8888 --rm opencv-notebooks

Open Jupyter sample notebooks at http://127.0.0.1:8888/tree/notebooks

Note 1: any modification in the notebooks will be lost at the container termination. See Persisting your notebooks.
Note 2: --rm option automatically clean up the container and remove the file system when the container exits.

Jupyter notebooks workspace

The repository contains sample notebooks workspace proposition to run the notebooks and do your own explorations. Feel free to fork the repository and do your own changes.

First you will want to add custom requirements to your Python packages in requirements.txt. After changing this file you will need to rebuild the image but thanks to docker layers it will not compile OpenCV taking our time once again.

The notebooks workspace has the following structure:

notebooks/
├── assets
├── downloads
├── output
├── scripts
└── tests
  • notebooks - the main directory for your notebooks
  • assets - here you store all different assets used in your notebooks (like images or other media files)
  • downloads - this directory will be used to store external files downloaded from internet (the content of this directory will not be pushed to the repository)
  • output - this directory will be storing all the results produced by your notebooks
  • scripts - your Python scripts and custom packages
  • tests - Python test scripts

Jupyter notebooks

Notebook Local link
Face detection using Haar Feature-based Cascade Classifiers http://127.0.0.1:8888/notebooks/face_recognition.ipynb
Convert video to gray scale using OpenCV http://127.0.0.1:8888/notebooks/video_convert_to_gray.ipynb

Jupyter configuration

Jupyter configuration is stored in .jupyter directory. Changing Jupyter settings will require to rebuild the image.

Persisting your notebooks

To persist modifications to notebooks and other workspace files, you must mount a directory on the host inside the container using the -v option. In the following example, the host directory ./notebooks of the repository is mounted on the container directory /root/notebooks (but you can mount your own directory):

docker run --name opencv-notebooks -p 8888:8888 -v $(pwd)/notebooks:/root/notebooks --rm opencv-notebooks

Modifications inside ./notebooks are persisted in the corresponding host directory, /root/notebooks.

Credits

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

The Docker image including Ubuntu 18.04, Python 3.6, OpenCV 3.4.5 and Jupyter Notebook to explore computer-vision topics

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages