{"id":15632361,"url":"https://github.com/tobybreckon/python-examples-cv","last_synced_at":"2025-04-13T00:48:07.496Z","repository":{"id":152042025,"uuid":"70469801","full_name":"tobybreckon/python-examples-cv","owner":"tobybreckon","description":"OpenCV Python Computer Vision Examples used for Teaching","archived":false,"fork":false,"pushed_at":"2025-02-25T14:58:24.000Z","size":364,"stargazers_count":181,"open_issues_count":0,"forks_count":69,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-13T00:48:01.646Z","etag":null,"topics":["computer-vision","opencv","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tobybreckon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-10-10T08:52:55.000Z","updated_at":"2025-03-26T17:54:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"476b1c9c-afc9-4cd2-8b75-2cbf4357041e","html_url":"https://github.com/tobybreckon/python-examples-cv","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobybreckon%2Fpython-examples-cv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobybreckon%2Fpython-examples-cv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobybreckon%2Fpython-examples-cv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobybreckon%2Fpython-examples-cv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tobybreckon","download_url":"https://codeload.github.com/tobybreckon/python-examples-cv/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248650437,"owners_count":21139672,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["computer-vision","opencv","python"],"created_at":"2024-10-03T10:43:45.896Z","updated_at":"2025-04-13T00:48:07.463Z","avatar_url":"https://github.com/tobybreckon.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Python Computer Vision OpenCV Teaching Examples\n\nOpenCV Python computer vision examples used for teaching within the undergraduate Computer Science programme\nat [Durham University](http://www.durham.ac.uk) (UK) by [Prof. Toby Breckon](https://breckon.org/toby/).\n\n![Python - PEP8](https://github.com/tobybreckon/python-examples-cv/workflows/Python%20-%20PEP8/badge.svg)\n\nAll tested with [OpenCV](http://www.opencv.org) 3.x / 4.x and Python 3.x.\n\n```\n# Example : \u003c................................\u003e processing from a video file\n# specified on the command line (e.g. python FILE.py video_file) or from an\n# attached web camera\n```\n---\n\n### Background:\n\nDirectly adapted (and in some cases extended/added to) from the [C++](https://github.com/tobybreckon/cpp-examples-ipcv.git) and earlier [C](https://github.com/tobybreckon/c-examples-ipcv.git) language teaching examples used to generate the video examples within the ebook version of:\n\n[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.\n[[Google Books](http://books.google.co.uk/books?id=TaEQAgAAQBAJ\u0026lpg=PP1\u0026dq=isbn%3A1118706811\u0026pg=PP1v=onepage\u0026q\u0026f=false)] [[doi](http://dx.doi.org/10.1002/9781119286462)]\n\nNotably, the [C++](https://github.com/tobybreckon/cpp-examples-ipcv.git) examples may contain further speed optimizations in some cases.\n\nA related supporting set of [Python Image Processing OpenCV Teaching Examples](https://github.com/tobybreckon/python-examples-ip.git) are also available covering basic image processing operations.\n\n---\n\n### How to download and run:\n\nDownload each file as needed or to download the entire repository and run each try:\n\n```\ngit clone https://github.com/tobybreckon/python-examples-cv.git\ncd python-examples-cv\npython3 ./\u003cinsert file name of one of the examples\u003e.py [optional video file]\n```\n\nDemo source code is provided _\"as is\"_ to aid learning and understanding of topics on the course and beyond.\n\nMost 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:\n\n```\n$ python3 ./generic_interface.py -h\nusage: generic_interface.py [-h] [-c CAMERA_TO_USE] [-r RESCALE] [-fs]\n                            [video_file]\n\nPerform ./generic_interface.py example operation on incoming camera/video\nimage\n\npositional arguments:\n  video_file            specify optional video file\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -c CAMERA_TO_USE, --camera_to_use CAMERA_TO_USE\n                        specify camera to use\n  -r RESCALE, --rescale RESCALE\n                        rescale image by this factor\n\n```\n\nFor 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.\n\nUse script ```sh download-models.sh``` to download CNN model files associated with some examples.\n\n---\n\n### Re-usable Exemplar Components (Python Classes):\n\nThis codebase contains the following re-usable exemplar elements:\n\n- ```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).\n\n- ```h_concatenate()``` - a re-usable function for horiozontal image concatenation for display in single window handling variations in size/channels (see ```chromaticity_lightness.py```).\n\n---\n\n### References:\n\nIf 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).\n\nFor the SGBM stereo vision and camera calibration examples, reference:\n```\n@Article{mroz12stereo,\n  author = \t {Mroz, F. and Breckon, T.P.},\n  title = \t {An Empirical Comparison of Real-time Dense Stereo Approaches for use in the Automotive Environment},\n  journal =  {EURASIP Journal on Image and Video Processing},\n  year =     {2012},\n  volume = \t {2012},\n  number = \t {13},\n  pages = \t {1-19},\n  publisher = {Springer},\n  url = \t {https://breckon.org/toby/publications/papers/mroz12stereo.pdf},\n  doi = \t {10.1186/1687-5281-2012-13}\n}\n```\n\nFor the Mixture of Gaussian (MOG) background subtraction and Kalman filtering example, reference:\n```\n@InProceedings{kundegorski14photogrammetric,\n  author = \t {Kundegorski, M.E. and Breckon, T.P.},\n  title = \t {A Photogrammetric Approach for Real-time 3D Localization and Tracking of Pedestrians in Monocular Infrared Imagery},\n  booktitle = {Proc. SPIE Optics and Photonics for Counterterrorism, Crime Fighting and Defence},\n  year = \t    {2014},\n  month =     {September},\n  volume =    {9253},\n  number =    {01},\n  publisher = {SPIE},\n  pages =     {1-16},\n  url = \t {https://breckon.org/toby/publications/papers/kundegorski14photogrammetric.pdf},\n  doi = \t {10.1117/12.2065673}\n}\n```\n\n\nFor the DoG, Canny, contour, Harris  and Sobel examples, please reference:\n```\n@Book{solomonbreckon10fundamentals,\n  author = \t {Solomon, C.J. and Breckon, T.P.},\n  title = \t {Fundamentals of Digital Image Processing: A Practical Approach with Examples in Matlab},\n  publisher = \t {Wiley-Blackwell},\n  year = \t {2010},\n  isbn = {0470844736},\n  doi = \t {10.1002/9780470689776},\n  note = {ISBN-13: 978-0470844731},\n}\n```\n\nFor all other examples reference the original paper as outlined in the OpenCV manual or the header comment of the ```.py``` example file.\n\n---\n\nIf you find any bugs raise an issue (or much better still submit a git pull request with a fix) - toby.breckon@durham.ac.uk\n\n_\"may the source be with you\"_ - anon.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftobybreckon%2Fpython-examples-cv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftobybreckon%2Fpython-examples-cv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftobybreckon%2Fpython-examples-cv/lists"}