Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tobybreckon/python-examples-ip
OpenCV Python Image Processing Examples used for Teaching
https://github.com/tobybreckon/python-examples-ip
image-processing opencv python webcam
Last synced: 6 days ago
JSON representation
OpenCV Python Image Processing Examples used for Teaching
- Host: GitHub
- URL: https://github.com/tobybreckon/python-examples-ip
- Owner: tobybreckon
- License: lgpl-3.0
- Created: 2016-11-07T18:36:15.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2024-10-09T12:49:31.000Z (about 1 month ago)
- Last Synced: 2024-10-30T00:49:38.271Z (16 days ago)
- Topics: image-processing, opencv, python, webcam
- Language: Python
- Homepage:
- Size: 170 KB
- Stars: 25
- Watchers: 3
- Forks: 11
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Python Image Processing OpenCV Teaching Examples
OpenCV Python image processing examples used for teaching within the undergraduate Computer Science programme
at [Durham University](http://www.durham.ac.uk) (UK) by [Prof. Toby Breckon](https://breckon.org/toby/).![Python - PEP8](https://github.com/tobybreckon/python-examples-ip/workflows/Python%20-%20PEP8/badge.svg)
All tested with [OpenCV](http://www.opencv.org) 3.x / 4.x and Python 3.x.
```
# Example : <................................> processing from a video file
# specified on the command line (e.g. python FILE.py video_file) or from an
# attached web camera
```More generally most of the examples accessing camera or video can be used as follows:
```
python3 ./skeleton.py -h
usage: skeleton.py [-h] [-c CAMERA_TO_USE] [-r RESCALE] [video_file]Perform ./skeleton.py example operation on incoming camera/video image
positional arguments:
video_file specify optional video fileoptional arguments:
-h, --help show this help message and exit
-c CAMERA_TO_USE, --camera_to_use CAMERA_TO_USE
specify camera to use
-r RESCALE, --rescale RESCALE
rescale image by this factor
```Most run with a webcam connected or from a command line supplied video file of a format OpenCV supports on your system (supplied as a command line argument as per above).
Demo source code is provided _"as is"_ to aid learning and understanding of topics on the course and beyond.
---
### Background:
Directly adapted from the [C++](https://github.com/tobybreckon/cpp-examples-ipcv.git) and earlier [C](https://github.com/tobybreckon/cpp-examples-ipcv.git) language teaching examples used to generate the video examples within the ebook version of:
[Dictionary of Computer Vision and Image Processing](http://dx.doi.org/10.1002/9781119286462) (R.B. Fisher, T.P. Breckon, K. Dawson-Howe, A. Fitzgibbon, C. Robertson, E. Trucco, C.K.I. Williams), Wiley, 2014.
[[Google Books](http://books.google.co.uk/books?id=TaEQAgAAQBAJ&lpg=PP1&dq=isbn%3A1118706811&pg=PP1v=onepage&q&f=false)] [[doi](http://dx.doi.org/10.1002/9781119286462)]Notably, the [C++](https://github.com/tobybreckon/cpp-examples-ipcv.git) examples may contain further speed optimizations.
---
### How to download and run:Download each file as needed or to download the entire repository and run each try:
```
git clone https://github.com/tobybreckon/python-examples-ip.git
cd python-examples-ip
python3 ./.py [optional video file]
```An extremely simple example to check if OpenCV and the other python libraries commonly needed by these examples are present/working on your system and which version of them is in use, is the ``version.py`` example:
```
python3 ./version.py
```which should then output something like this (but with the _"x"_ elements completed
specific to your system install):```
We are using OpenCV: x.x.x
.. do we have the Open CV Contrib Modules: xxxx
We are using numpy: x.x.x
We are using matplotlib: x.x.x
.. and this is in Python: x.x.x (default, xxxxx) [xxx]
```More generally an extended set of [OpenCV functionality tests](TESTING.md) is available (used to check OpenCV itself is working) and also a simple bash shell script (``test_all.sh``) to run through all the examples for semi-automated testing.
---
### Re-usable Exemplar Components (Python Classes):
This codebase contains the following re-usable exemplar elements:
- ```camera_stream.py``` - a re-usable threaded camera class, that is call compatible with the existing OpenCV VideoCapture class, designed to always deliver the latest frame from a single camera without buffering delays (used by all examples if available).
The master copy of the above is available from the the [OpenCV Python Computer Vision Examples used for Teaching](https://github.com/tobybreckon/python-examples-cv) repository.
---
### Reference:
All techniques are fully explained in corresponding section of:
_Fundamentals of Digital Image Processing: A Practical Approach with Examples in Matlab_,
Chris J. Solomon and Toby P. Breckon, Wiley-Blackwell, 2010
ISBN: 0470844736, DOI:10.1002/9780470689776, http://www.fundipbook.com(which also has Matlab code examples of many of the same techniques here - [https://github.com/tobybreckon/solomon-breckon-book.git]( https://github.com/tobybreckon/solomon-breckon-book.git))
```
@Book{solomonbreckon10fundamentals,
author = {Solomon, C.J. and Breckon, T.P.},
title = {Fundamentals of Digital Image Processing: A Practical Approach with Examples in Matlab},
publisher = {Wiley-Blackwell},
year = {2010},
isbn = {0470844736},
doi = {10.1002/9780470689776},
url = {http://www.fundipbook.com}
}
```---
If you find any bugs raise an issue (or much better still submit a git pull request with a fix) - [email protected]
_"may the source be with you"_ - anon.