All Projects → tobybreckon → Python Examples Cv

tobybreckon / Python Examples Cv

Licence: lgpl-3.0
OpenCV Python Computer Vision Examples used for Teaching

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Python Examples Cv

Hiitpi
A workout trainer Dash/Flask app that helps track your HIIT workouts by analyzing real-time video streaming from your sweet Pi using machine learning and Edge TPU..
Stars: ✭ 106 (-6.19%)
Mutual labels:  opencv
Aruco tracker
Aruco Markers for pose estimation
Stars: ✭ 111 (-1.77%)
Mutual labels:  opencv
Imagefeaturedetector
A C++ Qt GUI desktop program to calculate Harris, FAST, SIFT and SURF image features with OpenCV
Stars: ✭ 112 (-0.88%)
Mutual labels:  opencv
Selfdrivingcar
A collection of all projects pertaining to different layers in the SDC software stack
Stars: ✭ 107 (-5.31%)
Mutual labels:  opencv
Opencvjs
Complete opencvjs (With the lastest OpenCV 4.0.0+)
Stars: ✭ 108 (-4.42%)
Mutual labels:  opencv
Rvision
Basic computer vision library for R
Stars: ✭ 107 (-5.31%)
Mutual labels:  opencv
Awesome Face Detection
Compare with various detectors - s3fd, dlib, ocv, ocv-dnn, mtcnn-pytorch, face_recognition
Stars: ✭ 106 (-6.19%)
Mutual labels:  opencv
Scriptsdump
The biggest dump of scripts ever!
Stars: ✭ 114 (+0.88%)
Mutual labels:  opencv
Nvidia Gpu Tensor Core Accelerator Pytorch Opencv
A complete machine vision container that includes Jupyter notebooks with built-in code hinting, Anaconda, CUDA-X, TensorRT inference accelerator for Tensor cores, CuPy (GPU drop in replacement for Numpy), PyTorch, TF2, Tensorboard, and OpenCV for accelerated workloads on NVIDIA Tensor cores and GPUs.
Stars: ✭ 110 (-2.65%)
Mutual labels:  opencv
Face Swap Android
Realtime Face Swap Android NDK app full source code. Developed with OpenCV (http://opencv.org) and Dlib C++ (http://dlib.net).
Stars: ✭ 111 (-1.77%)
Mutual labels:  opencv
Androidfacedetection
Android 平台进行人脸检测的几种方案
Stars: ✭ 106 (-6.19%)
Mutual labels:  opencv
Opencv Ndarray Conversion
NumPy ndarray ⇋ OpenCV Mat conversion, that just works.
Stars: ✭ 107 (-5.31%)
Mutual labels:  opencv
Aruco Markers
Working examples/tutorial for detection and pose estimation of ArUco markers with C++
Stars: ✭ 112 (-0.88%)
Mutual labels:  opencv
Opencv Electron
Example for using opencv4nodejs with electron.
Stars: ✭ 107 (-5.31%)
Mutual labels:  opencv
Autoannotationtool
A label tool aim to reduce semantic segmentation label time, rectangle and polygon annotation is supported
Stars: ✭ 113 (+0%)
Mutual labels:  opencv
Arkit Multiplayer
ARKit multiplayer experience explanation & example
Stars: ✭ 106 (-6.19%)
Mutual labels:  opencv
Ios Rubik Solver
An iOS app that detects a 3x3 Rubik's cube, recognizes the color of all cubies, solves it and provides a 3D visualisation of the solving process.
Stars: ✭ 111 (-1.77%)
Mutual labels:  opencv
Real Time Video Mosaic
An implementation of automatic panorama using OpenCV in C++ and Python
Stars: ✭ 114 (+0.88%)
Mutual labels:  opencv
Sobfu
real-time 3D reconstruction of non-rigidly deforming scenes using depth data
Stars: ✭ 113 (+0%)
Mutual labels:  opencv
Studybook
Study E-Book(ComputerVision DeepLearning MachineLearning Math NLP Python ReinforcementLearning)
Stars: ✭ 1,457 (+1189.38%)
Mutual labels:  opencv

Python Computer Vision OpenCV Teaching Examples

OpenCV Python computer vision examples used for teaching within the undergraduate Computer Science programme at Durham University (UK) by Prof. Toby Breckon.

Python - PEP8

All tested with OpenCV 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

Background:

Directly adapted (and in some cases extended/added to) from the C++ and earlier C language teaching examples used to generate the video examples within the ebook version of:

Dictionary of Computer Vision and Image Processing (R.B. Fisher, T.P. Breckon, K. Dawson-Howe, A. Fitzgibbon, C. Robertson, E. Trucco, C.K.I. Williams), Wiley, 2014. [Google Books] [doi]

Notably, the C++ examples may contain further speed optimizations in some cases.

A related supporting set of Python Image Processing OpenCV Teaching Examples are also available covering basic image processing operations.


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-cv.git
cd python-examples-cv
python3 ./<insert file name of one of the examples>.py [optional video file]

Demo source code is provided "as is" to aid learning and understanding of topics on the course and beyond.

Most run with a webcam connected or from a command line supplied video file of a format OpenCV supports on your system (otherwise edit the script to provide your own image source). For examples each individual .py example file can be used as follows:

$ python3 ./generic_interface.py -h
usage: generic_interface.py [-h] [-c CAMERA_TO_USE] [-r RESCALE] [-fs]
                            [video_file]

Perform ./generic_interface.py example operation on incoming camera/video
image

positional arguments:
  video_file            specify optional video file

optional 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

For several of the demos that largely rely on effective demonstration using just a single output window - press the "f" key to run fullscreen. In all examples press "x" to exit.

Use script sh download-models.sh to download CNN model files associated with some examples.


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).

  • h_concatenate() - a re-usable function for horiozontal image concatenation for display in single window handling variations in size/channels (see chromaticity_lightness.py).


References:

If referencing these examples in your own work (e.g "... based on the implementation of REF..."), please reference the related research work from which these sample OpenCV reference implementations were derived (in terms of parameters choice etc., presented in bibtex format).

For the SGBM stereo vision and camera calibration examples, reference:

@Article{mroz12stereo,
  author = 	 {Mroz, F. and Breckon, T.P.},
  title = 	 {An Empirical Comparison of Real-time Dense Stereo Approaches for use in the Automotive Environment},
  journal =  {EURASIP Journal on Image and Video Processing},
  year =     {2012},
  volume = 	 {2012},
  number = 	 {13},
  pages = 	 {1-19},
  publisher = {Springer},
  url = 	 {https://breckon.org/toby/publications/papers/mroz12stereo.pdf},
  doi = 	 {10.1186/1687-5281-2012-13}
}

For the Mixture of Gaussian (MOG) background subtraction and Kalman filtering example, reference:

@InProceedings{kundegorski14photogrammetric,
  author = 	 {Kundegorski, M.E. and Breckon, T.P.},
  title = 	 {A Photogrammetric Approach for Real-time 3D Localization and Tracking of Pedestrians in Monocular Infrared Imagery},
  booktitle = {Proc. SPIE Optics and Photonics for Counterterrorism, Crime Fighting and Defence},
  year = 	    {2014},
  month =     {September},
  volume =    {9253},
  number =    {01},
  publisher = {SPIE},
  pages =     {1-16},
  url = 	 {https://breckon.org/toby/publications/papers/kundegorski14photogrammetric.pdf},
  doi = 	 {10.1117/12.2065673}
}

For the DoG, Canny, contour, Harris and Sobel examples, please reference:

@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},
  note = {ISBN-13: 978-0470844731},
}

For all other examples reference the original paper as outlined in the OpenCV manual or the header comment of the .py example file.


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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].