├── caer ├── py.typed ├── data │ ├── puppy.jpg │ ├── snow.jpg │ ├── tent.jpg │ ├── camera.jpg │ ├── guitar.jpg │ ├── sunrise.jpg │ ├── black_cat.jpg │ ├── gold_fish.jpg │ └── fighter_fish.jpg ├── _meta.py ├── README.md ├── coreten │ └── __init__.py ├── annotations │ └── __init__.py ├── video │ ├── constants.py │ ├── __init__.py │ └── frames_and_fps.py ├── _base.py ├── io │ └── __init__.py ├── preprocessing │ └── __init__.py ├── color │ └── _constants.py ├── globals.py ├── path │ └── __init__.py └── transforms │ ├── blur.py │ └── __init__.py ├── examples ├── README.md ├── GUI │ ├── caer_gui.png │ └── README.md └── thumbs │ ├── camera.jpg │ ├── beverages.jpg │ └── resize-with-ratio.png ├── tests ├── data │ ├── __init__.py │ ├── beverages.jpg │ └── green_fish.jpg ├── path │ ├── __init__.py │ └── media │ │ ├── Seoul - 21118.mp4 │ │ ├── Keyboard - 10822.mp4 │ │ ├── Nature │ │ ├── Bird - 46026.mp4 │ │ ├── v2osk-1Z2niiBPg5A-unsplash.jpg │ │ └── silvestri-matteo-6-C0VRsagUw-unsplash.jpg │ │ ├── jakub-dziubak-XtUd5SiX464-unsplash.jpg │ │ └── README.md ├── video │ └── __init__.py ├── __init__.py ├── adorad │ ├── __init__.py │ └── test_tensor.py ├── transforms │ ├── __init__.py │ └── test_transforms.py ├── io │ ├── test_imsave.py │ └── test_resize.py └── color │ ├── test_bgr.py │ ├── test_hls.py │ ├── test_hsv.py │ ├── test_lab.py │ ├── test_luv.py │ ├── test_yuv.py │ └── test_rgb.py ├── docs ├── source │ ├── _static │ │ └── main.css │ ├── introduction.md │ ├── caer_at_a_glance.rst │ ├── api │ │ ├── path.rst │ │ ├── filters.rst │ │ ├── transforms.rst │ │ ├── preprocessing.rst │ │ ├── video.rst │ │ ├── io.rst │ │ ├── data.rst │ │ └── color.rst │ ├── community │ │ ├── governance.rst │ │ └── CONTRIBUTING.rst │ └── index.rst ├── sphinx-theme │ ├── setup.cfg │ ├── _static │ │ └── thumbs │ │ │ ├── babel.jpg │ │ │ ├── mnist.png │ │ │ ├── cifar10.png │ │ │ ├── favicon.png │ │ │ ├── cartpole.gif │ │ │ ├── cpp_logo.png │ │ │ ├── examples.png │ │ │ ├── torch-logo.png │ │ │ ├── DistPyTorch.jpg │ │ │ ├── seq2seq_flat.png │ │ │ ├── caer-logo-flat.png │ │ │ ├── data_parallel.png │ │ │ ├── pytorch-logo-flat.png │ │ │ ├── char_rnn_generation.png │ │ │ ├── torch-nn-vs-pytorch-nn.png │ │ │ └── tensor_illustration_flat.png │ ├── .gitignore │ ├── images │ │ ├── home-footer-background.jpg │ │ ├── pytorch-download.svg │ │ ├── pytorch-x.svg │ │ ├── logo-facebook-dark.svg │ │ ├── view-page-source-icon.svg │ │ ├── logo-pytorch-icon.svg │ │ ├── chevron-right-orange.svg │ │ ├── chevron-right-white.svg │ │ ├── chevron-down-grey.svg │ │ ├── pytorch-github.svg │ │ ├── arrow-right-with-tail.svg │ │ ├── arrow-down-orange.svg │ │ ├── logo-twitter-dark.svg │ │ ├── icon-close.svg │ │ ├── pytorch-colab.svg │ │ ├── search-icon.svg │ │ ├── logo-pytorch-dark.svg │ │ └── logo-pytorch.svg │ ├── fonts │ │ ├── FreightSans │ │ │ ├── freight-sans-bold.woff │ │ │ ├── freight-sans-bold.woff2 │ │ │ ├── freight-sans-book.woff │ │ │ ├── freight-sans-book.woff2 │ │ │ ├── freight-sans-light.woff │ │ │ ├── freight-sans-light.woff2 │ │ │ ├── freight-sans-medium.woff │ │ │ ├── freight-sans-medium.woff2 │ │ │ ├── freight-sans-bold-italic.woff │ │ │ ├── freight-sans-bold-italic.woff2 │ │ │ ├── freight-sans-book-italic.woff │ │ │ ├── freight-sans-book-italic.woff2 │ │ │ ├── freight-sans-light-italic.woff │ │ │ ├── freight-sans-light-italic.woff2 │ │ │ ├── freight-sans-medium-italic.woff │ │ │ └── freight-sans-medium-italic.woff2 │ │ └── IBMPlexMono │ │ │ ├── IBMPlexMono-Light.woff │ │ │ ├── IBMPlexMono-Light.woff2 │ │ │ ├── IBMPlexMono-Medium.woff │ │ │ ├── IBMPlexMono-Medium.woff2 │ │ │ ├── IBMPlexMono-Regular.woff │ │ │ ├── IBMPlexMono-Regular.woff2 │ │ │ ├── IBMPlexMono-SemiBold.woff │ │ │ └── IBMPlexMono-SemiBold.woff2 │ ├── caer_sphinx_theme │ │ ├── static │ │ │ ├── images │ │ │ │ ├── home-footer-background.jpg │ │ │ │ ├── pytorch-download.svg │ │ │ │ ├── pytorch-x.svg │ │ │ │ ├── logo-facebook-dark.svg │ │ │ │ ├── view-page-source-icon.svg │ │ │ │ ├── logo-pytorch-icon.svg │ │ │ │ ├── chevron-right-orange.svg │ │ │ │ ├── chevron-right-white.svg │ │ │ │ ├── chevron-down-grey.svg │ │ │ │ ├── pytorch-github.svg │ │ │ │ ├── arrow-right-with-tail.svg │ │ │ │ ├── arrow-down-orange.svg │ │ │ │ ├── logo-twitter-dark.svg │ │ │ │ ├── icon-close.svg │ │ │ │ ├── pytorch-colab.svg │ │ │ │ ├── search-icon.svg │ │ │ │ ├── logo-pytorch-dark.svg │ │ │ │ └── logo-pytorch.svg │ │ │ └── fonts │ │ │ │ ├── FreightSans │ │ │ │ ├── freight-sans-bold.woff │ │ │ │ ├── freight-sans-bold.woff2 │ │ │ │ ├── freight-sans-book.woff │ │ │ │ ├── freight-sans-book.woff2 │ │ │ │ ├── freight-sans-light.woff │ │ │ │ ├── freight-sans-light.woff2 │ │ │ │ ├── freight-sans-medium.woff │ │ │ │ ├── freight-sans-medium.woff2 │ │ │ │ ├── freight-sans-bold-italic.woff │ │ │ │ ├── freight-sans-bold-italic.woff2 │ │ │ │ ├── freight-sans-book-italic.woff │ │ │ │ ├── freight-sans-book-italic.woff2 │ │ │ │ ├── freight-sans-light-italic.woff │ │ │ │ ├── freight-sans-light-italic.woff2 │ │ │ │ ├── freight-sans-medium-italic.woff │ │ │ │ └── freight-sans-medium-italic.woff2 │ │ │ │ └── IBMPlexMono │ │ │ │ ├── IBMPlexMono-Light.woff │ │ │ │ ├── IBMPlexMono-Light.woff2 │ │ │ │ ├── IBMPlexMono-Medium.woff │ │ │ │ ├── IBMPlexMono-Medium.woff2 │ │ │ │ ├── IBMPlexMono-Regular.woff │ │ │ │ ├── IBMPlexMono-Regular.woff2 │ │ │ │ ├── IBMPlexMono-SemiBold.woff │ │ │ │ └── IBMPlexMono-SemiBold.woff2 │ │ ├── theme.conf │ │ ├── cookie_banner.html │ │ ├── searchbox.html │ │ ├── __init__.py │ │ ├── theme_variables.jinja │ │ ├── versions.html │ │ ├── search.html │ │ ├── fonts.html │ │ └── footer.html │ ├── caer_sphinx_theme.py │ ├── scss │ │ ├── theme.scss │ │ └── shared │ │ │ ├── _code.scss │ │ │ ├── _base_styles.scss │ │ │ ├── _article.scss │ │ │ └── _variables.scss │ ├── js │ │ ├── pytorch-anchors.js │ │ ├── mobile-toc.js │ │ ├── main-menu-dropdown.js │ │ ├── mobile-menu.js │ │ ├── cookie-banner.js │ │ └── highlight-navigation.js │ ├── LICENSE │ ├── README.md │ └── setup.py ├── make.sh ├── sitemap.xml ├── make.bat ├── Makefile ├── license.md └── how_to │ └── git_how_to.md ├── tools ├── requirements │ ├── test.txt │ ├── default.txt │ ├── build-docs.txt │ └── README.md ├── push_pypi.sh ├── travis │ ├── install.sh │ └── before-install.sh ├── Makefile ├── workflows │ ├── test.yml │ ├── pypi-macos.yml │ ├── pypi-win32.yml │ ├── pypi-win64.yml │ └── pypi-linux.yml ├── replace_version.py └── travis.yml ├── CONTRIBUTORS ├── .github ├── dependabot.yml ├── ISSUE_TEMPLATE │ ├── config.yml │ ├── documentation.md │ ├── feature-request.md │ └── bug_report.md ├── CODEOWNERS ├── FUNDING.yml ├── workflows │ ├── sloc.yml │ ├── test.yml │ ├── codeql_analyze.yml │ ├── code_format.yml │ └── docs.yml ├── PULL_REQUEST_TEMPLATE.md ├── config.yml ├── stale.yml └── CONTRIBUTING.md ├── .codecov.yml ├── MANIFEST.in ├── Makefile ├── mypy.ini ├── .readthedocs.yml ├── .flake8 ├── LICENSE ├── .pep8speaks.yml ├── configs.ini └── setup.cfg /caer/py.typed: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/data/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/path/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/video/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/source/_static/main.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/source/introduction.md: -------------------------------------------------------------------------------- 1 | ## Introduction 2 | 3 | -------------------------------------------------------------------------------- /docs/sphinx-theme/setup.cfg: -------------------------------------------------------------------------------- 1 | [bdist_wheel] 2 | universal = 1 3 | -------------------------------------------------------------------------------- /docs/source/caer_at_a_glance.rst: -------------------------------------------------------------------------------- 1 | Caer at a Glance 2 | ================ -------------------------------------------------------------------------------- /caer/data/puppy.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/caer/data/puppy.jpg -------------------------------------------------------------------------------- /caer/data/snow.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/caer/data/snow.jpg -------------------------------------------------------------------------------- /caer/data/tent.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/caer/data/tent.jpg -------------------------------------------------------------------------------- /caer/data/camera.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/caer/data/camera.jpg -------------------------------------------------------------------------------- /caer/data/guitar.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/caer/data/guitar.jpg -------------------------------------------------------------------------------- /caer/data/sunrise.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/caer/data/sunrise.jpg -------------------------------------------------------------------------------- /caer/data/black_cat.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/caer/data/black_cat.jpg -------------------------------------------------------------------------------- /caer/data/gold_fish.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/caer/data/gold_fish.jpg -------------------------------------------------------------------------------- /docs/make.sh: -------------------------------------------------------------------------------- 1 | rm -rf source/generated 2 | make clean 3 | make html --debug --jobs 2 SPHINXOPTS="-W" -------------------------------------------------------------------------------- /tests/data/beverages.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/tests/data/beverages.jpg -------------------------------------------------------------------------------- /caer/data/fighter_fish.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/caer/data/fighter_fish.jpg -------------------------------------------------------------------------------- /examples/GUI/caer_gui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/examples/GUI/caer_gui.png -------------------------------------------------------------------------------- /examples/thumbs/camera.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/examples/thumbs/camera.jpg -------------------------------------------------------------------------------- /tests/data/green_fish.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/tests/data/green_fish.jpg -------------------------------------------------------------------------------- /tools/requirements/test.txt: -------------------------------------------------------------------------------- 1 | pytest 2 | numpy 3 | opencv-contrib-python 4 | typing_extensions 5 | mypy -------------------------------------------------------------------------------- /docs/source/api/path.rst: -------------------------------------------------------------------------------- 1 | caer.path 2 | =================== 3 | .. automodule:: caer.path 4 | :members: -------------------------------------------------------------------------------- /examples/thumbs/beverages.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/examples/thumbs/beverages.jpg -------------------------------------------------------------------------------- /docs/source/api/filters.rst: -------------------------------------------------------------------------------- 1 | caer.filters 2 | =================== 3 | .. automodule:: caer.filters 4 | :members: -------------------------------------------------------------------------------- /tests/path/media/Seoul - 21118.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/tests/path/media/Seoul - 21118.mp4 -------------------------------------------------------------------------------- /tools/push_pypi.sh: -------------------------------------------------------------------------------- 1 | rm -rf dist 2 | python setup.py sdist bdist_wheel 3 | twine check dist/* 4 | twine upload dist/* -------------------------------------------------------------------------------- /docs/source/api/transforms.rst: -------------------------------------------------------------------------------- 1 | caer.transforms 2 | =================== 3 | .. automodule:: caer.transforms 4 | :members: -------------------------------------------------------------------------------- /examples/thumbs/resize-with-ratio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/examples/thumbs/resize-with-ratio.png -------------------------------------------------------------------------------- /tests/path/media/Keyboard - 10822.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/tests/path/media/Keyboard - 10822.mp4 -------------------------------------------------------------------------------- /tools/requirements/default.txt: -------------------------------------------------------------------------------- 1 | numpy<1.21.3 2 | opencv-contrib-python>=4.2.0 3 | typing_extensions 4 | nptyping 5 | mypy -------------------------------------------------------------------------------- /CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | @jasmcaus 2 | 3 | Special Thanks to: 4 | @MalikMAlna 5 | @lucasace 6 | @GitHubDragonFly 7 | @brccabral 8 | @theSekyi -------------------------------------------------------------------------------- /docs/source/api/preprocessing.rst: -------------------------------------------------------------------------------- 1 | caer.preprocessing 2 | =================== 3 | .. automodule:: caer.preprocessing 4 | :members: -------------------------------------------------------------------------------- /docs/sphinx-theme/_static/thumbs/babel.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/_static/thumbs/babel.jpg -------------------------------------------------------------------------------- /docs/sphinx-theme/_static/thumbs/mnist.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/_static/thumbs/mnist.png -------------------------------------------------------------------------------- /tests/path/media/Nature/Bird - 46026.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/tests/path/media/Nature/Bird - 46026.mp4 -------------------------------------------------------------------------------- /docs/sphinx-theme/_static/thumbs/cifar10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/_static/thumbs/cifar10.png -------------------------------------------------------------------------------- /docs/sphinx-theme/_static/thumbs/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/_static/thumbs/favicon.png -------------------------------------------------------------------------------- /docs/sphinx-theme/_static/thumbs/cartpole.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/_static/thumbs/cartpole.gif -------------------------------------------------------------------------------- /docs/sphinx-theme/_static/thumbs/cpp_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/_static/thumbs/cpp_logo.png -------------------------------------------------------------------------------- /docs/sphinx-theme/_static/thumbs/examples.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/_static/thumbs/examples.png -------------------------------------------------------------------------------- /docs/sphinx-theme/_static/thumbs/torch-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/_static/thumbs/torch-logo.png -------------------------------------------------------------------------------- /docs/sphinx-theme/_static/thumbs/DistPyTorch.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/_static/thumbs/DistPyTorch.jpg -------------------------------------------------------------------------------- /docs/sphinx-theme/_static/thumbs/seq2seq_flat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/_static/thumbs/seq2seq_flat.png -------------------------------------------------------------------------------- /docs/sphinx-theme/.gitignore: -------------------------------------------------------------------------------- 1 | *build/ 2 | *.sass-cache 3 | *.map 4 | package-lock.json 5 | __pycache__ 6 | dist/ 7 | *.egg-info/ 8 | scss/vendor/* 9 | -------------------------------------------------------------------------------- /docs/sphinx-theme/_static/thumbs/caer-logo-flat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/_static/thumbs/caer-logo-flat.png -------------------------------------------------------------------------------- /docs/sphinx-theme/_static/thumbs/data_parallel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/_static/thumbs/data_parallel.png -------------------------------------------------------------------------------- /docs/sphinx-theme/images/home-footer-background.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/images/home-footer-background.jpg -------------------------------------------------------------------------------- /docs/sphinx-theme/_static/thumbs/pytorch-logo-flat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/_static/thumbs/pytorch-logo-flat.png -------------------------------------------------------------------------------- /tests/path/media/Nature/v2osk-1Z2niiBPg5A-unsplash.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/tests/path/media/Nature/v2osk-1Z2niiBPg5A-unsplash.jpg -------------------------------------------------------------------------------- /docs/sphinx-theme/_static/thumbs/char_rnn_generation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/_static/thumbs/char_rnn_generation.png -------------------------------------------------------------------------------- /tests/path/media/jakub-dziubak-XtUd5SiX464-unsplash.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/tests/path/media/jakub-dziubak-XtUd5SiX464-unsplash.jpg -------------------------------------------------------------------------------- /docs/sphinx-theme/_static/thumbs/torch-nn-vs-pytorch-nn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/_static/thumbs/torch-nn-vs-pytorch-nn.png -------------------------------------------------------------------------------- /docs/sphinx-theme/fonts/FreightSans/freight-sans-bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/fonts/FreightSans/freight-sans-bold.woff -------------------------------------------------------------------------------- /docs/sphinx-theme/fonts/FreightSans/freight-sans-bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/fonts/FreightSans/freight-sans-bold.woff2 -------------------------------------------------------------------------------- /docs/sphinx-theme/fonts/FreightSans/freight-sans-book.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/fonts/FreightSans/freight-sans-book.woff -------------------------------------------------------------------------------- /docs/sphinx-theme/fonts/FreightSans/freight-sans-book.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/fonts/FreightSans/freight-sans-book.woff2 -------------------------------------------------------------------------------- /docs/sphinx-theme/fonts/FreightSans/freight-sans-light.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/fonts/FreightSans/freight-sans-light.woff -------------------------------------------------------------------------------- /docs/sphinx-theme/fonts/IBMPlexMono/IBMPlexMono-Light.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/fonts/IBMPlexMono/IBMPlexMono-Light.woff -------------------------------------------------------------------------------- /docs/sphinx-theme/fonts/IBMPlexMono/IBMPlexMono-Light.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/fonts/IBMPlexMono/IBMPlexMono-Light.woff2 -------------------------------------------------------------------------------- /docs/sphinx-theme/fonts/IBMPlexMono/IBMPlexMono-Medium.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/fonts/IBMPlexMono/IBMPlexMono-Medium.woff -------------------------------------------------------------------------------- /docs/sphinx-theme/_static/thumbs/tensor_illustration_flat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/_static/thumbs/tensor_illustration_flat.png -------------------------------------------------------------------------------- /docs/sphinx-theme/fonts/FreightSans/freight-sans-light.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/fonts/FreightSans/freight-sans-light.woff2 -------------------------------------------------------------------------------- /docs/sphinx-theme/fonts/FreightSans/freight-sans-medium.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/fonts/FreightSans/freight-sans-medium.woff -------------------------------------------------------------------------------- /docs/sphinx-theme/fonts/FreightSans/freight-sans-medium.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/fonts/FreightSans/freight-sans-medium.woff2 -------------------------------------------------------------------------------- /docs/sphinx-theme/fonts/IBMPlexMono/IBMPlexMono-Medium.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/fonts/IBMPlexMono/IBMPlexMono-Medium.woff2 -------------------------------------------------------------------------------- /docs/sphinx-theme/fonts/IBMPlexMono/IBMPlexMono-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/fonts/IBMPlexMono/IBMPlexMono-Regular.woff -------------------------------------------------------------------------------- /docs/sphinx-theme/fonts/IBMPlexMono/IBMPlexMono-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/fonts/IBMPlexMono/IBMPlexMono-Regular.woff2 -------------------------------------------------------------------------------- /docs/sphinx-theme/fonts/IBMPlexMono/IBMPlexMono-SemiBold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/fonts/IBMPlexMono/IBMPlexMono-SemiBold.woff -------------------------------------------------------------------------------- /docs/sphinx-theme/fonts/IBMPlexMono/IBMPlexMono-SemiBold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/fonts/IBMPlexMono/IBMPlexMono-SemiBold.woff2 -------------------------------------------------------------------------------- /docs/sphinx-theme/fonts/FreightSans/freight-sans-bold-italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/fonts/FreightSans/freight-sans-bold-italic.woff -------------------------------------------------------------------------------- /docs/sphinx-theme/fonts/FreightSans/freight-sans-bold-italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/fonts/FreightSans/freight-sans-bold-italic.woff2 -------------------------------------------------------------------------------- /docs/sphinx-theme/fonts/FreightSans/freight-sans-book-italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/fonts/FreightSans/freight-sans-book-italic.woff -------------------------------------------------------------------------------- /docs/sphinx-theme/fonts/FreightSans/freight-sans-book-italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/fonts/FreightSans/freight-sans-book-italic.woff2 -------------------------------------------------------------------------------- /docs/sphinx-theme/fonts/FreightSans/freight-sans-light-italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/fonts/FreightSans/freight-sans-light-italic.woff -------------------------------------------------------------------------------- /docs/sphinx-theme/fonts/FreightSans/freight-sans-light-italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/fonts/FreightSans/freight-sans-light-italic.woff2 -------------------------------------------------------------------------------- /docs/sphinx-theme/fonts/FreightSans/freight-sans-medium-italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/fonts/FreightSans/freight-sans-medium-italic.woff -------------------------------------------------------------------------------- /tests/path/media/Nature/silvestri-matteo-6-C0VRsagUw-unsplash.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/tests/path/media/Nature/silvestri-matteo-6-C0VRsagUw-unsplash.jpg -------------------------------------------------------------------------------- /docs/sphinx-theme/fonts/FreightSans/freight-sans-medium-italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/fonts/FreightSans/freight-sans-medium-italic.woff2 -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: pip 4 | directory: "/" 5 | schedule: 6 | interval: daily 7 | time: '15:00' 8 | open-pull-requests-limit: 10 -------------------------------------------------------------------------------- /docs/sphinx-theme/caer_sphinx_theme/static/images/home-footer-background.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/caer_sphinx_theme/static/images/home-footer-background.jpg -------------------------------------------------------------------------------- /docs/sphinx-theme/caer_sphinx_theme.py: -------------------------------------------------------------------------------- 1 | from os import path 2 | package_dir = path.dirname(path.abspath(__file__)) 3 | template_path = path.join(package_dir) 4 | 5 | def get_path(): 6 | return template_path 7 | -------------------------------------------------------------------------------- /docs/sphinx-theme/caer_sphinx_theme/static/fonts/FreightSans/freight-sans-bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/caer_sphinx_theme/static/fonts/FreightSans/freight-sans-bold.woff -------------------------------------------------------------------------------- /docs/sphinx-theme/caer_sphinx_theme/static/fonts/FreightSans/freight-sans-bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/caer_sphinx_theme/static/fonts/FreightSans/freight-sans-bold.woff2 -------------------------------------------------------------------------------- /docs/sphinx-theme/caer_sphinx_theme/static/fonts/FreightSans/freight-sans-book.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/caer_sphinx_theme/static/fonts/FreightSans/freight-sans-book.woff -------------------------------------------------------------------------------- /docs/sphinx-theme/caer_sphinx_theme/static/fonts/FreightSans/freight-sans-book.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/caer_sphinx_theme/static/fonts/FreightSans/freight-sans-book.woff2 -------------------------------------------------------------------------------- /docs/sphinx-theme/caer_sphinx_theme/static/fonts/FreightSans/freight-sans-light.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/caer_sphinx_theme/static/fonts/FreightSans/freight-sans-light.woff -------------------------------------------------------------------------------- /docs/sphinx-theme/caer_sphinx_theme/static/fonts/IBMPlexMono/IBMPlexMono-Light.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/caer_sphinx_theme/static/fonts/IBMPlexMono/IBMPlexMono-Light.woff -------------------------------------------------------------------------------- /docs/sphinx-theme/caer_sphinx_theme/static/fonts/IBMPlexMono/IBMPlexMono-Light.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/caer_sphinx_theme/static/fonts/IBMPlexMono/IBMPlexMono-Light.woff2 -------------------------------------------------------------------------------- /docs/sphinx-theme/caer_sphinx_theme/static/fonts/IBMPlexMono/IBMPlexMono-Medium.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/caer_sphinx_theme/static/fonts/IBMPlexMono/IBMPlexMono-Medium.woff -------------------------------------------------------------------------------- /docs/sphinx-theme/caer_sphinx_theme/static/fonts/FreightSans/freight-sans-light.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/caer_sphinx_theme/static/fonts/FreightSans/freight-sans-light.woff2 -------------------------------------------------------------------------------- /docs/sphinx-theme/caer_sphinx_theme/static/fonts/FreightSans/freight-sans-medium.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/caer_sphinx_theme/static/fonts/FreightSans/freight-sans-medium.woff -------------------------------------------------------------------------------- /docs/sphinx-theme/caer_sphinx_theme/static/fonts/FreightSans/freight-sans-medium.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/caer_sphinx_theme/static/fonts/FreightSans/freight-sans-medium.woff2 -------------------------------------------------------------------------------- /docs/sphinx-theme/caer_sphinx_theme/static/fonts/IBMPlexMono/IBMPlexMono-Medium.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/caer_sphinx_theme/static/fonts/IBMPlexMono/IBMPlexMono-Medium.woff2 -------------------------------------------------------------------------------- /docs/sphinx-theme/caer_sphinx_theme/static/fonts/IBMPlexMono/IBMPlexMono-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/caer_sphinx_theme/static/fonts/IBMPlexMono/IBMPlexMono-Regular.woff -------------------------------------------------------------------------------- /docs/sphinx-theme/caer_sphinx_theme/static/fonts/IBMPlexMono/IBMPlexMono-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/caer_sphinx_theme/static/fonts/IBMPlexMono/IBMPlexMono-Regular.woff2 -------------------------------------------------------------------------------- /docs/sphinx-theme/caer_sphinx_theme/static/fonts/IBMPlexMono/IBMPlexMono-SemiBold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/caer_sphinx_theme/static/fonts/IBMPlexMono/IBMPlexMono-SemiBold.woff -------------------------------------------------------------------------------- /docs/sphinx-theme/caer_sphinx_theme/static/fonts/IBMPlexMono/IBMPlexMono-SemiBold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/caer_sphinx_theme/static/fonts/IBMPlexMono/IBMPlexMono-SemiBold.woff2 -------------------------------------------------------------------------------- /tools/requirements/build-docs.txt: -------------------------------------------------------------------------------- 1 | sphinx 2 | sphinx_rtd_theme 3 | sphinx>=2.0, <5.0 4 | recommonmark # fails with badges 5 | sphinx-autodoc-typehints 6 | sphinx-paramlinks<0.6.0 7 | sphinx-togglebutton 8 | sphinx-copybutton -------------------------------------------------------------------------------- /docs/sphinx-theme/caer_sphinx_theme/static/fonts/FreightSans/freight-sans-bold-italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/caer_sphinx_theme/static/fonts/FreightSans/freight-sans-bold-italic.woff -------------------------------------------------------------------------------- /docs/sphinx-theme/caer_sphinx_theme/static/fonts/FreightSans/freight-sans-bold-italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/caer_sphinx_theme/static/fonts/FreightSans/freight-sans-bold-italic.woff2 -------------------------------------------------------------------------------- /docs/sphinx-theme/caer_sphinx_theme/static/fonts/FreightSans/freight-sans-book-italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/caer_sphinx_theme/static/fonts/FreightSans/freight-sans-book-italic.woff -------------------------------------------------------------------------------- /docs/sphinx-theme/caer_sphinx_theme/static/fonts/FreightSans/freight-sans-book-italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/caer_sphinx_theme/static/fonts/FreightSans/freight-sans-book-italic.woff2 -------------------------------------------------------------------------------- /docs/sphinx-theme/caer_sphinx_theme/static/fonts/FreightSans/freight-sans-light-italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/caer_sphinx_theme/static/fonts/FreightSans/freight-sans-light-italic.woff -------------------------------------------------------------------------------- /docs/sphinx-theme/caer_sphinx_theme/static/fonts/FreightSans/freight-sans-light-italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/caer_sphinx_theme/static/fonts/FreightSans/freight-sans-light-italic.woff2 -------------------------------------------------------------------------------- /docs/sphinx-theme/caer_sphinx_theme/static/fonts/FreightSans/freight-sans-medium-italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/caer_sphinx_theme/static/fonts/FreightSans/freight-sans-medium-italic.woff -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Ask a question 4 | url: https://github.com/jasmcaus/caer/discussions 5 | about: Ask questions and discuss with other community members -------------------------------------------------------------------------------- /docs/sphinx-theme/caer_sphinx_theme/static/fonts/FreightSans/freight-sans-medium-italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasmcaus/caer/HEAD/docs/sphinx-theme/caer_sphinx_theme/static/fonts/FreightSans/freight-sans-medium-italic.woff2 -------------------------------------------------------------------------------- /tools/requirements/README.md: -------------------------------------------------------------------------------- 1 | # pip requirements files 2 | 3 | - [default.txt](default.txt): Default requirements 4 | 5 | 6 | ## Installing requirements 7 | 8 | ```shell 9 | $ pip install -U -r requirements/default.txt 10 | ``` -------------------------------------------------------------------------------- /.codecov.yml: -------------------------------------------------------------------------------- 1 | coverage: 2 | precision: 2 3 | round: down 4 | range: "95...100" 5 | status: 6 | patch: 7 | default: 8 | target: 90 9 | project: 10 | default: 11 | threshold: 1% 12 | changes: false 13 | 14 | comment: false 15 | 16 | ignore: 17 | - "tests/" -------------------------------------------------------------------------------- /docs/source/community/governance.rst: -------------------------------------------------------------------------------- 1 | .. _governance: 2 | 3 | Caer Governance | Persons of interest 4 | ====================================== 5 | 6 | Leads 7 | ------- 8 | - Jason (`@jasmcaus `_) 9 | 10 | Core Maintainers 11 | ------------------ 12 | - Jason (`@jasmcaus `_) -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # See https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax 2 | 3 | # Caer has been originally written by @jasmcaus. 4 | # This CODEOWNERS file is only to make sure that @jasmcaus is requested 5 | # for a code review in case of a pull request. 6 | 7 | * @jasmcaus 8 | * @adorad 9 | -------------------------------------------------------------------------------- /tools/travis/install.sh: -------------------------------------------------------------------------------- 1 | if test -e $HOME/miniconda/envs/condaenv; then 2 | echo "Condaenv already exists" 3 | else 4 | conda create --quiet --yes -n condaenv python=${TRAVIS_PYTHON_VERSION} 5 | conda install --quiet --yes -n condaenv opencv-contrib-python numpy requests pytest pip coveralls 6 | fi 7 | 8 | source activate condaenv 9 | make debug -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/documentation.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Typos and doc fixes 3 | about: Typos and doc fixes 4 | title: '' 5 | labels: typo, documentation 6 | assignees: '' 7 | 8 | --- 9 | 10 | ## 📚 Documentation 11 | 12 | For typos and doc fixes, please go ahead and: 13 | 14 | 1. Create an issue. 15 | 2. Fix the typo. 16 | 3. Submit a PR. 17 | 18 | Thanks! 19 | -------------------------------------------------------------------------------- /docs/sphinx-theme/scss/theme.scss: -------------------------------------------------------------------------------- 1 | @import "vendor/bootstrap/functions"; 2 | @import "vendor/bootstrap/bootstrap"; 3 | 4 | @import "shared/syntax-highlighting"; 5 | @import "shared/fonts"; 6 | @import "shared/variables"; 7 | @import "shared/base_styles"; 8 | @import "shared/code"; 9 | @import "shared/navigation"; 10 | @import "shared/footer"; 11 | @import "shared/article"; 12 | 13 | @import "sphinx_base"; 14 | @import "sphinx_layout"; 15 | -------------------------------------------------------------------------------- /caer/_meta.py: -------------------------------------------------------------------------------- 1 | 2 | # This file is automatically generated during the generation of setup.py 3 | # Copyright 2020-2025, Caer 4 | author = "Jason" 5 | version = "2.1.1" 6 | full_version = "2.1.1" 7 | git_version = '8a9814499b851ed686b70056320986c28d5132ec' 8 | release = True 9 | contributors = ['@jasmcaus', '', 'Special Thanks to:', '@MalikMAlna', '@lucasace', '@GitHubDragonFly', '@brccabral', '@theSekyi'] 10 | homepage = "https://github.com/jasmcaus/caer" 11 | -------------------------------------------------------------------------------- /docs/sphinx-theme/caer_sphinx_theme/theme.conf: -------------------------------------------------------------------------------- 1 | [theme] 2 | inherit = basic 3 | stylesheet = css/theme.css 4 | pygments_style = default 5 | 6 | [options] 7 | canonical_url = 8 | analytics_id = 9 | collapse_navigation = True 10 | sticky_navigation = True 11 | navigation_depth = 4 12 | includehidden = False 13 | titles_only = 14 | logo = 15 | logo_only = 16 | display_version = True 17 | prev_next_buttons_location = bottom 18 | style_external_links = False 19 | caer_project = 20 | -------------------------------------------------------------------------------- /docs/sphinx-theme/caer_sphinx_theme/cookie_banner.html: -------------------------------------------------------------------------------- 1 | 7 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include setup.cfg 2 | include .github/CONTRIBUTING.md 3 | include LICENSE 4 | include README.md 5 | include INSTALL.md 6 | include CONTRIBUTORS 7 | include tools/cythonize.py 8 | include pyproject.toml 9 | 10 | recursive-include caer/data * 11 | # recursive-include caer *.pyx *.pyd *.pxd *.pxi *.py *.c *.cpp *.h *.ini *.txt *.in *.md 12 | recursive-include caer *.py *.ini *.txt *.in *.md 13 | 14 | recursive-exclude * __pycache__ *.npy *.npz *.c *.cpp *.h *.pyx *.pyd *.pxd *.pxi 15 | recursive-exclude build/* -------------------------------------------------------------------------------- /tests/path/media/README.md: -------------------------------------------------------------------------------- 1 | # Note 2 | The images and videos in these folders were obtained from Unsplash.com (images) and Pixabay.com (videos). 3 | 4 | The media files are used for testing purposes only. We test the efficacy of `caer.path.listdir()`, `caer.path.list_images()`, `caer.path.list_videos()` and `caer.path.list_media()`. 5 | 6 | Should, for any reason, these media files change their copyright stance (thereby making it illegal to use for this project), kindly [file an issue here](https://github.com/jasmcaus/caer/issues). -------------------------------------------------------------------------------- /tests/__init__.py: -------------------------------------------------------------------------------- 1 | # _____ ______ _____ 2 | # / ____/ /\ | ____ | __ \ 3 | # | | / \ | |__ | |__) | Caer - Modern Computer Vision 4 | # | | / /\ \ | __| | _ / Languages: Python, C, C++, Cuda 5 | # | |___ / ____ \ | |____ | | \ \ http://github.com/jasmcaus/caer 6 | # \_____\/_/ \_ \______ |_| \_\ 7 | 8 | # Licensed under the MIT License 9 | # SPDX-License-Identifier: MIT 10 | # Copyright (c) 2020-2025 The Caer Authors -------------------------------------------------------------------------------- /tests/adorad/__init__.py: -------------------------------------------------------------------------------- 1 | # _____ ______ _____ 2 | # / ____/ /\ | ____ | __ \ 3 | # | | / \ | |__ | |__) | Caer - Modern Computer Vision 4 | # | | / /\ \ | __| | _ / Languages: Python, C, C++, Cuda 5 | # | |___ / ____ \ | |____ | | \ \ http://github.com/jasmcaus/caer 6 | # \_____\/_/ \_ \______ |_| \_\ 7 | 8 | # Licensed under the MIT License 9 | # SPDX-License-Identifier: MIT 10 | # Copyright (c) 2020-2025 The Caer Authors -------------------------------------------------------------------------------- /tests/adorad/test_tensor.py: -------------------------------------------------------------------------------- 1 | # _____ ______ _____ 2 | # / ____/ /\ | ____ | __ \ 3 | # | | / \ | |__ | |__) | Caer - Modern Computer Vision 4 | # | | / /\ \ | __| | _ / Languages: Python, C, C++, Cuda 5 | # | |___ / ____ \ | |____ | | \ \ http://github.com/jasmcaus/caer 6 | # \_____\/_/ \_ \______ |_| \_\ 7 | 8 | # Licensed under the MIT License 9 | # SPDX-License-Identifier: MIT 10 | # Copyright (c) 2020-2025 The Caer Authors -------------------------------------------------------------------------------- /tests/transforms/__init__.py: -------------------------------------------------------------------------------- 1 | # _____ ______ _____ 2 | # / ____/ /\ | ____ | __ \ 3 | # | | / \ | |__ | |__) | Caer - Modern Computer Vision 4 | # | | / /\ \ | __| | _ / Languages: Python, C, C++, Cuda 5 | # | |___ / ____ \ | |____ | | \ \ http://github.com/jasmcaus/caer 6 | # \_____\/_/ \_ \______ |_| \_\ 7 | 8 | # Licensed under the MIT License 9 | # SPDX-License-Identifier: MIT 10 | # Copyright (c) 2020-2025 The Caer Authors -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: test lint mypy install clean FORCE 2 | 3 | test: mypy lint test-all 4 | 5 | test-all: FORCE 6 | pytest -v --cov=caer tests/ --flake8 --mypy 7 | 8 | lint: FORCE 9 | pytest -v --flake8 -m flake8 10 | 11 | mypy: FORCE 12 | pytest -v --mypy -m mypy tests/ 13 | 14 | install: 15 | python setup.py install 16 | 17 | clean: 18 | rm -rf build caer/*.so caer/features/*.so 19 | pip uninstall caer 20 | 21 | # docs: 22 | # rm -rf build/docs 23 | # cd docs && make html && cp -r build/html ../build/docs 24 | # @echo python setup.py upload_docs -------------------------------------------------------------------------------- /tools/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: test lint mypy install clean FORCE 2 | 3 | test: mypy lint test-all 4 | 5 | test-all: FORCE 6 | pytest -v --cov=caer tests/ --flake8 --mypy 7 | 8 | lint: FORCE 9 | pytest -v --flake8 -m flake8 10 | 11 | mypy: FORCE 12 | pytest -v --mypy -m mypy tests/ 13 | 14 | install: 15 | python setup.py install 16 | 17 | clean: 18 | rm -rf build caer/*.so caer/features/*.so 19 | pip uninstall caer 20 | 21 | # docs: 22 | # rm -rf build/docs 23 | # cd docs && make html && cp -r build/html ../build/docs 24 | # @echo python setup.py upload_docs -------------------------------------------------------------------------------- /docs/sitemap.xml: -------------------------------------------------------------------------------- 1 | --- 2 | layout: none 3 | search: exclude 4 | --- 5 | 6 | 7 | 8 | {% for post in site.posts %} 9 | {% unless post.search == "exclude" %} 10 | 11 | {{site.url}}{{post.url}} 12 | 13 | {% endunless %} 14 | {% endfor %} 15 | 16 | 17 | {% for page in site.pages %} 18 | {% unless page.search == "exclude" %} 19 | 20 | {{site.url}}{{ page.url}} 21 | 22 | {% endunless %} 23 | {% endfor %} 24 | -------------------------------------------------------------------------------- /docs/sphinx-theme/js/pytorch-anchors.js: -------------------------------------------------------------------------------- 1 | window.pytorchAnchors = { 2 | bind: function() { 3 | // Replace Sphinx-generated anchors with anchorjs ones 4 | $(".headerlink").text(""); 5 | 6 | window.anchors.add(".pytorch-article .headerlink"); 7 | 8 | $(".anchorjs-link").each(function() { 9 | var $headerLink = $(this).closest(".headerlink"); 10 | var href = $headerLink.attr("href"); 11 | var clone = this.outerHTML; 12 | 13 | $clone = $(clone).attr("href", href); 14 | $headerLink.before($clone); 15 | $headerLink.remove(); 16 | }); 17 | } 18 | }; 19 | -------------------------------------------------------------------------------- /docs/sphinx-theme/js/mobile-toc.js: -------------------------------------------------------------------------------- 1 | window.mobileTOC = { 2 | bind: function() { 3 | $("[data-behavior='toggle-table-of-contents']").on("click", function(e) { 4 | e.preventDefault(); 5 | 6 | var $parent = $(this).parent(); 7 | 8 | if ($parent.hasClass("is-open")) { 9 | $parent.removeClass("is-open"); 10 | $(".pytorch-left-menu").slideUp(200, function() { 11 | $(this).css({display: ""}); 12 | }); 13 | } else { 14 | $parent.addClass("is-open"); 15 | $(".pytorch-left-menu").slideDown(200); 16 | } 17 | }); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /mypy.ini: -------------------------------------------------------------------------------- 1 | # This is the Caer mypy.ini file 2 | 3 | [mypy] 4 | cache_dir = .mypy_cache/normal 5 | warn_unused_configs = True 6 | warn_redundant_casts = True 7 | show_error_codes = True 8 | show_column_numbers = True 9 | check_untyped_defs = True 10 | follow_imports = silent 11 | 12 | # https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-type-hints-for-third-party-library 13 | ignore_missing_imports = True 14 | 15 | # Do not re-enable this 16 | warn_unused_ignores = False 17 | 18 | # Minimum version supported - variable annotations were introduced in 19 | # Python 3.6 20 | python_version = 3.6 21 | -------------------------------------------------------------------------------- /caer/README.md: -------------------------------------------------------------------------------- 1 | # Caer, in modules 2 | 3 | `caer` contains functions to simplify common tasks used when developing and evaluating computer vision systems. A short description of the sub-modules is provided below. For more details about what functions are available and how to use them, please review the doc-strings provided with the code. 4 | 5 | ## Sub-modules 6 | 7 | ### [data](data) 8 | Test images and example data. 9 | 10 | ### [path](path) 11 | OS-specific Path Manipulations 12 | 13 | ### [preprocessing](preprocessing) 14 | Image preprocessing utilities 15 | 16 | ### [video](video) 17 | Video processing utilities -------------------------------------------------------------------------------- /docs/sphinx-theme/caer_sphinx_theme/searchbox.html: -------------------------------------------------------------------------------- 1 | {%- if builder != 'singlehtml' %} 2 | 3 | {% if theme_caer_project == 'tutorials' %} 4 | {% set search_project = 'Tutorials' %} 5 | {% else %} 6 | {% set search_project = 'Docs' %} 7 | {% endif %} 8 | 9 |
10 |
11 | 12 | 13 | 14 |
15 |
16 | {%- endif %} 17 | -------------------------------------------------------------------------------- /docs/sphinx-theme/caer_sphinx_theme/__init__.py: -------------------------------------------------------------------------------- 1 | """Caer Sphinx theme. 2 | 3 | From https://github.com/shiftlab/lightning_sphinx_theme. 4 | 5 | """ 6 | from os import path 7 | 8 | __version__ = '0.0.1' 9 | __version_full__ = __version__ 10 | 11 | 12 | def get_html_theme_path(): 13 | """Return list of HTML theme paths.""" 14 | cur_dir = path.abspath(path.dirname(path.dirname(__file__))) 15 | return cur_dir 16 | 17 | # See http://www.sphinx-doc.org/en/stable/theming.html#distribute-your-theme-as-a-python-package 18 | def setup(app): 19 | app.add_html_theme('caer_sphinx_theme', path.abspath(path.dirname(__file__))) 20 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # Supported funding model platforms 2 | 3 | github: # jasmcaus # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: jasmcaus 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: jasmcaus 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | custom: 'http://paypal.me/jasmcaus' 13 | -------------------------------------------------------------------------------- /docs/sphinx-theme/images/pytorch-download.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 10 | 11 | -------------------------------------------------------------------------------- /docs/sphinx-theme/caer_sphinx_theme/static/images/pytorch-download.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 10 | 11 | -------------------------------------------------------------------------------- /tools/workflows/test.yml: -------------------------------------------------------------------------------- 1 | # name: Test 2 | 3 | # on: [push, pull_request] 4 | 5 | # jobs: 6 | # test: 7 | # name: Test 8 | # runs-on: ubuntu-latest 9 | 10 | # steps: 11 | # - name: Checkout Code 12 | # uses: actions/checkout@v2 13 | 14 | # - name: Install OpenCL 15 | # run: sudo apt-get install pocl-opencl-icd 16 | 17 | # - name: Set up Python 3.8 18 | # uses: actions/setup-python@v2 19 | # with: 20 | # python-version: 3.8 21 | 22 | # - name: Install Dependencies 23 | # run: pip install -r requirements/test.txt 24 | 25 | # - name: Run Pytest 26 | # run: python -m pytest -s -v -------------------------------------------------------------------------------- /caer/coreten/__init__.py: -------------------------------------------------------------------------------- 1 | # _____ ______ _____ 2 | # / ____/ /\ | ____ | __ \ 3 | # | | / \ | |__ | |__) | Caer - Modern Computer Vision 4 | # | | / /\ \ | __| | _ / Languages: Python, C, C++, Cuda 5 | # | |___ / ____ \ | |____ | | \ \ http://github.com/jasmcaus/caer 6 | # \_____\/_/ \_ \______ |_| \_\ 7 | 8 | # Licensed under the MIT License 9 | # SPDX-License-Identifier: MIT 10 | # Copyright (c) 2020-2025 The Caer Authors 11 | 12 | 13 | from .tensor import ( 14 | Tensor, 15 | is_tensor 16 | ) 17 | 18 | from ._internal import ( 19 | from_numpy, 20 | to_tensor 21 | ) -------------------------------------------------------------------------------- /.github/workflows/sloc.yml: -------------------------------------------------------------------------------- 1 | name: SLOC 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | - dev 8 | - staging 9 | pull_request: 10 | branches: 11 | - master 12 | - dev 13 | - staging 14 | 15 | 16 | jobs: 17 | lines: 18 | name: Count Lines, eh? 19 | runs-on: ubuntu-latest 20 | 21 | steps: 22 | - name: Checkout Code 23 | uses: actions/checkout@v2 24 | 25 | - name: Install SLOCCount 26 | run: sudo apt-get install sloccount 27 | 28 | - name: Check <50000 lines 29 | run: sloccount caer tests examples docs; if [ $(sloccount caer | sed -n 's/.*Total Physical Source Lines of Code (SLOC)[ ]*= \([^ ]*\).*/\1/p' | tr -d ',') -gt 50000 ]; then exit 1; fi -------------------------------------------------------------------------------- /docs/sphinx-theme/images/pytorch-x.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /caer/annotations/__init__.py: -------------------------------------------------------------------------------- 1 | # _____ ______ _____ 2 | # / ____/ /\ | ____ | __ \ 3 | # | | / \ | |__ | |__) | Caer - Modern Computer Vision 4 | # | | / /\ \ | __| | _ / Languages: Python, C, C++, Cuda 5 | # | |___ / ____ \ | |____ | | \ \ http://github.com/jasmcaus/caer 6 | # \_____\/_/ \_ \______ |_| \_\ 7 | 8 | # Licensed under the MIT License 9 | # SPDX-License-Identifier: MIT 10 | # Copyright (c) 2020-2025 The Caer Authors 11 | 12 | from typing import ( 13 | Any, Tuple, BinaryIO, Callable, ContextManager, Dict, Iterator, List, NamedTuple, 14 | Optional, overload, Sequence, TypeVar, Type, Union, Generic, Set, AnyStr 15 | ) -------------------------------------------------------------------------------- /docs/source/api/video.rst: -------------------------------------------------------------------------------- 1 | .. role:: hidden 2 | :class: hidden-section 3 | 4 | caer.video 5 | =================== 6 | .. currentmodule:: caer.video 7 | 8 | 9 | **Video Streams** 10 | ---------------------- 11 | 12 | :hidden:`Stream` 13 | ~~~~~~~~~~~~~~~~~~ 14 | .. autofunction:: Stream 15 | 16 | 17 | :hidden:`LiveStream` 18 | ---------------------- 19 | .. autofunction:: LiveStream 20 | 21 | 22 | ---------------------------------- 23 | 24 | 25 | **Frame Extraction** 26 | 27 | :hidden:`extract_frames` 28 | ~~~~~~~~~~~~~~~~~~~~~~~~~ 29 | .. autofunction:: extract_frames 30 | 31 | 32 | ----------------------------------- 33 | 34 | 35 | **Video Stablizer** 36 | 37 | :hidden:`Stablizer` 38 | ~~~~~~~~~~~~~~~~~~~~ 39 | .. autofunction:: Stablizer -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature-request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "\U0001F680Feature Request" 3 | about: Submit a proposal/request for a new caer feature 4 | 5 | --- 6 | 7 | ## 🚀 Feature 8 | 9 | 10 | ## Motivation 11 | 12 | 13 | 14 | ## Pitch 15 | 16 | 17 | 18 | ## Alternatives 19 | 20 | 21 | 22 | ## Additional context 23 | -------------------------------------------------------------------------------- /caer/video/constants.py: -------------------------------------------------------------------------------- 1 | # _____ ______ _____ 2 | # / ____/ /\ | ____ | __ \ 3 | # | | / \ | |__ | |__) | Caer - Modern Computer Vision 4 | # | | / /\ \ | __| | _ / Languages: Python, C, C++, Cuda 5 | # | |___ / ____ \ | |____ | | \ \ http://github.com/jasmcaus/caer 6 | # \_____\/_/ \_ \______ |_| \_\ 7 | 8 | # Licensed under the MIT License 9 | # SPDX-License-Identifier: MIT 10 | # Copyright (c) 2020-2025 The Caer Authors 11 | 12 | 13 | __all__ = [ 14 | "FPS", 15 | "FRAME_COUNT", 16 | "FRAME_WIDTH", 17 | "FRAME_HEIGHT" 18 | ] 19 | 20 | 21 | ## Video 22 | FRAME_WIDTH = 3 23 | FRAME_HEIGHT = 4 24 | FPS = 5 25 | FRAME_COUNT = 7 -------------------------------------------------------------------------------- /docs/sphinx-theme/caer_sphinx_theme/static/images/pytorch-x.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /docs/sphinx-theme/images/logo-facebook-dark.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 8 | 9 | -------------------------------------------------------------------------------- /tests/io/test_imsave.py: -------------------------------------------------------------------------------- 1 | # _____ ______ _____ 2 | # / ____/ /\ | ____ | __ \ 3 | # | | / \ | |__ | |__) | Caer - Modern Computer Vision 4 | # | | / /\ \ | __| | _ / Languages: Python, C, C++, Cuda 5 | # | |___ / ____ \ | |____ | | \ \ http://github.com/jasmcaus/caer 6 | # \_____\/_/ \_ \______ |_| \_\ 7 | 8 | # Licensed under the MIT License 9 | # SPDX-License-Identifier: MIT 10 | # Copyright (c) 2020-2025 The Caer Authors 11 | 12 | import caer 13 | # import os 14 | 15 | def test_imsave(): 16 | tens = caer.data.sunrise() 17 | 18 | saved = caer.imsave('sunrise.jpg', tens) 19 | assert saved == True 20 | # os.remove(os.path.join('io', 'sunrise.jpg')) -------------------------------------------------------------------------------- /docs/sphinx-theme/caer_sphinx_theme/static/images/logo-facebook-dark.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 8 | 9 | -------------------------------------------------------------------------------- /docs/sphinx-theme/images/view-page-source-icon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /caer/_base.py: -------------------------------------------------------------------------------- 1 | # _____ ______ _____ 2 | # / ____/ /\ | ____ | __ \ 3 | # | | / \ | |__ | |__) | Caer - Modern Computer Vision 4 | # | | / /\ \ | __| | _ / Languages: Python, C, C++, Cuda 5 | # | |___ / ____ \ | |____ | | \ \ http://github.com/jasmcaus/caer 6 | # \_____\/_/ \_ \______ |_| \_\ 7 | 8 | # Licensed under the MIT License 9 | # SPDX-License-Identifier: MIT 10 | # Copyright (c) 2020-2025 The Caer Authors 11 | 12 | 13 | # We don't want to modify the root dir in any way 14 | # This gets disrupted if this file is called directly 15 | # Checks are in place: 16 | 17 | if __name__ != "__main__": 18 | from .path import dirname 19 | 20 | __curr__ = dirname(__file__).replace("\\", "/") -------------------------------------------------------------------------------- /caer/io/__init__.py: -------------------------------------------------------------------------------- 1 | # _____ ______ _____ 2 | # / ____/ /\ | ____ | __ \ 3 | # | | / \ | |__ | |__) | Caer - Modern Computer Vision 4 | # | | / /\ \ | __| | _ / Languages: Python, C, C++, Cuda 5 | # | |___ / ____ \ | |____ | | \ \ http://github.com/jasmcaus/caer 6 | # \_____\/_/ \_ \______ |_| \_\ 7 | 8 | # Licensed under the MIT License 9 | # SPDX-License-Identifier: MIT 10 | # Copyright (c) 2020-2025 The Caer Authors 11 | 12 | # Resize 13 | from .resize import ( 14 | resize, 15 | smart_resize, 16 | __all__ as __all_res__ 17 | ) 18 | 19 | # Image 20 | from .io import ( 21 | imread, 22 | imsave, 23 | __all__ as __all_io__ 24 | ) 25 | 26 | __all__ = __all_io__ + __all_res__ -------------------------------------------------------------------------------- /docs/sphinx-theme/caer_sphinx_theme/static/images/view-page-source-icon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /.readthedocs.yml: -------------------------------------------------------------------------------- 1 | # .readthedocs.yml 2 | # Read the Docs configuration file 3 | # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details 4 | 5 | # Required 6 | version: 2 7 | 8 | # Set the OS, Python version and other tools you might need 9 | build: 10 | os: ubuntu-22.04 11 | tools: 12 | python: "3.10" 13 | 14 | # Build documentation in the docs/ directory with Sphinx 15 | sphinx: 16 | builder: html 17 | configuration: docs/source/conf.py 18 | fail_on_warning: false 19 | 20 | # Optionally build your docs in additional formats such as PDF 21 | formats: 22 | - pdf 23 | 24 | # Optionally set the version of Python and requirements required to build your docs 25 | python: 26 | # version: 3.10 27 | install: 28 | - requirements: tools/requirements/default.txt 29 | - requirements: tools/requirements/build-docs.txt -------------------------------------------------------------------------------- /docs/sphinx-theme/js/main-menu-dropdown.js: -------------------------------------------------------------------------------- 1 | window.mainMenuDropdown = { 2 | bind: function() { 3 | $("[data-toggle='ecosystem-dropdown']").on("click", function() { 4 | toggleDropdown($(this).attr("data-toggle")); 5 | }); 6 | 7 | $("[data-toggle='resources-dropdown']").on("click", function() { 8 | toggleDropdown($(this).attr("data-toggle")); 9 | }); 10 | 11 | function toggleDropdown(menuToggle) { 12 | var showMenuClass = "show-menu"; 13 | var menuClass = "." + menuToggle + "-menu"; 14 | 15 | if ($(menuClass).hasClass(showMenuClass)) { 16 | $(menuClass).removeClass(showMenuClass); 17 | } else { 18 | $("[data-toggle=" + menuToggle + "].show-menu").removeClass( 19 | showMenuClass 20 | ); 21 | $(menuClass).addClass(showMenuClass); 22 | } 23 | } 24 | } 25 | }; 26 | -------------------------------------------------------------------------------- /docs/sphinx-theme/images/logo-pytorch-icon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /docs/source/api/io.rst: -------------------------------------------------------------------------------- 1 | .. role:: hidden 2 | :class: hidden-section 3 | 4 | caer.io 5 | =================== 6 | .. currentmodule:: caer.io 7 | 8 | 9 | **Reading Images** 10 | ---------------------- 11 | 12 | :hidden:`imread` 13 | ~~~~~~~~~~~~~~~~~~ 14 | .. autofunction:: imread 15 | 16 | 17 | ------------------------------------- 18 | 19 | 20 | **Saving Images** 21 | ---------------------- 22 | 23 | :hidden:`imsave` 24 | ~~~~~~~~~~~~~~~~~~~ 25 | .. autofunction:: imsave 26 | 27 | 28 | ------------------------------------- 29 | 30 | 31 | **Resizing Images** 32 | ---------------------- 33 | :hidden:`imread` 34 | ~~~~~~~~~~~~~~~~~~~ 35 | 36 | .. autofunction:: resize 37 | 38 | 39 | ------------------------------------- 40 | 41 | 42 | **Smart Resizing** 43 | ---------------------- 44 | :hidden:`smart_resize` 45 | ~~~~~~~~~~~~~~~~~~~~~~~~ 46 | 47 | .. autofunction:: smart_resize -------------------------------------------------------------------------------- /docs/sphinx-theme/js/mobile-menu.js: -------------------------------------------------------------------------------- 1 | window.mobileMenu = { 2 | bind: function() { 3 | $("[data-behavior='open-mobile-menu']").on('click', function(e) { 4 | e.preventDefault(); 5 | $(".mobile-main-menu").addClass("open"); 6 | $("body").addClass('no-scroll'); 7 | 8 | mobileMenu.listenForResize(); 9 | }); 10 | 11 | $("[data-behavior='close-mobile-menu']").on('click', function(e) { 12 | e.preventDefault(); 13 | mobileMenu.close(); 14 | }); 15 | }, 16 | 17 | listenForResize: function() { 18 | $(window).on('resize.ForMobileMenu', function() { 19 | if ($(this).width() > 768) { 20 | mobileMenu.close(); 21 | } 22 | }); 23 | }, 24 | 25 | close: function() { 26 | $(".mobile-main-menu").removeClass("open"); 27 | $("body").removeClass('no-scroll'); 28 | $(window).off('resize.ForMobileMenu'); 29 | } 30 | }; 31 | -------------------------------------------------------------------------------- /docs/sphinx-theme/caer_sphinx_theme/static/images/logo-pytorch-icon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /docs/make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | pushd %~dp0 4 | 5 | REM Command file for Sphinx documentation 6 | 7 | if "%SPHINXBUILD%" == "" ( 8 | set SPHINXBUILD=sphinx-build 9 | ) 10 | set SOURCEDIR=source 11 | set BUILDDIR=build 12 | 13 | if "%1" == "" goto help 14 | 15 | %SPHINXBUILD% >NUL 2>NUL 16 | if errorlevel 9009 ( 17 | echo. 18 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx 19 | echo.installed, then set the SPHINXBUILD environment variable to point 20 | echo.to the full path of the 'sphinx-build' executable. Alternatively you 21 | echo.may add the Sphinx directory to PATH. 22 | echo. 23 | echo.If you don't have Sphinx installed, grab it from 24 | echo.http://sphinx-doc.org/ 25 | exit /b 1 26 | ) 27 | 28 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% 29 | goto end 30 | 31 | :help 32 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% 33 | 34 | :end 35 | popd -------------------------------------------------------------------------------- /caer/preprocessing/__init__.py: -------------------------------------------------------------------------------- 1 | # _____ ______ _____ 2 | # / ____/ /\ | ____ | __ \ 3 | # | | / \ | |__ | |__) | Caer - Modern Computer Vision 4 | # | | / /\ \ | __| | _ / Languages: Python, C, C++, Cuda 5 | # | |___ / ____ \ | |____ | | \ \ http://github.com/jasmcaus/caer 6 | # \_____\/_/ \_ \______ |_| \_\ 7 | 8 | # Licensed under the MIT License 9 | # SPDX-License-Identifier: MIT 10 | # Copyright (c) 2020-2025 The Caer Authors 11 | 12 | 13 | from .mean_subtraction import MeanProcess 14 | from .mean_subtraction import compute_mean 15 | from .mean_subtraction import compute_mean_from_dir 16 | from .mean_subtraction import subtract_mean 17 | from .mean_subtraction import _check_mean_sub_values 18 | 19 | from .mean_subtraction import __all__ as __all_mean__ 20 | 21 | __all__ = __all_mean__ 22 | 23 | del __all_mean__ 24 | -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Minimal makefile for Sphinx documentation 3 | # 4 | 5 | # You can set these variables from the command line, and also 6 | # from the environment for the first two. 7 | SPHINXOPTS ?= 8 | SPHINXBUILD ?= sphinx-build 9 | SOURCEDIR = source 10 | BUILDDIR = build 11 | 12 | ZIPOPTS ?= -qo 13 | 14 | # Put it first so that "make" without argument is like "make help". 15 | help: 16 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 17 | 18 | .PHONY: help Makefile 19 | 20 | # Catch-all target: route all unknown targets to Sphinx using the new 21 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 22 | %: Makefile 23 | make download 24 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) -v 25 | 26 | clean: 27 | @echo "Removing everything under 'build' and 'source/generated'.." 28 | @rm -rf $(BUILDDIR)/html/ $(BUILDDIR)/doctrees $(SOURCEDIR)/generated -------------------------------------------------------------------------------- /tools/workflows/pypi-macos.yml: -------------------------------------------------------------------------------- 1 | # Builds the 'MacOS' Python wheels for Caer 2 | 3 | name: macOS Package 4 | 5 | on: 6 | push: 7 | tags: 8 | - 'v*' 9 | 10 | jobs: 11 | build: 12 | runs-on: macos-latest 13 | strategy: 14 | matrix: 15 | py-version: [3.6, 3.7, 3.8] 16 | 17 | steps: 18 | - uses: actions/checkout@v2 19 | 20 | - name: Set up Python ${{ matrix.py-version }} 21 | uses: actions/setup-python@v2 22 | with: 23 | python-version: ${{ matrix.py-version }} 24 | 25 | - name: Install dependencies 26 | run: | 27 | python -m pip install --upgrade pip 28 | pip install setuptools wheel twine numpy 29 | 30 | - name: Build and publish 31 | env: 32 | TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} 33 | TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} 34 | run: | 35 | python setup.py bdist_wheel 36 | twine upload dist/* -------------------------------------------------------------------------------- /docs/sphinx-theme/caer_sphinx_theme/theme_variables.jinja: -------------------------------------------------------------------------------- 1 | {%- set external_urls = { 2 | 'github': 'https://github.com/jasmcaus/caer', 3 | 'github_issues': 'https://github.com/jasmcaus/caer/issues', 4 | 'contributing': 'https://github.com/jasmcaus/caer/blob/master/CONTRIBUTING.md', 5 | 'docs': 'https://caer.readthedocs.io/en/latest', 6 | 'twitter': 'https://twitter.com/jasmcaus', 7 | 'discuss': 'https://github.com/jasmcaus/caer/discussions', 8 | 'tutorials': 'https://github.com/jasmcaus/caer/blob/master/examples', 9 | 'previous_pytorch_versions': 'https://pytorch.org/previous-versions/', 10 | 'home': 'https://github.com/jasmcaus/caer', 11 | 'get_started': 'https://github.com/jasmcaus/caer', 12 | 'features': 'https://github.com/jasmcaus/caer/blob/master/README.md', 13 | 'blog': 'https://jasmcaus.medium.com', 14 | 'resources': 'https://github.com/jasmcaus/caer/discussions', 15 | 'support': 'https://github.com/jasmcaus/caer/discussions', 16 | } 17 | -%} 18 | -------------------------------------------------------------------------------- /tools/workflows/pypi-win32.yml: -------------------------------------------------------------------------------- 1 | # Builds the 'Win32' Python wheels for Caer 2 | 3 | name: Windows Package (x86) 4 | 5 | on: 6 | push: 7 | tags: 8 | - 'v*' 9 | 10 | jobs: 11 | build: 12 | runs-on: windows-latest 13 | strategy: 14 | matrix: 15 | py-version: [3.6, 3.7, 3.8] 16 | 17 | steps: 18 | - uses: actions/checkout@v2 19 | - name: Set up Python ${{ matrix.py-version }} 20 | uses: actions/setup-python@v2 21 | with: 22 | architecture: 'x86' 23 | python-version: ${{ matrix.py-version }} 24 | 25 | - name: Install dependencies 26 | run: | 27 | python -m pip install --upgrade pip 28 | pip install setuptools wheel twine numpy 29 | 30 | - name: Build and publish 31 | env: 32 | TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} 33 | TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} 34 | run: | 35 | python setup.py bdist_wheel 36 | twine upload dist/* -------------------------------------------------------------------------------- /docs/sphinx-theme/images/chevron-right-orange.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | Page 1 7 | Created with Sketch. 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /tools/workflows/pypi-win64.yml: -------------------------------------------------------------------------------- 1 | # Builds the 'Win64' Python wheels for Caer 2 | 3 | name: Windows Package (x64) 4 | 5 | on: 6 | push: 7 | tags: 8 | - 'v*' 9 | 10 | jobs: 11 | build: 12 | runs-on: windows-latest 13 | strategy: 14 | matrix: 15 | py-version: [3.6, 3.7, 3.8] 16 | 17 | steps: 18 | - uses: actions/checkout@v2 19 | 20 | - name: Set up Python ${{ matrix.py-version }} 21 | uses: actions/setup-python@v2 22 | with: 23 | architecture: 'x64' 24 | python-version: ${{ matrix.py-version }} 25 | 26 | - name: Install dependencies 27 | run: | 28 | python -m pip install --upgrade pip 29 | pip install setuptools wheel twine numpy 30 | 31 | - name: Build and publish 32 | env: 33 | TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} 34 | TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} 35 | run: | 36 | python setup.py bdist_wheel 37 | twine upload dist/* -------------------------------------------------------------------------------- /docs/sphinx-theme/caer_sphinx_theme/static/images/chevron-right-orange.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | Page 1 7 | Created with Sketch. 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /docs/sphinx-theme/images/chevron-right-white.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | Page 1 7 | Created with Sketch. 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /docs/sphinx-theme/js/cookie-banner.js: -------------------------------------------------------------------------------- 1 | var cookieBanner = { 2 | init: function() { 3 | cookieBanner.bind(); 4 | 5 | var cookieExists = cookieBanner.cookieExists(); 6 | 7 | if (!cookieExists) { 8 | cookieBanner.setCookie(); 9 | cookieBanner.showCookieNotice(); 10 | } 11 | }, 12 | 13 | bind: function() { 14 | $(".close-button").on("click", cookieBanner.hideCookieNotice); 15 | }, 16 | 17 | cookieExists: function() { 18 | var cookie = localStorage.getItem("returningPytorchUser"); 19 | 20 | if (cookie) { 21 | return true; 22 | } else { 23 | return false; 24 | } 25 | }, 26 | 27 | setCookie: function() { 28 | localStorage.setItem("returningPytorchUser", true); 29 | }, 30 | 31 | showCookieNotice: function() { 32 | $(".cookie-banner-wrapper").addClass("is-visible"); 33 | }, 34 | 35 | hideCookieNotice: function() { 36 | $(".cookie-banner-wrapper").removeClass("is-visible"); 37 | } 38 | }; 39 | 40 | $(function() { 41 | cookieBanner.init(); 42 | }); 43 | -------------------------------------------------------------------------------- /tools/workflows/pypi-linux.yml: -------------------------------------------------------------------------------- 1 | # Builds the 'manylinux' Python wheels for Caer 2 | 3 | name: Build Linux Package 4 | 5 | on: 6 | push: 7 | tags: 8 | - 'v*' 9 | 10 | jobs: 11 | build: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v2 15 | 16 | - name: Set up Python 3.6 17 | uses: actions/setup-python@v2 18 | with: 19 | python-version: '3.6' 20 | 21 | - name: Install dependencies 22 | run: | 23 | python -m pip install --upgrade pip 24 | pip install twine 25 | 26 | - name: Build 'manylinux' Python wheels 27 | uses: RalfG/python-wheels-manylinux-build@v0.2.2-manylinux2010_x86_64 28 | with: 29 | python-versions: 'cp36-cp36m cp37-cp37m cp38-cp38' 30 | build-requirements: 'numpy' 31 | 32 | - name: Publish wheels to PyPI 33 | env: 34 | TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} 35 | TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} 36 | run: | 37 | twine upload wheelhouse/*-manylinux*.whl -------------------------------------------------------------------------------- /docs/sphinx-theme/caer_sphinx_theme/static/images/chevron-right-white.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | Page 1 7 | Created with Sketch. 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /docs/sphinx-theme/images/chevron-down-grey.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | Created with Sketch. 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /docs/sphinx-theme/scss/shared/_code.scss: -------------------------------------------------------------------------------- 1 | code, kbd, pre, samp { 2 | @include code_font_family; 3 | span { 4 | @include code_font_family; 5 | } 6 | } 7 | 8 | pre { 9 | padding: rem(18px); 10 | background-color: $code_background_color; 11 | 12 | code { 13 | font-size: rem(14px); 14 | } 15 | 16 | &.highlight { 17 | background-color: $code_background_color; 18 | line-height: rem(21px); 19 | } 20 | } 21 | 22 | code.highlighter-rouge { 23 | color: $content_text_color; 24 | background-color: $light_grey; 25 | padding: 2px 6px; 26 | } 27 | 28 | a:link, 29 | a:visited, 30 | a:hover { 31 | code.highlighter-rouge { 32 | color: $code_link_color; 33 | } 34 | 35 | &.has-code { 36 | color: $code_link_color; 37 | } 38 | } 39 | 40 | p, 41 | h1, 42 | h2, 43 | h3, 44 | h4, 45 | h5, 46 | h6 { 47 | code { 48 | font-size: 78.5%; 49 | } 50 | } 51 | 52 | pre { 53 | white-space: pre-wrap; 54 | white-space: -moz-pre-wrap; 55 | white-space: -pre-wrap; 56 | white-space: -o-pre-wrap; 57 | word-wrap: break-word; 58 | } 59 | -------------------------------------------------------------------------------- /.flake8: -------------------------------------------------------------------------------- 1 | [flake8] 2 | # Intial set of rules 3 | # Feel Free to add any new rule here with description of what it does. 4 | 5 | # E203 Whitespace before ':' 6 | # E266 Too many leading '#' for block comment 7 | # E501 Line too long (82 > 79 characters) 8 | # W503 Line break occurred before a binary operator 9 | # F405 '' may be undefined, or defined from star imports 10 | # E402 module level import not at top of file 11 | # E731 do not assign a lambda expression, use a def 12 | # F821 undefined name 'get_ipython' --> from generated python files using nbconvert 13 | # W605 invalid escape sequence '\W' 14 | 15 | filename = 16 | *.py, 17 | 18 | exclude = 19 | .git, 20 | __pycache__, 21 | 22 | select = 23 | E772, 24 | F401, 25 | F811, 26 | E901, 27 | E999, 28 | F821, 29 | F822, 30 | F823, 31 | C901, # complexity 32 | E501, # line length 33 | E225 # whitespace around operators 34 | max_complexity = 70 35 | show_source = True 36 | statistics = True 37 | count = True 38 | 39 | # TBH I prefer 120 as opposed to 79/88 40 | max_line_length = 120 41 | -------------------------------------------------------------------------------- /docs/sphinx-theme/caer_sphinx_theme/static/images/chevron-down-grey.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | Created with Sketch. 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /caer/color/_constants.py: -------------------------------------------------------------------------------- 1 | # _____ ______ _____ 2 | # / ____/ /\ | ____ | __ \ 3 | # | | / \ | |__ | |__) | Caer - Modern Computer Vision 4 | # | | / /\ \ | __| | _ / Languages: Python, C, C++, Cuda 5 | # | |___ / ____ \ | |____ | | \ \ http://github.com/jasmcaus/caer 6 | # \_____\/_/ \_ \______ |_| \_\ 7 | 8 | # Licensed under the MIT License 9 | # SPDX-License-Identifier: MIT 10 | # Copyright (c) 2020-2025 The Caer Authors 11 | 12 | 13 | ## Color Spaces 14 | IMREAD_COLOR = 1 15 | BGR2RGB = 4 16 | BGR2GRAY = 6 17 | RGB2GRAY = 7 18 | GRAY2BGR = 8 19 | GRAY2RGB = 8 20 | BGR2HSV = 40 21 | RGB2BGR = BGR2RGB 22 | RGB2HSV = 41 23 | BGR2LAB = 44 24 | RGB2LAB = 45 25 | BGR2LUV = 50 26 | RGB2LUV = 51 27 | BGR2HLS = 52 28 | RGB2HLS = 53 29 | HSV2BGR = 54 30 | HSV2RGB = 55 31 | LAB2BGR = 56 32 | LAB2RGB = 57 33 | LUV2BGR = 58 34 | LUV2RGB = 59 35 | HLS2BGR = 60 36 | HLS2RGB = 61 37 | BGR2YUV = 82 38 | RGB2YUV = 83 39 | YUV2BGR = 84 40 | YUV2RGB = 85 41 | __all__ = [d for d in dir() if not d.startswith('_')] 42 | -------------------------------------------------------------------------------- /tools/replace_version.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | def replace_version(old_version, new_version): 4 | if not isinstance(old_version, tuple) or not isinstance(new_version, tuple): 5 | raise ValueError("`old_version` and `new_version` must be a version tuple. Eg: (1.2.3)") 6 | 7 | major, minor, micro = old_version[:3] 8 | old_version = f'{major}.{minor}.{micro}' 9 | major, minor, micro = new_version[:3] 10 | new_version = f'{major}.{minor}.{micro}' 11 | print(f"New version = {new_version}") 12 | 13 | for root, _, files in os.walk('../caer'): 14 | for file in files: 15 | if file.endswith(('.py', '.cpp', '.c', '.h', '.hpp')): 16 | with open(os.path.abspath(os.path.join(root, file)), 'r') as f: 17 | new_text = f.read().replace('version ' + old_version, 'version ' + new_version) 18 | 19 | with open(os.path.abspath(os.path.join(root, file)), 'w') as f: 20 | print(os.path.abspath(os.path.join(root, file))) 21 | f.write(new_text) 22 | 23 | replace_version((1,8,0), (3,9,1)) 24 | 25 | -------------------------------------------------------------------------------- /caer/globals.py: -------------------------------------------------------------------------------- 1 | # _____ ______ _____ 2 | # / ____/ /\ | ____ | __ \ 3 | # | | / \ | |__ | |__) | Caer - Modern Computer Vision 4 | # | | / /\ \ | __| | _ / Languages: Python, C, C++, Cuda 5 | # | |___ / ____ \ | |____ | | \ \ http://github.com/jasmcaus/caer 6 | # \_____\/_/ \_ \______ |_| \_\ 7 | 8 | # Licensed under the MIT License 9 | # SPDX-License-Identifier: MIT 10 | # Copyright (c) 2020-2025 The Caer Authors 11 | 12 | 13 | __all__ = [ 14 | "CROP_CENTRE", 15 | "CROP_TOP", 16 | "CROP_LEFT", 17 | "CROP_RIGHT", 18 | "CROP_BOTTOM", 19 | "INTER_NEAREST", 20 | "INTER_LINEAR", 21 | "INTER_AREA", 22 | "INTER_CUBIC", 23 | ] 24 | 25 | 26 | # Configuration Variables used in Caer 27 | CROP_CENTRE = 1 28 | CROP_TOP = 2 29 | CROP_LEFT = 3 30 | CROP_RIGHT = 4 31 | CROP_BOTTOM = 5 32 | 33 | # OpenCV 34 | 35 | ## Interpolations 36 | INTER_NEAREST = 0 # cv.INTER_NEAREST 37 | INTER_LINEAR = 1 # cv.INTER_LINEAR 38 | INTER_CUBIC = 2 # cv.INTER_CUBIC 39 | INTER_AREA = 3 # cv.INTER_AREA 40 | -------------------------------------------------------------------------------- /caer/path/__init__.py: -------------------------------------------------------------------------------- 1 | # _____ ______ _____ 2 | # / ____/ /\ | ____ | __ \ 3 | # | | / \ | |__ | |__) | Caer - Modern Computer Vision 4 | # | | / /\ \ | __| | _ / Languages: Python, C, C++, Cuda 5 | # | |___ / ____ \ | |____ | | \ \ http://github.com/jasmcaus/caer 6 | # \_____\/_/ \_ \______ |_| \_\ 7 | 8 | # Licensed under the MIT License 9 | # SPDX-License-Identifier: MIT 10 | # Copyright (c) 2020-2025 The Caer Authors 11 | 12 | 13 | #pylint:disable=undefined-all-variable 14 | 15 | from .paths import ( 16 | list_images, 17 | list_videos, 18 | listdir, 19 | is_image, 20 | is_video, 21 | cwd, 22 | exists, 23 | get_size, 24 | abspath, 25 | isdir, 26 | isfile, 27 | mkdir, 28 | osname, 29 | chdir, 30 | join, 31 | dirname, 32 | 33 | # Variables 34 | _acceptable_video_formats, 35 | _acceptable_image_formats, 36 | 37 | __all__ as __all_paths__, 38 | ) 39 | 40 | __all__ = __all_paths__ 41 | 42 | # Stop polluting the namespace 43 | del __all_paths__ -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020-2025 Jason 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /docs/license.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020-2025 Jason 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /docs/sphinx-theme/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020-2025 Jason 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | Be sure you've searched [the documentation][documentation] for the error message you received. Also, unless you're an experienced caer developer, first create a pull request to see if someone else has seen a similar issue already and knows how to solve it. **Only file a bug report here when you're quite confident it's not an issue with your local setup.** 11 | 12 | Please confirm you have the latest versions of caer, numpy, opencv-contrib-python, and h5py prior to reporting a bug (delete one): YES / NO 13 | 14 | **Describe the bug** 15 | A clear and concise description of what the bug is. 16 | 17 | **To Reproduce** 18 | Steps to reproduce the behavior: 19 | 1. 20 | 21 | **Expected behavior** 22 | A clear and concise description of what you expected to happen. 23 | 24 | **Error with full stack trace** 25 | 26 | Place between these lines with triple backticks: 27 | 28 | ``` 29 | ``` 30 | 31 | **Additional context** 32 | Add any other context about the problem here. 33 | 34 | [documentation]: https://github.com/jasmcaus/caer/blob/master/docs/ -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: Tests 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | - dev 8 | pull_request: 9 | branches: 10 | - master 11 | - dev 12 | # schedule: 13 | # - cron: "0 4 * * *" 14 | 15 | jobs: 16 | tests: 17 | runs-on: ${{ matrix.os }} 18 | strategy: 19 | fail-fast: false 20 | matrix: 21 | os: [ubuntu-latest, macos-latest, windows-latest] 22 | python-version: [3.6, 3.7, 3.8] 23 | 24 | steps: 25 | - uses: actions/checkout@v2 26 | 27 | - name: Setup conda dependencies 28 | uses: conda-incubator/setup-miniconda@v2 29 | with: 30 | auto-update-conda: true 31 | python-version: ${{ matrix.python-version }} 32 | 33 | - name: Install dependencies 34 | shell: bash -l {0} 35 | run: | 36 | conda install curl make -c conda-forge 37 | pip install -r tools/requirements/test.txt 38 | make install 39 | 40 | - name: Run Tests 41 | shell: bash -l {0} 42 | # run: pytest -v --cov=caer --cov-report xml ./test 43 | run: pytest -v ./tests 44 | 45 | - name: Upload coverage 46 | uses: codecov/codecov-action@v1 47 | with: 48 | file: ./coverage.xml -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ### Description 2 | 3 | 4 | ### Types of changes 5 | 6 | - [ ] Bug fix (non-breaking change which fixes an issue) 7 | - [ ] Breaking change (fix or new feature that would cause existing functionality to change) 8 | - [ ] Docstrings/Documentation updated 9 | - [ ] New Feature to Caer 10 | - [ ] New Examples to [`examples`](https://github.com/jasmcaus/caer/tree/master/examples) 11 | - [ ] New tests added to cover the changes 12 | 13 | 14 | ### Related Issues 15 | 16 | 17 | 18 | ### Checklist: 19 | 20 | 21 | - [ ] I have followed the [contribution guidelines](CONTRIBUTING.md) and code style for this project. 22 | - [ ] I have added tests covering my contributions (**important**). 23 | - [ ] I have updated the documentation accordingly. 24 | - [ ] This PR is being made to `dev` and not `master` (**important**). 25 | - [ ] I will squash merge this PR into `dev` (optional) 26 | -------------------------------------------------------------------------------- /.github/config.yml: -------------------------------------------------------------------------------- 1 | # Configuration for sentiment-bot - https://github.com/behaviorbot/sentiment-bot 2 | 3 | #Replies to toxic comments with a maintainer designated reply and a link to the repo's code of conduct 4 | 5 | # *Required* toxicity threshold between 0 and .99 with the higher numbers being the most toxic 6 | # Anything higher than this threshold will be marked as toxic and commented on 7 | sentimentBotToxicityThreshold: .7 8 | 9 | # *Required* Comment to reply with 10 | sentimentBotReplyComment: > 11 | Please be sure to review the [code of conduct](https://github.com/jasmcaus/caer/blob/master/CODE_OF_CONDUCT.md) and be respectful of other users. cc/ @jasmcaus 12 | # Configuration for request-info - https://github.com/behaviorbot/request-info 13 | 14 | # # *Required* Comment to reply with 15 | # requestInfoReplyComment: > 16 | # We would appreciate it if you could provide us with more info about this issue or pull request! Please check the [issue template](https://github.com/jasmcaus/caer/blob/master/.github/ISSUE_TEMPLATE) and the [pull request template](https://github.com/jasmcaus/caer/blob/master/.github/PR_TEMPLATE.md). 17 | 18 | # *OPTIONAL* Label to be added to Issues and Pull Requests with insufficient information given 19 | requestInfoLabelToAdd: "state: needs more info" -------------------------------------------------------------------------------- /tests/transforms/test_transforms.py: -------------------------------------------------------------------------------- 1 | # _____ ______ _____ 2 | # / ____/ /\ | ____ | __ \ 3 | # | | / \ | |__ | |__) | Caer - Modern Computer Vision 4 | # | | / /\ \ | __| | _ / Languages: Python, C, C++, Cuda 5 | # | |___ / ____ \ | |____ | | \ \ http://github.com/jasmcaus/caer 6 | # \_____\/_/ \_ \______ |_| \_\ 7 | 8 | # Licensed under the MIT License 9 | # SPDX-License-Identifier: MIT 10 | # Copyright (c) 2020-2025 The Caer Authors 11 | 12 | import numpy as np 13 | import cv2 as cv 14 | import caer 15 | 16 | 17 | def test_flips(): 18 | tens = caer.data.sunrise() 19 | 20 | vflip = caer.transforms.vflip(tens) 21 | hflip = caer.transforms.hflip(tens) 22 | hvflip = caer.transforms.hvflip(tens) 23 | 24 | cv_vflip = cv.flip(tens, 0) 25 | cv_hflip = cv.flip(tens, 1) 26 | cv_hvflip = cv.flip(tens, -1) 27 | 28 | # Assert same shapes 29 | assert vflip.shape == tens.shape 30 | assert hflip.shape == tens.shape 31 | assert hvflip.shape == tens.shape 32 | 33 | # Assert everything else 34 | assert np.all(vflip == cv_vflip) 35 | assert np.all(hflip == cv_hflip) 36 | assert np.all(hvflip == cv_hvflip) 37 | 38 | 39 | -------------------------------------------------------------------------------- /caer/video/__init__.py: -------------------------------------------------------------------------------- 1 | # _____ ______ _____ 2 | # / ____/ /\ | ____ | __ \ 3 | # | | / \ | |__ | |__) | Caer - Modern Computer Vision 4 | # | | / /\ \ | __| | _ / Languages: Python, C, C++, Cuda 5 | # | |___ / ____ \ | |____ | | \ \ http://github.com/jasmcaus/caer 6 | # \_____\/_/ \_ \______ |_| \_ 7 | 8 | # Licensed under the MIT License 9 | # SPDX-License-Identifier: MIT 10 | # Copyright (c) 2020-2025 The Caer Authors 11 | 12 | 13 | from .extract_frames import ( 14 | extract_frames, 15 | __all__ as __all_extract__ 16 | ) 17 | 18 | from .livestream import ( 19 | LiveStream, 20 | __all__ as __all_live__ 21 | ) 22 | 23 | from .stream import ( 24 | Stream, 25 | __all__ as __all_str__ 26 | ) 27 | 28 | from .gpufilestream import ( 29 | GPUFileStream, 30 | __all__ as __all_gpu__ 31 | ) 32 | 33 | from .frames_and_fps import ( 34 | count_frames, 35 | get_fps, 36 | __all__ as __all_ffps__ 37 | ) 38 | 39 | 40 | __all__ = __all_extract__ + __all_str__ + __all_live__ + __all_ffps__ + __all_gpu__ 41 | 42 | 43 | # Stop polluting the namespace 44 | del __all_extract__ 45 | del __all_str__ 46 | del __all_ffps__ 47 | del __all_gpu__ 48 | del __all_live__ -------------------------------------------------------------------------------- /docs/sphinx-theme/images/pytorch-github.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 15 | 16 | -------------------------------------------------------------------------------- /docs/sphinx-theme/images/arrow-right-with-tail.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Page 1 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /tools/travis/before-install.sh: -------------------------------------------------------------------------------- 1 | mkdir -p ~/.local/bin 2 | export PATH=$HOME/.local/bin:$PATH 3 | export PATH=$HOME/miniconda/bin:$PATH 4 | 5 | if test -e $HOME/miniconda/bin; then 6 | echo "Miniconda is already installed." 7 | else 8 | rm -rf $HOME/miniconda 9 | wget http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh 10 | chmod +x miniconda.sh 11 | ./miniconda.sh -b -p $HOME/miniconda 12 | conda update --yes --quiet conda 13 | fi 14 | 15 | # For debugging: 16 | conda info -a 17 | 18 | # python -m pip install --upgrade pip wheel 19 | 20 | # # install specific wheels from wheelhouse 21 | # for requirement in opencv-contrib-python requests numpy; do 22 | # WHEELS="$WHEELS $(grep $requirement requirements/default.txt)" 23 | # done 24 | 25 | # # cython is not in the default.txt requirements 26 | # WHEELS="$WHEELS $(grep -i cython requirements/build.txt)" 27 | # python -m pip install $PIP_FLAGS $WHEELHOUSE $WHEELS 28 | 29 | # # Install build time requirements 30 | # python -m pip install $PIP_FLAGS -r requirements/build.txt 31 | # # Default requirements are necessary to build because of lazy importing 32 | # # They can be moved after the build step if #3158 is accepted 33 | # python -m pip install $PIP_FLAGS -r requirements/default.txt 34 | 35 | # # Show what's installed 36 | # python -m pip list -------------------------------------------------------------------------------- /docs/sphinx-theme/caer_sphinx_theme/static/images/pytorch-github.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 15 | 16 | -------------------------------------------------------------------------------- /docs/sphinx-theme/caer_sphinx_theme/static/images/arrow-right-with-tail.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Page 1 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /docs/sphinx-theme/images/arrow-down-orange.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Group 5 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /docs/sphinx-theme/caer_sphinx_theme/static/images/arrow-down-orange.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Group 5 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /docs/sphinx-theme/images/logo-twitter-dark.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /docs/sphinx-theme/caer_sphinx_theme/static/images/logo-twitter-dark.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /docs/sphinx-theme/caer_sphinx_theme/versions.html: -------------------------------------------------------------------------------- 1 | {% if READTHEDOCS %} 2 | {# Add rst-badge after rst-versions for small badge style. #} 3 |
4 | 5 | Read the Docs 6 | v: {{ current_version }} 7 | 8 | 9 |
10 |
11 |
{{ _('Versions') }}
12 | {% for slug, url in versions %} 13 |
{{ slug }}
14 | {% endfor %} 15 |
16 |
17 |
{{ _('Downloads') }}
18 | {% for type, url in downloads %} 19 |
{{ type }}
20 | {% endfor %} 21 |
22 |
23 |
{{ _('On Read the Docs') }}
24 |
25 | {{ _('Project Home') }} 26 |
27 |
28 | {{ _('Builds') }} 29 |
30 |
31 |
32 | {% trans %}Free document hosting provided by Read the Docs.{% endtrans %} 33 | 34 |
35 |
36 | {% endif %} 37 | 38 | -------------------------------------------------------------------------------- /docs/sphinx-theme/caer_sphinx_theme/search.html: -------------------------------------------------------------------------------- 1 | {# 2 | basic/search.html 3 | ~~~~~~~~~~~~~~~~~ 4 | 5 | Template for the search page. 6 | 7 | :copyright: Copyright 2007-2013 by the Sphinx team, see AUTHORS. 8 | :license: BSD, see LICENSE for details. 9 | #} 10 | {%- extends "layout.html" %} 11 | {% set title = _('Search') %} 12 | {% set script_files = script_files + ['_static/searchtools.js'] %} 13 | {% block footer %} 14 | 15 | {{ super() }} 16 | {% endblock %} 17 | {% block body %} 18 | 26 | 27 | {% if search_performed %} 28 |

{{ _('Search Results') }}

29 | {% if not search_results %} 30 |

{{ _('Your search did not match any documents. Please make sure that all words are spelled correctly and that you\'ve selected enough categories.') }}

31 | {% endif %} 32 | {% endif %} 33 |
34 | {% if search_results %} 35 |
    36 | {% for href, caption, context in search_results %} 37 |
  • 38 | {{ caption }} 39 |

    {{ context|e }}

    40 |
  • 41 | {% endfor %} 42 |
43 | {% endif %} 44 |
45 | {% endblock %} 46 | -------------------------------------------------------------------------------- /caer/transforms/blur.py: -------------------------------------------------------------------------------- 1 | # _____ ______ _____ 2 | # / ____/ /\ | ____ | __ \ 3 | # | | / \ | |__ | |__) | Caer - Modern Computer Vision 4 | # | | / /\ \ | __| | _ / Languages: Python, C, C++, Cuda 5 | # | |___ / ____ \ | |____ | | \ \ http://github.com/jasmcaus/caer 6 | # \_____\/_/ \_ \______ |_| \_\ 7 | 8 | # Licensed under the MIT License 9 | # SPDX-License-Identifier: MIT 10 | # Copyright (c) 2020-2025 The Caer Authors 11 | 12 | import cv2 as cv 13 | import numpy as np 14 | 15 | from ..coreten import Tensor 16 | 17 | __all__ = [ 18 | "blur", 19 | "gaussian_blur", 20 | "median_blur", 21 | "motion_blur" 22 | ] 23 | 24 | def blur(tens: Tensor, ksize:int) -> Tensor: 25 | return cv.blur(tens, ksize=(ksize, ksize)) 26 | 27 | 28 | def gaussian_blur(tens: Tensor, ksize:int, sigma=0) -> Tensor: 29 | # When sigma=0, it is computed as `sigma = 0.3*((ksize-1)*0.5 - 1) + 0.8` 30 | return cv.GaussianBlur(tens, ksize=(ksize, ksize), sigmaX=sigma) 31 | 32 | 33 | def median_blur(tens: Tensor, ksize:int) -> Tensor: 34 | if tens.dtype == np.float32 and ksize not in {3, 5}: 35 | raise ValueError( 36 | "Invalid ksize value {}. For a float32 image the only valid ksize values are 3 and 5".format(ksize) 37 | ) 38 | 39 | return cv.medianBlur(tens, ksize=ksize) 40 | 41 | 42 | def motion_blur(tens: Tensor, kernel) -> Tensor: 43 | return cv.filter2D(tens, ddepth=-1, kernel=kernel) -------------------------------------------------------------------------------- /.github/workflows/codeql_analyze.yml: -------------------------------------------------------------------------------- 1 | name: 'CodeQL Analysis' 2 | 3 | on: 4 | schedule: 5 | - cron: '30 6 * * 1' 6 | 7 | jobs: 8 | analyze: 9 | name: Analyze 10 | runs-on: ubuntu-latest 11 | 12 | strategy: 13 | fail-fast: false 14 | matrix: 15 | language: [ 'python'] 16 | # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] 17 | # 18 | 19 | steps: 20 | - name: Checkout repository 21 | uses: actions/checkout@v2 22 | 23 | - name: Initialize CodeQL 24 | uses: github/codeql-action/init@v1 25 | with: 26 | languages: ${{ matrix.language }} 27 | 28 | 29 | # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). 30 | # If this step fails, then you should remove it and run the build manually (see below) 31 | - name: Autobuild 32 | uses: github/codeql-action/autobuild@v1 33 | 34 | # ℹ️ Command-line programs to run using the OS shell. 35 | # 📚 https://git.io/JvXDl 36 | 37 | # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines 38 | # and modify them (or add more) to build your code if your project 39 | # uses a compiled language 40 | 41 | #- run: | 42 | # make bootstrap 43 | # make release 44 | 45 | - name: Perform CodeQL Analysis 46 | uses: github/codeql-action/analyze@v1 -------------------------------------------------------------------------------- /docs/sphinx-theme/images/icon-close.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Page 1 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /docs/sphinx-theme/caer_sphinx_theme/static/images/icon-close.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Page 1 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /docs/sphinx-theme/README.md: -------------------------------------------------------------------------------- 1 | # Caer Sphinx Theme 2 | 3 | Sphinx theme for [Caer Docs](https://caer.readthedocs.io/en/latest/) based on the [Read the Docs Sphinx Theme](https://sphinx-rtd-theme.readthedocs.io/en/latest). 4 | 5 | Adapted from the [PyTorch Sphinx Theme](https://github.com/pytorch/pytorch_sphinx_theme). 6 | 7 | ## Local Development 8 | 9 | Run python setup: 10 | 11 | ```bash 12 | python setup.py install 13 | ``` 14 | 15 | 16 | ### Built-in Stylesheets and Fonts 17 | 18 | There are a couple of stylesheets and fonts inside the Docs and Tutorials repos themselves meant to override the existing theme. To ensure the most accurate styles we should comment out those files until the maintainers of those repos remove them: 19 | 20 | #### Docs 21 | 22 | ```bash 23 | # ./docs/source/conf.py 24 | 25 | html_context = { 26 | # 'css_files': [ 27 | # 'https://fonts.googleapis.com/css?family=Lato', 28 | # '_static/css/pytorch_theme.css' 29 | # ], 30 | } 31 | ``` 32 | 33 | #### Tutorials 34 | 35 | ```bash 36 | # ./conf.py 37 | 38 | # app.add_stylesheet('css/pytorch_theme.css') 39 | # app.add_stylesheet('https://fonts.googleapis.com/css?family=Lato') 40 | ``` 41 | 42 | 43 | ### Top/Mobile Navigation 44 | 45 | The top navigation and mobile menu expect an "active" state for one of the menu items. To ensure that either "Docs" or "Tutorials" is marked as active, set the following config value in the respective `conf.py`, where `{project}` is either `"docs"` or `"tutorials"`. 46 | 47 | ```bash 48 | html_theme_options = { 49 | ... 50 | 'caer_project': {project} 51 | ... 52 | } 53 | ``` 54 | 55 | -------------------------------------------------------------------------------- /caer/video/frames_and_fps.py: -------------------------------------------------------------------------------- 1 | # _____ ______ _____ 2 | # / ____/ /\ | ____ | __ \ 3 | # | | / \ | |__ | |__) | Caer - Modern Computer Vision 4 | # | | / /\ \ | __| | _ / Languages: Python, C, C++, Cuda 5 | # | |___ / ____ \ | |____ | | \ \ http://github.com/jasmcaus/caer 6 | # \_____\/_/ \_ \______ |_| \_\ 7 | 8 | # Licensed under the MIT License 9 | # SPDX-License-Identifier: MIT 10 | # Copyright (c) 2020-2025 The Caer Authors 11 | 12 | 13 | from .stream import Stream 14 | from ..path import exists 15 | from ..annotations import Optional 16 | 17 | __all__ = [ 18 | "count_frames", 19 | "get_fps" 20 | ] 21 | 22 | 23 | def count_frames(video_path : str): 24 | r""" 25 | Returns the number of frames in a video at ``video_path``. 26 | 27 | Args: 28 | video_path (str): Video Filepath 29 | 30 | Returns: 31 | Frame count 32 | 33 | """ 34 | if video_path is None: 35 | raise ValueError("Specify a valid video path") 36 | 37 | stream = Stream(video_path) 38 | frame_count = stream.count_frames() 39 | stream.release() 40 | return frame_count 41 | 42 | 43 | def get_fps(video_path : str): 44 | r""" 45 | Returns the FPS in a video at ``video_path``. 46 | 47 | Args: 48 | video_path (str): Video Filepath 49 | 50 | Returns: 51 | FPS value. 52 | 53 | """ 54 | if not exists(video_path): 55 | raise ValueError("Specify a valid video path") 56 | 57 | stream = Stream(video_path) 58 | fps_count = stream.get_fps() 59 | stream.release() 60 | 61 | return fps_count -------------------------------------------------------------------------------- /docs/sphinx-theme/images/pytorch-colab.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 9 | 10 | 13 | 15 | 17 | 20 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /docs/sphinx-theme/caer_sphinx_theme/static/images/pytorch-colab.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 9 | 10 | 13 | 15 | 17 | 20 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /caer/transforms/__init__.py: -------------------------------------------------------------------------------- 1 | # _____ ______ _____ 2 | # / ____/ /\ | ____ | __ \ 3 | # | | / \ | |__ | |__) | Caer - Modern Computer Vision 4 | # | | / /\ \ | __| | _ / Languages: Python, C, C++, Cuda 5 | # | |___ / ____ \ | |____ | | \ \ http://github.com/jasmcaus/caer 6 | # \_____\/_/ \_ \______ |_| \_\ 7 | 8 | # Licensed under the MIT License 9 | # SPDX-License-Identifier: MIT 10 | # Copyright (c) 2020-2025 The Caer Authors 11 | 12 | r""" 13 | caer.transforms consists of position and color-based transforms for use. 14 | """ 15 | 16 | # Don't import from functional.py 17 | 18 | from .position import ( 19 | hflip, 20 | vflip, 21 | hvflip, 22 | rand_flip, 23 | scale, 24 | translate, 25 | transpose, 26 | rotate, 27 | crop, 28 | center_crop, 29 | rand_crop, 30 | posterize, 31 | solarize, 32 | equalize, 33 | clip, 34 | pad, 35 | __all__ as __all_pos__ 36 | ) 37 | 38 | from .color import ( 39 | adjust_brightness, 40 | adjust_contrast, 41 | adjust_hue, 42 | adjust_saturation, 43 | adjust_gamma, 44 | affine, 45 | darken, 46 | brighten, 47 | random_brightness, 48 | correct_exposure, 49 | augment_random, 50 | __all__ as __all_color__ 51 | ) 52 | 53 | from .simulate import ( 54 | sim_snow, 55 | sim_rain, 56 | sim_fog, 57 | sim_gravel, 58 | sim_sun_flare, 59 | sim_motion_blur, 60 | sim_autumn, 61 | sim_shadow, 62 | __all__ as __all_sim__ 63 | ) 64 | 65 | __all__ = __all_color__ + __all_pos__ + __all_sim__ 66 | 67 | 68 | # Stop polluting the namespace 69 | del __all_pos__ 70 | del __all_color__ 71 | del __all_sim__ -------------------------------------------------------------------------------- /docs/sphinx-theme/images/search-icon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Created with Sketch. 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /docs/source/index.rst: -------------------------------------------------------------------------------- 1 | .. caer documentation master file, created by 2 | sphinx-quickstart on Tue Oct 6 10:38:42 2020. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | 7 | Documentation 8 | =================================== 9 | 10 | Caer is a lightweight Computer Vision library for high-performance AI research. It simplifies your approach towards Computer Vision by abstracting away unnecessary boilerplate code enabling maximum flexibility. By offering powerful image and video processing algorithms, Caer provides both casual and advanced users with an elegant interface for Machine vision operations. 11 | 12 | It leverages the power of libraries like OpenCV and Pillow to speed up your Computer Vision workflow — making it fully compatible with other frameworks such as PyTorch and Tensorflow. 13 | 14 | This design philosophy makes Caer ideal for students, researchers, hobbyists and even experts in the fields of Deep Learning and Computer Vision to quickly prototype deep learning models or research ideas. 15 | 16 | 17 | .. toctree:: 18 | :maxdepth: 1 19 | :caption: First Steps 20 | 21 | introduction.md 22 | install.md 23 | type-checking.md 24 | community/CONTRIBUTING.md 25 | 26 | 27 | .. toctree:: 28 | :maxdepth: 1 29 | :caption: API 30 | 31 | api/coreten 32 | api/color 33 | api/data 34 | api/io 35 | api/path 36 | api/transforms 37 | api/video 38 | 39 | 40 | .. toctree:: 41 | :maxdepth: 1 42 | :name: community 43 | :caption: Community 44 | 45 | community/CONTRIBUTING.rst 46 | community/CODE_OF_CONDUCT.rst 47 | community/governance.rst 48 | 49 | 50 | Indices and tables 51 | ================== 52 | 53 | * :ref:`genindex` 54 | * :ref:`modindex` 55 | * :ref:`search` -------------------------------------------------------------------------------- /docs/sphinx-theme/caer_sphinx_theme/static/images/search-icon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Created with Sketch. 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /.pep8speaks.yml: -------------------------------------------------------------------------------- 1 | scanner: 2 | diff_only: True # If False, the entire file touched by the Pull Request is scanned for errors. If True, only the diff is scanned. 3 | linter: pycodestyle # Other option is flake8 4 | 5 | pycodestyle: # Same as scanner.linter value. Other option is flake8 6 | max-line-length: 120 # Default is 79 in PEP 8 7 | ignore: # Errors and warnings to ignore 8 | - W504 # line break after binary operator 9 | - E402 # module level import not at top of file 10 | - E731 # do not assign a lambda expression, use a def 11 | - C406 # Unnecessary list literal - rewrite as a dict literal. 12 | - E741 # ambiguous variable name 13 | - F401 14 | - F841 15 | - E203 # whitespace before ':'. Opposite convention enforced by black 16 | - E501 # line too long. Handled by black 17 | - W503 # line break before binary operator, need for black 18 | 19 | 20 | no_blank_comment: True # If True, no comment is made on PR without any errors. 21 | descending_issues_order: False # If True, PEP 8 issues in message will be displayed in descending order of line numbers in the file 22 | 23 | 24 | message: # Customize the comment made by the bot, 25 | opened: # Messages when a new PR is submitted 26 | header: "Hello @{name}! Thanks for opening this PR. " 27 | # The keyword {name} is converted into the author's username 28 | footer: "Do see the [Hitchhiker's guide to code style](https://goo.gl/hqbW4r)" 29 | # The messages can be written as they would over GitHub 30 | 31 | updated: # Messages when new commits are added to the PR 32 | header: "Hello @{name}! Thanks for updating this PR. " 33 | footer: "" # Why to comment the link to the style guide everytime? :) 34 | no_errors: "There are currently no PEP 8 issues detected in this Pull Request. Cheers! :beers: " -------------------------------------------------------------------------------- /.github/workflows/code_format.yml: -------------------------------------------------------------------------------- 1 | name: 'Check Code Format' 2 | 3 | on: 4 | push: 5 | branches: [master, dev, "release/*"] # include release branches like release/1.0.x 6 | pull_request: 7 | branches: [master, dev, "release/*"] 8 | 9 | jobs: 10 | # imports-check-isort: 11 | # name: Check valid import formatting with isort 12 | # runs-on: ubuntu-20.04 13 | # steps: 14 | # - name: Checkout 15 | # uses: actions/checkout@v2 16 | 17 | # - name: Set up Python 3.8 18 | # uses: actions/setup-python@v2 19 | # with: 20 | # python-version: 3.8 21 | 22 | # - name: Install isort 23 | # run: pip install isort==5.6.4 24 | 25 | # - name: Run isort 26 | # run: isort --settings-path=./pyproject.toml --check-only --diff . 27 | 28 | code-black: 29 | name: Check code formatting with Black 30 | runs-on: ubuntu-20.04 31 | steps: 32 | - name: Checkout 33 | uses: actions/checkout@v2 34 | - name: Set up Python 3.8 35 | uses: actions/setup-python@v2 36 | with: 37 | python-version: 3.8 38 | 39 | - name: Install Black 40 | run: pip install black==19.10b0 41 | 42 | - name: Run Black 43 | run: echo "LGTM" 44 | # run black --skip-string-normalization --config=pyproject.toml --check . # TODO, uncomment 45 | 46 | # python-pep8: 47 | # name: Python formatting PEP8 48 | # runs-on: ubuntu-20.04 49 | 50 | # # Timeout: https://stackoverflow.com/a/59076067/4521646 51 | # timeout-minutes: 10 52 | # steps: 53 | # - name: Checkout 54 | # uses: actions/checkout@v2 55 | # - uses: actions/setup-python@v2 56 | # with: 57 | # python-version: 3.7 58 | 59 | # - name: Install dependencies 60 | # run: | 61 | # pip install flake8 62 | 63 | # - name: Run checking 64 | # run: | 65 | # flake8 . -------------------------------------------------------------------------------- /tools/travis.yml: -------------------------------------------------------------------------------- 1 | # sudo: required 2 | # dist: xenial 3 | # language: python 4 | # python: 5 | # - "3.7" 6 | # - "3.8" 7 | 8 | # before_install: 9 | # - sudo apt-get update 10 | # - sudo apt-get install python3-numpy python3-pytest 11 | # # - sudo apt-get install python3-opencv 12 | 13 | # install: "pip install -r tools/requirements/test.txt" 14 | 15 | # # virtualenv: 16 | # # system_site_packages: true 17 | 18 | # script: 19 | # - cd tests 20 | # - python3 -m pytest -s -v 21 | 22 | # # sudo: required 23 | # # dist: xenial 24 | # # language: python 25 | # # cache: 26 | # # ccache: true 27 | # # directories: 28 | # # - $HOME/.ccache 29 | # # - $HOME/miniconda 30 | 31 | # # before_cache: 32 | # # - ccache --show-stats 33 | # # - ccache --zero-stats 34 | 35 | # # python: 36 | # # - "3.6" 37 | # # - "3.7" 38 | 39 | # # env: 40 | # # global: 41 | # # - USE_CCACHE=1 42 | 43 | # # matrix: 44 | # # - NUMPY_VERSION=1.10 45 | # # - NUMPY_VERSION=1.11 46 | # # - NUMPY_VERSION=1.12 47 | # # - NUMPY_VERSION=1.13 48 | # # - NUMPY_VERSION=1.14 49 | # # - NUMPY_VERSION=1.15 50 | # # - NUMPY_VERSION=1.16 51 | # # - NUMPY_VERSION=1.17 52 | # # - NUMPY_VERSION=1.18 53 | 54 | 55 | # # # Some combinations seem to be missing on conda 56 | # # matrix: 57 | # # exclude: 58 | # # - python: "3.6" 59 | # # env: NUMPY_VERSION=1.10 60 | # # - python: "3.7" 61 | # # env: NUMPY_VERSION=1.10 62 | # # - python: "3.7" 63 | # # env: NUMPY_VERSION=1.12 64 | # # - python: "3.7" 65 | # # env: NUMPY_VERSION=1.13 66 | 67 | # # before_install: 68 | # # - tools/travis/before-install.sh 69 | 70 | # # install: 71 | # # - export PATH=$HOME/miniconda/bin:$PATH 72 | # # - export PATH=/usr/lib/ccache:$PATH 73 | # # - .travis/install.sh 74 | 75 | # # script: 76 | # # - source activate condaenv 77 | # # - export DEBUG=2 78 | # # - coverage run --source=tests -m pytest -v 79 | 80 | # # after_success: 81 | # # - source activate condaenv 82 | # # - coveralls -------------------------------------------------------------------------------- /configs.ini: -------------------------------------------------------------------------------- 1 | [metadata] 2 | name = caer 3 | user = jasmcaus 4 | status = 4 5 | author = Jason 6 | description = A lightweight Computer Vision library for high-performance AI research - Modern Computer Vision on the Fly. 7 | keywords = caer, computer vision, toolkit, deep learning,image processing, video processing, video stablization, video streaming, machine learning, gpu, artificial intelligence, data science, machine vision, opencv, multithreading, FFMpeg 8 | funding = https://www.paypal.me/jasmcaus 9 | pip_requirements = numpy, opencv-contrib-python, typing-extensions, mypy 10 | download_url = https://pypi.org/project/caer 11 | git_url = https://github.com/jasmcaus/caer 12 | docs_url = https://caer.readthedocs.io/ 13 | copyright = Jason 14 | contributors = Jason 15 | audience = Developers, Researchers, Education 16 | dev_language = Python 17 | language = English 18 | license = MIT License 19 | classifiers = 20 | Development Status :: 4 - Beta 21 | Intended Audience :: Developers 22 | Intended Audience :: Education 23 | Intended Audience :: Science/Research 24 | Programming Language :: Python :: 3 25 | Programming Language :: Python :: 3 :: Only 26 | Programming Language :: Python :: 3.6 27 | Programming Language :: Python :: 3.7 28 | Programming Language :: Python :: 3.8 29 | Programming Language :: Python :: 3.9 30 | Programming Language :: Python :: 3.10 31 | Programming Language :: Python :: 3.11 32 | Programming Language :: Python :: 3.12 33 | Operating System :: Microsoft :: Windows 34 | Operating System :: MacOS 35 | Operating System :: POSIX 36 | Operating System :: Unix 37 | Topic :: Scientific/Engineering 38 | Topic :: Scientific/Engineering :: Mathematics 39 | Topic :: Scientific/Engineering :: Artificial Intelligence 40 | Topic :: Scientific/Engineering :: Image Recognition 41 | Topic :: Scientific/Engineering :: Information Analysis 42 | License :: OSI Approved :: MIT License 43 | doc_path = docs 44 | git_branch = master 45 | lib_path = caer 46 | host = github 47 | min_python = 3.6 48 | zip_safe = False 49 | include_package_data = True -------------------------------------------------------------------------------- /docs/sphinx-theme/setup.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | from setuptools import setup 4 | from io import open 5 | 6 | __version__ = '1.0.0' 7 | 8 | def package_files(directory : str): 9 | """ 10 | Traverses target directory recursivery adding file paths to a list. 11 | Original solution found at: 12 | 13 | * https://stackoverflow.com/questions/27664504/\ 14 | how-to-add-package-data-recursively-in-python-setup-py 15 | 16 | Parameters 17 | ---------- 18 | directory: str 19 | Target directory to traverse. 20 | 21 | Returns 22 | ------- 23 | paths: list 24 | List of file paths. 25 | 26 | """ 27 | paths = [] 28 | for (path, _, files) in os.walk(directory): 29 | for file in files: 30 | paths.append(os.path.join('..', path, file)) 31 | 32 | return paths 33 | 34 | 35 | setup( 36 | name = 'caer_sphinx_theme', 37 | version =__version__, 38 | author = 'Jason', 39 | url="https://github.com/jasmcaus/caer-sphinx-theme", 40 | docs_url="https://github.com/jasmcaus/caer-sphinx-theme", 41 | description='Caer Sphinx Theme', 42 | py_modules = ['caer_sphinx_theme'], 43 | packages = ['caer_sphinx_theme'], 44 | include_package_data=True, 45 | zip_safe=False, 46 | package_data={'caer_sphinx_theme': [ 47 | 'theme.conf', 48 | '*.html', 49 | 'theme_variables.jinja', 50 | *package_files('caer_sphinx_theme/static') 51 | ]}, 52 | entry_points = { 53 | 'sphinx.html_themes': [ 54 | 'caer_sphinx_theme = caer_sphinx_theme', 55 | ] 56 | }, 57 | license= 'MIT License', 58 | classifiers=[ 59 | "Development Status :: 5 - Production/Stable", 60 | "Environment :: Web Environment", 61 | "Intended Audience :: Developers", 62 | "Intended Audience :: System Administrators", 63 | "License :: OSI Approved :: MIT License", 64 | "Operating System :: OS Independent", 65 | "Programming Language :: Python", 66 | "Topic :: Internet", 67 | "Topic :: Software Development :: Documentation" 68 | ], 69 | install_requires=[ 70 | 'sphinx' 71 | ] 72 | ) 73 | -------------------------------------------------------------------------------- /.github/stale.yml: -------------------------------------------------------------------------------- 1 | # Configuration for probot-stale - https://github.com/probot/stale 2 | 3 | # Number of days of inactivity before an Issue or Pull Request becomes stale 4 | daysUntilStale: 30 5 | 6 | # Number of days of inactivity before an Issue or Pull Request with the stale label is closed. 7 | # Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale. 8 | daysUntilClose: 7 9 | 10 | # Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable 11 | exemptLabels: 12 | - pinned 13 | - security 14 | - bounty 15 | - feature request 16 | 17 | # Label to use when marking an issue as stale 18 | staleLabel: "state: stale" 19 | 20 | # Set to true to ignore issues in a project (defaults to false) 21 | exemptProjects: false 22 | 23 | # Set to true to ignore issues in a milestone (defaults to false) 24 | exemptMilestones: false 25 | 26 | # Label to use when marking as stale 27 | staleLabel: wontfix 28 | 29 | # Comment to post when marking as stale. Set to `false` to disable 30 | markComment: > 31 | This issue has been automatically marked as stale because it has not had 32 | recent activity. It will be closed if no further activity occurs. Thank you 33 | for your contributions. 34 | 35 | > If this problem still occurs, please open a new issue 36 | # Comment to post when removing the stale label. 37 | # unmarkComment: > 38 | # Your comment here. 39 | 40 | # Comment to post when closing a stale Issue or Pull Request. 41 | # closeComment: > 42 | # Your comment here. 43 | 44 | # Limit the number of actions per hour, from 1-30. Default is 30 45 | limitPerRun: 30 46 | 47 | # Limit to only `issues` or `pulls` 48 | only: issues 49 | 50 | # Optionally, specify configuration settings that are specific to just 'issues' or 'pulls': 51 | # pulls: 52 | # daysUntilStale: 30 53 | # markComment: > 54 | # This pull request has been automatically marked as stale because it has not had 55 | # recent activity. It will be closed if no further activity occurs. Thank you 56 | # for your contributions. 57 | 58 | # issues: 59 | # exemptLabels: 60 | # - confirmed -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [aliases] 2 | test=pytest 3 | 4 | [build_ext] 5 | inplace=1 6 | 7 | [bdist_wheel] 8 | # Universal Wheels are wheels that are pure Python (i.e. contain no compiled extensions) and support both 9 | # Python 2 and 3. 10 | # Only use the --universal setting, if: 11 | # 1. Your project runs on Python 2 and 3 with no changes (i.e. it does not require 2to3). 12 | # 2. Your project does not have any C extensions --> Might be a problem for us #TODO 13 | 14 | # If your project has optional C extensions, it is recommended not to publish a universal wheel, because pip will 15 | # prefer the wheel over a source installation, and prevent the possibility of building the extension. 16 | 17 | # Removing this line (or setting universal to 0) will prevent bdist_wheel from trying to make a universal wheel. 18 | # For more see 19 | universal=0 20 | 21 | [tool:pytest] 22 | norecursedirs = 23 | .git 24 | dist 25 | build 26 | python_files = 27 | test_*.py 28 | # doctest_plus = disabled 29 | addopts = 30 | --strict 31 | --doctest-modules 32 | --color=yes 33 | markers = 34 | slow 35 | remote_data 36 | filterwarnings 37 | gpus_param_tests 38 | junit_duration_report = call 39 | 40 | [flake8] 41 | # TODO: this should be 88 or 100 according to PEP8 42 | max-line-length=120 43 | exclude = .tox, *.egg, build, temp, .git, __pycache__ 44 | select = 45 | E772, 46 | F401, 47 | F811, 48 | E901, 49 | E999, 50 | F821, 51 | F822, 52 | F823, 53 | C901, # complexity 54 | E501, # line length 55 | E225 # whitespace around operators 56 | doctests = True 57 | verbose = 2 58 | # https://pep8.readthedocs.io/en/latest/intro.html#error-codes 59 | format = pylint 60 | ignore = 61 | E731 62 | W504 63 | F401 64 | F841 65 | E203 # E203 - whitespace before ':'. Opposite convention enforced by black 66 | E231 # E231: missing whitespace after ',', ';', or ':'; for black 67 | E501 # E501 - line too long. Handled by black, we have longer lines 68 | W503 # W503 - line break before binary operator, need for black 69 | 70 | 71 | # setup.cfg or tox.ini 72 | [check-manifest] 73 | ignore = 74 | *.yml 75 | .github 76 | .github/* -------------------------------------------------------------------------------- /docs/source/community/CONTRIBUTING.rst: -------------------------------------------------------------------------------- 1 | Contributing to Caer 2 | ===================== 3 | 4 | Thank you for choosing to contribute to Caer. We'd love to accept your patches! For those just getting started, Github has a `how to `__. All bug fixes, new functionality, new tutorials etc. are (and should be) submitted via GitHub's mechanism of pull requests. 5 | 6 | Caer was made publically available in August 2020 by Jason and we are proud to have over 1.2m installs since then! Caer is now maintained by awesome community members just like you. 7 | 8 | We have written a comprehensive `Contribution Guide `__ that you can follow when contributing to the project. 9 | 10 | 11 | Documentation 12 | --------------- 13 | 14 | There is always room for improvement in documentation. We welcome all pull requests to fix typos/improve grammar or semantic structuring of documents. Here are a few documents you can work on: 15 | 16 | - `Official Tutorials `__ 17 | - `README `__ 18 | 19 | 20 | Open Issues 21 | -------------- 22 | 23 | If you would like to help in working on open issues. Look out for the following tags: ``good first issue``, ``help wanted``, ``open for contribution`` 24 | 25 | 26 | Major Contributions 27 | ---------------------- 28 | 29 | If you are willing to make a major contribution you can always lookout for the active sprint under ``Projects`` and discuss the proposal with one of our maintainers. 30 | 31 | 32 | What we currently need help on 33 | --------------------------------- 34 | 35 | - Improving unit-test cases and `test coverage `__ 36 | - Include GPU support 37 | 38 | 39 | If you write articles: 40 | ------------------------ 41 | 42 | If you are interested or have already written a story covering ``Caer``, you can submit your story in ``markdown`` format `as a PR here `__. 43 | To convert medium stories into ``markdown`` format, you may use this `chrome extension `__ 44 | -------------------------------------------------------------------------------- /docs/sphinx-theme/caer_sphinx_theme/fonts.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /docs/sphinx-theme/images/logo-pytorch-dark.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 15 | 17 | 18 | 21 | 23 | 26 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/sphinx-theme/caer_sphinx_theme/static/images/logo-pytorch-dark.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 15 | 17 | 18 | 21 | 23 | 26 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/sphinx-theme/images/logo-pytorch.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 16 | 18 | 19 | 22 | 24 | 27 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /docs/sphinx-theme/scss/shared/_base_styles.scss: -------------------------------------------------------------------------------- 1 | html { 2 | position: relative; 3 | min-height: 100%; 4 | font-size: 12px; 5 | 6 | @include desktop { 7 | font-size: 16px; 8 | } 9 | } 10 | 11 | * { 12 | box-sizing: border-box; 13 | } 14 | 15 | body { 16 | font-family: FreightSans, Helvetica Neue, Helvetica, Arial, sans-serif; 17 | } 18 | 19 | a:link, 20 | a:visited, 21 | a:hover { 22 | text-decoration: none; 23 | color: $orange; 24 | } 25 | 26 | a, .btn { 27 | &.with-right-arrow { 28 | padding-right: rem(22px); 29 | position: relative; 30 | background-image: url("../images/chevron-right-orange.svg"); 31 | background-size: 6px 13px; 32 | background-position: center right 5px; 33 | background-repeat: no-repeat; 34 | @include desktop { 35 | background-size: 8px 14px; 36 | background-position: center right 12px; 37 | padding-right: rem(32px); 38 | } 39 | } 40 | } 41 | 42 | ::-webkit-input-placeholder { 43 | color: $orange; 44 | } 45 | 46 | ::-moz-placeholder { 47 | color: $orange; 48 | } 49 | 50 | :-ms-input-placeholder { 51 | color: $orange; 52 | } 53 | 54 | :-moz-placeholder { 55 | color: $orange; 56 | } 57 | 58 | .email-subscribe-form { 59 | input.email { 60 | color: $orange; 61 | border: none; 62 | border-bottom: 1px solid #939393; 63 | width: 100%; 64 | background-color: transparent; 65 | outline: none; 66 | font-size: 1.125rem; 67 | letter-spacing: 0.25px; 68 | line-height: 2.25rem; 69 | } 70 | 71 | input[type="submit"] { 72 | position: absolute; 73 | right: 0; 74 | top: 10px; 75 | height: 15px; 76 | width: 15px; 77 | background-image: url("../images/arrow-right-with-tail.svg"); 78 | background-color: transparent; 79 | background-repeat: no-repeat; 80 | background-size: 15px 15px; 81 | background-position: center center; 82 | -webkit-appearance: none; 83 | -moz-appearance: none; 84 | appearance: none; 85 | border: 0; 86 | } 87 | } 88 | 89 | .email-subscribe-form-fields-wrapper { 90 | position: relative; 91 | } 92 | 93 | .anchorjs-link { 94 | color: $quick_start_grey !important; 95 | @include desktop { 96 | &:hover { 97 | color: inherit; 98 | text-decoration: none !important; 99 | } 100 | } 101 | } 102 | 103 | .pytorch-article #table-of-contents { 104 | display: none; 105 | } 106 | -------------------------------------------------------------------------------- /docs/sphinx-theme/scss/shared/_article.scss: -------------------------------------------------------------------------------- 1 | article.pytorch-article { 2 | max-width: 920px; 3 | margin: 0 auto; 4 | 5 | h2, 6 | h3, 7 | h4, 8 | h5, 9 | h6 { 10 | margin: rem(22px) 0; 11 | color: $not_quite_black; 12 | } 13 | 14 | h2 { 15 | font-size: rem(26px); 16 | letter-spacing: 1.33px; 17 | line-height: rem(32px); 18 | text-transform: none; 19 | } 20 | 21 | h3 { 22 | font-size: rem(24px); 23 | letter-spacing: -0.25px; 24 | line-height: rem(30px); 25 | text-transform: none; 26 | } 27 | 28 | h4, 29 | h5, 30 | h6 { 31 | font-size: rem(18px); 32 | letter-spacing: -0.19px; 33 | line-height: rem(30px); 34 | } 35 | 36 | p { 37 | margin-bottom: rem(18px); 38 | } 39 | 40 | p, 41 | ul li, 42 | ol li, 43 | dl dt, 44 | dl dd, 45 | blockquote { 46 | font-size: rem(16px); 47 | line-height: rem(22px); 48 | color: $slate; 49 | letter-spacing: 0.01px; 50 | font-weight: 500; 51 | } 52 | 53 | table { 54 | margin-bottom: rem(40px); 55 | width: 100%; 56 | } 57 | 58 | table thead { 59 | border-bottom: 1px solid #cacaca; 60 | } 61 | 62 | table th { 63 | padding: rem(10px); 64 | color: $not_quite_black; 65 | } 66 | 67 | 68 | table td { 69 | padding: rem(5px); 70 | } 71 | 72 | table tr th:first-of-type, 73 | table tr td:first-of-type { 74 | padding-left: 0; 75 | } 76 | 77 | table.docutils.field-list { 78 | th.field-name { 79 | padding: rem(5px); 80 | padding-left: 0; 81 | } 82 | 83 | td.field-body { 84 | padding: rem(5px); 85 | p:last-of-type { 86 | margin-bottom: 0; 87 | } 88 | } 89 | } 90 | 91 | ul, 92 | ol{ 93 | margin: rem(24px) 0 rem(50px) 0; 94 | 95 | @include desktop { 96 | padding-left: rem(100px); 97 | } 98 | 99 | li { 100 | margin-bottom: rem(10px); 101 | } 102 | } 103 | 104 | dl { 105 | margin-bottom: rem(24px); 106 | } 107 | 108 | dl dt { 109 | margin-bottom: rem(12px); 110 | } 111 | 112 | pre { 113 | margin-bottom: rem(40px); 114 | } 115 | 116 | hr { 117 | margin-top: rem(75px); 118 | margin-bottom: rem(75px); 119 | } 120 | 121 | blockquote { 122 | margin: 0 auto; 123 | margin-bottom: rem(40px); 124 | width: 65%; 125 | } 126 | 127 | tens { 128 | width: 100%; 129 | } 130 | } 131 | -------------------------------------------------------------------------------- /docs/sphinx-theme/caer_sphinx_theme/static/images/logo-pytorch.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 16 | 18 | 19 | 22 | 24 | 27 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /docs/sphinx-theme/scss/shared/_variables.scss: -------------------------------------------------------------------------------- 1 | $custom-font-size: 16px; 2 | $black: #000000; 3 | $white: #ffffff; 4 | $dark_grey: #6c6c6d; 5 | $light_grey: #f3f4f7; 6 | $orange: #792ee5; // TODO maybe rename variable 7 | $red_orange: #792ee5; // TODO maybe rename variable 8 | $medium_grey: #f3f4f7; 9 | $not_quite_black: #262626; 10 | $slate: #262626; 11 | $very_light_grey: #f3f4f7; 12 | $very_dark_grey: #CCCDD1; 13 | $content_text_color: #6c6c6d; 14 | $code_background_color: #f3f4f7; 15 | $dark_blue: #3d5a97; 16 | $quick_start_grey: #6c6c6d; 17 | $command_block_black: #6c6c6d; 18 | $smoky_grey: #CCCDD1; 19 | $medium_smoky_grey: #CCCDD1; 20 | $code_link_color: #fe6162; 21 | 22 | $desktop_menu_width: 350px; 23 | 24 | $desktop_header_height: 90px; 25 | $mobile_header_height: 68px; 26 | $desktop_footer_height: 420px; 27 | $site_horizontal_padding: 30px; 28 | 29 | $baseurl: ""; 30 | 31 | @mixin code_font_family { 32 | font-family: IBMPlexMono,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace; 33 | } 34 | 35 | @mixin desktop { 36 | @media screen and (min-width: 768px) { @content; } 37 | } 38 | 39 | @mixin full-nav-menu-desktop { 40 | @media screen and (min-width: 1100px) { @content; } 41 | } 42 | 43 | @mixin max-width-desktop { 44 | @media screen and (min-width: 1240px) { @content; } 45 | } 46 | 47 | @mixin small-desktop { 48 | @media (min-width: 768px) and (max-width: 1239px) { @content; } 49 | } 50 | 51 | @function rem($px) { 52 | @return ($px / 16px) * 1rem; 53 | } 54 | 55 | @mixin clearfix { 56 | &:before, 57 | &:after { 58 | content: ""; 59 | display: table; 60 | } 61 | &:after { 62 | clear: both; 63 | } 64 | & { 65 | *zoom: 1; 66 | } 67 | } 68 | 69 | @mixin default_link_styles { 70 | a:link, 71 | a:visited, 72 | a:hover { 73 | color: $orange; 74 | text-decoration: none; 75 | } 76 | 77 | @include desktop { 78 | a:hover { 79 | text-decoration: underline; 80 | } 81 | } 82 | } 83 | 84 | @mixin animated_border_hover_state { 85 | @include desktop { 86 | &:after { 87 | content: ""; 88 | display: block; 89 | width: 0; 90 | height: 1px; 91 | position: absolute; 92 | bottom: 0; 93 | left: 0; 94 | background-color: $orange; 95 | transition: width .250s ease-in-out; 96 | } 97 | 98 | &:hover:after { 99 | width: 100%; 100 | } 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /tests/io/test_resize.py: -------------------------------------------------------------------------------- 1 | # _____ ______ _____ 2 | # / ____/ /\ | ____ | __ \ 3 | # | | / \ | |__ | |__) | Caer - Modern Computer Vision 4 | # | | / /\ \ | __| | _ / Languages: Python, C, C++, Cuda 5 | # | |___ / ____ \ | |____ | | \ \ http://github.com/jasmcaus/caer 6 | # \_____\/_/ \_ \______ |_| \_\ 7 | 8 | # Licensed under the MIT License 9 | # SPDX-License-Identifier: MIT 10 | # Copyright (c) 2020-2025 The Caer Authors 11 | 12 | 13 | import caer 14 | import cv2 as cv 15 | import os 16 | 17 | here = os.path.dirname(os.path.dirname(__file__)) 18 | tens_path = os.path.join(here, 'data', 'green_fish.jpg') 19 | cv_tens = cv.imread(tens_path) 20 | caer_tens = caer.imread(tens_path) 21 | 22 | 23 | def test_target_sizes(): 24 | # Should return s 25 | tens_400_400 = caer.resize(cv_tens, target_size=(400,400)) 26 | tens_304_339 = caer.resize(cv_tens, target_size=(304,339)) 27 | tens_199_206 = caer.resize(cv_tens, target_size=(199,206)) 28 | 29 | # Should return s 30 | caer_tens_400_400 = caer.resize(caer_tens, target_size=(400,400)) 31 | caer_tens_304_339 = caer.resize(caer_tens, target_size=(304,339)) 32 | caer_tens_199_206 = caer.resize(caer_tens, target_size=(199,206)) 33 | 34 | assert tens_400_400.shape[:2] == (400,400) 35 | assert tens_304_339.shape[:2] == (339,304) 36 | assert tens_199_206.shape[:2] == (206,199) 37 | 38 | 39 | # Type Asserts 40 | ## Using isinstance() often mistakes a caer.Tensor as an np.ndarray 41 | assert 'caer.Tensor' in str(type(tens_400_400)) 42 | assert 'caer.Tensor' in str(type(tens_304_339)) 43 | assert 'caer.Tensor' in str(type(tens_199_206)) 44 | 45 | 46 | 47 | def test_preserve_aspect_ratio(): 48 | 49 | tens_400_400 = caer.resize(cv_tens, target_size=(400,400), preserve_aspect_ratio=True) 50 | tens_223_182 = caer.resize(cv_tens, target_size=(223,182), preserve_aspect_ratio=True) 51 | tens_93_35 = caer.resize(cv_tens, target_size=(93,35), preserve_aspect_ratio=True) 52 | 53 | assert tens_400_400.shape[:2] == (400,400) 54 | assert tens_223_182.shape[:2] == (182,223) 55 | assert tens_93_35.shape[:2] == (35,93) 56 | 57 | 58 | # Type Asserts 59 | ## Using isinstance() often mistakes a caer.Tensor as an np.ndarray 60 | assert 'caer.Tensor' in str(type(tens_400_400)) 61 | assert 'caer.Tensor' in str(type(tens_223_182)) 62 | assert 'caer.Tensor' in str(type(tens_93_35)) -------------------------------------------------------------------------------- /.github/workflows/docs.yml: -------------------------------------------------------------------------------- 1 | name: Build docs 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | release: 8 | branches: 9 | - master 10 | 11 | env: 12 | PYTHON_VERSION: 3.x 13 | 14 | jobs: 15 | docs: 16 | name: Building Docs 17 | runs-on: ubuntu-latest 18 | 19 | steps: 20 | - name: LGTM 21 | run: echo "LGTM" #TODO, uncomment 22 | 23 | # steps: 24 | # - uses: actions/checkout@v2 25 | # - uses: actions/setup-python@v2 26 | # with: 27 | # python-version: 3.7 28 | 29 | # - name: Install Reqs 30 | # run: | 31 | # python -m pip install --upgrade pip 32 | # python -m pip install -r tools/requirements/default.txt 33 | # python -m pip install -r tools/requirements/build-docs.txt 34 | # python -m pip install . 35 | 36 | # - name: Building Docs 37 | # run: | 38 | # cd docs 39 | # make clean 40 | # make html 41 | 42 | # - name: Upload Artifacts 43 | # uses: actions/upload-artifact@v2 44 | # with: 45 | # name: docs 46 | # path: docs/source/build/html 47 | 48 | 49 | # steps: 50 | # - name: LGTM 51 | # run: echo "LGTM" #TODO, uncomment 52 | 53 | # env: 54 | # GIT_TOKEN: ${{ secrets.GIT_TOKEN }} 55 | # GIT_NAME: ${{ secrets.GIT_NAME }} 56 | # GIT_EMAIL: ${{ secrets.GIT_EMAIL }} 57 | # steps: 58 | # - uses: actions/checkout@v2 59 | # - uses: actions/setup-python@v2 60 | # with: 61 | # python-version: ${{ env.PYTHON_VERSION }} 62 | 63 | # - name: Install Caer 64 | # run: | 65 | # python -m pip install --upgrade pip wheel 66 | # pip install .[asyncio] 67 | # if: success() 68 | 69 | # - name: Install build deps 70 | # run: | 71 | # pip install -U mkdocs mkdocs-material mkdocs-git-revision-date-localized-plugin mkdocs-minify-plugin mkdocstrings mkdocs-exclude 72 | # if: success() 73 | 74 | # - name: Configure 75 | # run: | 76 | # REMOTE="https://${GIT_TOKEN}@github.com/${GITHUB_REPOSITORY}" 77 | # git config --global user.name "${GIT_NAME}" 78 | # git config --global user.email "${GIT_EMAIL}" 79 | # git remote set-url origin ${REMOTE} 80 | # if: success() 81 | 82 | # - name: Deploy 83 | # run: | 84 | # mkdocs gh-deploy --force 85 | # mkdocs --version 86 | # if: success() -------------------------------------------------------------------------------- /tests/color/test_bgr.py: -------------------------------------------------------------------------------- 1 | # _____ ______ _____ 2 | # / ____/ /\ | ____ | __ \ 3 | # | | / \ | |__ | |__) | Caer - Modern Computer Vision 4 | # | | / /\ \ | __| | _ / Languages: Python, C, C++, Cuda 5 | # | |___ / ____ \ | |____ | | \ \ http://github.com/jasmcaus/caer 6 | # \_____\/_/ \_ \______ |_| \_\ 7 | 8 | # Licensed under the MIT License 9 | # SPDX-License-Identifier: MIT 10 | # Copyright (c) 2020-2025 The Caer Authors 11 | 12 | import caer 13 | import cv2 as cv 14 | import os 15 | 16 | here = os.path.dirname(os.path.dirname(__file__)) 17 | tens_path = os.path.join(here, 'data', 'green_fish.jpg') 18 | 19 | 20 | def test_bgr2rgb(): 21 | cv_bgr = cv.imread(tens_path) 22 | cv_bgr = caer.to_tensor(cv_bgr, cspace="bgr") 23 | rgb = caer.bgr2rgb(cv_bgr) 24 | 25 | assert len(rgb.shape) == 3 26 | assert isinstance(rgb, caer.Tensor) 27 | assert rgb.is_rgb() 28 | 29 | 30 | def test_bgr2gray(): 31 | cv_bgr = cv.imread(tens_path) 32 | cv_bgr = caer.to_tensor(cv_bgr, cspace="bgr") 33 | gray = caer.bgr2gray(cv_bgr) 34 | 35 | assert len(gray.shape) == 2 36 | assert isinstance(gray, caer.Tensor) 37 | assert gray.is_gray() 38 | 39 | 40 | def test_bgr2hsv(): 41 | cv_bgr = cv.imread(tens_path) 42 | cv_bgr = caer.to_tensor(cv_bgr, cspace="bgr") 43 | hsv = caer.bgr2hsv(cv_bgr) 44 | 45 | assert len(hsv.shape) == 3 46 | assert isinstance(hsv, caer.Tensor) 47 | assert hsv.is_hsv() 48 | 49 | 50 | def test_bgr2hls(): 51 | cv_bgr = cv.imread(tens_path) 52 | cv_bgr = caer.to_tensor(cv_bgr, cspace="bgr") 53 | hls = caer.bgr2hls(cv_bgr) 54 | 55 | assert len(hls.shape) == 3 56 | assert isinstance(hls, caer.Tensor) 57 | assert hls.is_hls() 58 | 59 | 60 | def test_bgr2lab(): 61 | cv_bgr = cv.imread(tens_path) 62 | cv_bgr = caer.to_tensor(cv_bgr, cspace="bgr") 63 | lab = caer.bgr2lab(cv_bgr) 64 | 65 | assert len(lab.shape) == 3 66 | assert isinstance(lab, caer.Tensor) 67 | assert lab.is_lab() 68 | 69 | 70 | def test_bgr2yuv(): 71 | cv_bgr = cv.imread(tens_path) 72 | cv_bgr = caer.to_tensor(cv_bgr, cspace="bgr") 73 | yuv = caer.bgr2yuv(cv_bgr) 74 | 75 | assert len(yuv.shape) == 3 76 | assert isinstance(yuv, caer.Tensor) 77 | assert yuv.is_yuv() 78 | 79 | 80 | def test_bgr2luv(): 81 | cv_bgr = cv.imread(tens_path) 82 | cv_bgr = caer.to_tensor(cv_bgr, cspace="bgr") 83 | luv = caer.bgr2luv(cv_bgr) 84 | 85 | assert len(luv.shape) == 3 86 | assert isinstance(luv, caer.Tensor) 87 | assert luv.is_luv() 88 | -------------------------------------------------------------------------------- /examples/GUI/README.md: -------------------------------------------------------------------------------- 1 | # Caer GUI 2 | A simple Tkinter GUI app example, designed to showcase some of Caer's features for manipulating images. 3 | This should only be used as a base to create a new GUI. 4 | 5 | App Requirements: 6 | * Python3 7 | * Caer 8 | * Matplotlib 9 | 10 | Running it is as simple as 11 | ```python 12 | python caer_gui.py 13 | ``` 14 | 15 | Note: Tested as working in Windows 10 with python v3.6.8 and Kubuntu Linux with python v3.6.8. 16 | 17 | - You can select one of 14 built-in images to display (startup has `caer.data.island` selected as default) 18 | - You can also select one of your own images (use the `Open File >>` option to browse locally or enter a URL to the image) 19 | - Either of PNG / JPG / BMP / TIFF file types is available and was tested as working while some others might work as well 20 | - Selecting any of the images, at any point in time, will always start with a fresh original image and reset controls 21 | - The exception to the above is the 'Open File >>' option which will allow you to browse and select a different image 22 | - 'Reload Image' button will reload the original version of currently selected image, including the image file loaded by the user 23 | 24 | All function controls are set to manipulate the currently displayed image within the adjust_ghsps() function. 25 | 26 | - Edges and Emboss effects are mutually exclusive (you can only have one applied at the time) 27 | - Only one Histogram window can be displayed at any time 28 | - The 'Rotation' button is currently set to keep on rotating the image with every tap (while preserving the whole image and only showing its rotated version) 29 | 30 | # Caer GUI Video 31 | A rather simple Tkinter GUI app example, designed to showcase some of Caer's features for playing videos. 32 | This should only be used as a base to create a new GUI. 33 | 34 | App Requirements: 35 | * Python3 36 | * Caer 37 | 38 | Running it is as simple as 39 | ```python 40 | python caer_gui_video.py 41 | ``` 42 | 43 | Note: Tested as working in Windows 10 with python v3.6.8. 44 | 45 | - You can select to display video from one of your cameras (0 is usually a default for laptop's built-in camera) 46 | - You can also select to play one of your own video files (use the `Open File >>` option to browse locally or enter a URL to the file), either of AVI / MKV / MP4 / MPG / WMV file types is available and was tested as working while some others might work as well 47 | - You can loop the playback of the video file 48 | - You can take a screenshot of the current video frame (PNG file will be saved in the app's folder) 49 | - There is no audio playback 50 | 51 | # Useful Resources 52 | Check the other GUI examples [here](https://github.com/GitHubDragonFly/CAER_Video_GUI). 53 | -------------------------------------------------------------------------------- /docs/source/api/data.rst: -------------------------------------------------------------------------------- 1 | .. role:: hidden 2 | :class: hidden-section 3 | 4 | caer.data 5 | =================== 6 | .. currentmodule:: caer.data 7 | 8 | 9 | Standard Test Images 10 | ---------------------------------- 11 | 12 | :hidden:`audio_mixer` 13 | ~~~~~~~~~~~~~~~~~~~~~~ 14 | .. autofunction:: audio_mixer 15 | 16 | 17 | :hidden:`bear` 18 | ~~~~~~~~~~~~~~~~~~ 19 | .. autofunction:: bear 20 | 21 | 22 | :hidden:`beverages` 23 | ~~~~~~~~~~~~~~~~~~~~~~ 24 | .. autofunction:: beverages 25 | 26 | 27 | :hidden:`black_cat` 28 | ~~~~~~~~~~~~~~~~~~~~~~ 29 | .. autofunction:: black_cat 30 | 31 | 32 | :hidden:`blue_tang` 33 | ~~~~~~~~~~~~~~~~~~~~~~ 34 | .. autofunction:: blue_tang 35 | 36 | 37 | :hidden:`camera` 38 | ~~~~~~~~~~~~~~~~~~ 39 | .. autofunction:: camera 40 | 41 | 42 | :hidden:`controller` 43 | ~~~~~~~~~~~~~~~~~~~~~~ 44 | .. autofunction:: controller 45 | 46 | 47 | :hidden:`drone` 48 | ~~~~~~~~~~~~~~~~~~ 49 | .. autofunction:: drone 50 | 51 | 52 | :hidden:`dusk` 53 | ~~~~~~~~~~~~~~~~~~ 54 | .. autofunction:: dusk 55 | 56 | 57 | :hidden:`fighter_fish` 58 | ~~~~~~~~~~~~~~~~~~~~~~~~ 59 | .. autofunction:: fighter_fish 60 | 61 | 62 | :hidden:`gold_fish` 63 | ~~~~~~~~~~~~~~~~~~~~~~ 64 | .. autofunction:: gold_fish 65 | 66 | 67 | :hidden:`green_controller` 68 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 69 | .. autofunction:: green_controller 70 | 71 | 72 | :hidden:`green_fish` 73 | ~~~~~~~~~~~~~~~~~~~~~~ 74 | .. autofunction:: green_fish 75 | 76 | 77 | :hidden:`guitar` 78 | ~~~~~~~~~~~~~~~~~~ 79 | .. autofunction:: guitar 80 | 81 | 82 | :hidden:`island` 83 | ~~~~~~~~~~~~~~~~~~ 84 | .. autofunction:: island 85 | 86 | 87 | :hidden:`jellyfish` 88 | ~~~~~~~~~~~~~~~~~~~~~~ 89 | .. autofunction:: jellyfish 90 | 91 | 92 | :hidden:`laptop` 93 | ~~~~~~~~~~~~~~~~~~ 94 | .. autofunction:: laptop 95 | 96 | 97 | :hidden:`mountain` 98 | ~~~~~~~~~~~~~~~~~~~~ 99 | .. autofunction:: mountain 100 | 101 | 102 | :hidden:`night` 103 | ~~~~~~~~~~~~~~~~~~ 104 | .. autofunction:: night 105 | 106 | 107 | :hidden:`puppies` 108 | ~~~~~~~~~~~~~~~~~~ 109 | .. autofunction:: puppies 110 | 111 | 112 | :hidden:`puppy` 113 | ~~~~~~~~~~~~~~~~~~ 114 | .. autofunction:: puppy 115 | 116 | 117 | :hidden:`red_fish` 118 | ~~~~~~~~~~~~~~~~~~ 119 | .. autofunction:: red_fish 120 | 121 | 122 | :hidden:`phone` 123 | ~~~~~~~~~~~~~~~~~~ 124 | .. autofunction:: phone 125 | 126 | 127 | :hidden:`sea_turtle` 128 | ~~~~~~~~~~~~~~~~~~~~~ 129 | .. autofunction:: sea_turtle 130 | 131 | 132 | :hidden:`snow` 133 | ~~~~~~~~~~~~~~~ 134 | .. autofunction:: snow 135 | 136 | 137 | :hidden:`sunrise` 138 | ~~~~~~~~~~~~~~~~~~ 139 | .. autofunction:: sunrise 140 | 141 | 142 | :hidden:`tent` 143 | ~~~~~~~~~~~~~~~ 144 | .. autofunction:: tent -------------------------------------------------------------------------------- /docs/how_to/git_how_to.md: -------------------------------------------------------------------------------- 1 | # Git Workflow Howtos 2 | 3 | ## How to submit pull request 4 | 5 | Before submit, please rebase your code on the most recent version of `master`, you can do it by 6 | 7 | ```shell 8 | git remote add upstream https://github.com/jasmcaus/caer 9 | git fetch upstream 10 | git rebase upstream/master 11 | ``` 12 | 13 | 14 | If you have multiple small commits, it might be good to merge them together(use git rebase then squash) into more meaningful groups. 15 | 16 | Send the pull request! 17 | - Fix the problems reported by automatic checks 18 | - If you are contributing a new module or new function, add a test. 19 | 20 | 21 | ## How to resolve conflict with master 22 | 23 | 24 | First rebase to most recent master 25 | 26 | ```shell 27 | # The first two steps can be skipped after you do it once. 28 | git remote add upstream https://github.com/jasmcaus/caer 29 | git fetch upstream 30 | git rebase upstream/master 31 | ``` 32 | 33 | Git may show some conflicts it cannot merge, say `conflicted.py`. 34 | 35 | - Manually modify the file to resolve the conflict. 36 | - After you resolved the conflict, mark it as resolved by 37 | 38 | ```shell 39 | git add conflicted.py 40 | 41 | # Then you can continue rebase by 42 | git rebase --continue 43 | 44 | # Finally push to your fork, you may need to force push here. 45 | git push --force 46 | ``` 47 | 48 | 49 | ## How to combine multiple commits into one 50 | 51 | Sometimes we want to combine multiple commits, especially when later commits are only fixes to previous ones, to create a PR with set of meaningful commits. You can do it by following steps. - Before doing so, 52 | configure the default editor of git if you haven't done so before. 53 | 54 | ```shell 55 | git config core.editor the-editor-you-like 56 | 57 | # Assume we want to merge last 3 commits, type the following commands 58 | git rebase -i HEAD~3 59 | 60 | # It will pop up an text editor. Set the first commit as `pick`, and change later ones to `squash`. 61 | # After you saved the file, it will pop up another text editor to ask you modify the combined commit message. 62 | # Push the changes to your fork, you need to force push. 63 | git push --force 64 | ``` 65 | 66 | ## Reset to the most recent master 67 | 68 | You can always use git reset to reset your version to the most recent master. Note that all your **\*local changes will get lost**\*. So only do it when you do not have local changes or when your pull request just 69 | get merged. 70 | 71 | ```shell 72 | git reset --hard [hash tag of master] 73 | git push --force 74 | ``` 75 | 76 | 77 | ## Consequence of force push? 78 | 79 | The previous two tips requires force push, this is because we altered the path of the commits. It is fine to force push to your own fork, as long as the commits changed are only yours. -------------------------------------------------------------------------------- /docs/source/api/color.rst: -------------------------------------------------------------------------------- 1 | .. role:: hidden 2 | :class: hidden-section 3 | 4 | caer.color 5 | =================== 6 | .. currentmodule:: caer.color 7 | 8 | 9 | **Using the `to_` syntax** 10 | ---------------------------------- 11 | 12 | :hidden:`to_rgb` 13 | ~~~~~~~~~~~~~~~~~~~~~ 14 | .. autofunction:: to_rgb 15 | 16 | 17 | :hidden:`to_bgr` 18 | ~~~~~~~~~~~~~~~~~~~~~ 19 | .. autofunction:: to_bgr 20 | 21 | :hidden:`to_gray` 22 | ~~~~~~~~~~~~~~~~~~~~~ 23 | .. autofunction:: to_gray 24 | 25 | :hidden:`to_hsv` 26 | ~~~~~~~~~~~~~~~~~~~~~ 27 | .. autofunction:: to_hsv 28 | 29 | :hidden:`to_hls` 30 | ~~~~~~~~~~~~~~~~~~~~~ 31 | .. autofunction:: to_hls 32 | 33 | :hidden:`to_lab` 34 | ~~~~~~~~~~~~~~~~~~~~~ 35 | .. autofunction:: to_lab 36 | 37 | 38 | 39 | **From the RGB colorspace** 40 | ---------------------------------- 41 | 42 | :hidden:`rgb2bgr` 43 | ~~~~~~~~~~~~~~~~~~~~~ 44 | .. autofunction:: rgb2bgr 45 | 46 | 47 | :hidden:`rgb2gray` 48 | ~~~~~~~~~~~~~~~~~~~~~~~ 49 | .. autofunction:: rgb2gray 50 | 51 | 52 | :hidden:`rgb2hsv` 53 | ~~~~~~~~~~~~~~~~~~~~~~~ 54 | .. autofunction:: rgb2hsv 55 | 56 | 57 | :hidden:`rgb2lab` 58 | ~~~~~~~~~~~~~~~~~~~~~~~ 59 | .. autofunction:: rgb2bgr 60 | 61 | 62 | ----------------------------------------- 63 | 64 | 65 | **From the BGR colorspace** 66 | ---------------------------------- 67 | 68 | :hidden:`bgr2rgb` 69 | ~~~~~~~~~~~~~~~~~~~~~~~ 70 | .. autofunction:: bgr2rgb 71 | 72 | 73 | :hidden:`bgr2gray` 74 | ~~~~~~~~~~~~~~~~~~~~~~~ 75 | .. autofunction:: bgr2gray 76 | 77 | 78 | :hidden:`bgr2hsv` 79 | ~~~~~~~~~~~~~~~~~~~~~~~ 80 | .. autofunction:: bgr2hsv 81 | 82 | 83 | :hidden:`bgr2lab` 84 | ~~~~~~~~~~~~~~~~~~~~~~~ 85 | .. autofunction:: bgr2lab 86 | 87 | ----------------------------------------- 88 | 89 | **From the HSV colorspace** 90 | ---------------------------------- 91 | :hidden:`hsv2rgb` 92 | ~~~~~~~~~~~~~~~~~~~~~~~ 93 | 94 | .. autofunction:: hsv2rgb 95 | 96 | :hidden:`hsv2bgr` 97 | ~~~~~~~~~~~~~~~~~~~~~~~ 98 | .. autofunction:: hsv2bgr 99 | 100 | :hidden:`hsv2gray` 101 | ~~~~~~~~~~~~~~~~~~~~~~~ 102 | .. autofunction:: hsv2gray 103 | 104 | 105 | :hidden:`hsv2lab` 106 | ~~~~~~~~~~~~~~~~~~~~~~~ 107 | .. autofunction:: hsv2lab 108 | 109 | ----------------------------------------- 110 | 111 | **From the LAB colorspace** 112 | ---------------------------------- 113 | 114 | :hidden:`lab2rgb` 115 | ~~~~~~~~~~~~~~~~~~~~~~~ 116 | .. autofunction:: lab2rgb 117 | 118 | 119 | :hidden:`lab2bgr` 120 | ~~~~~~~~~~~~~~~~~~~~~~~ 121 | .. autofunction:: lab2bgr 122 | 123 | 124 | :hidden:`lab2gray` 125 | ~~~~~~~~~~~~~~~~~~~~~~~ 126 | .. autofunction:: lab2gray 127 | 128 | 129 | :hidden:`lab2hsv` 130 | ~~~~~~~~~~~~~~~~~~~~~~~ 131 | .. autofunction:: lab2hsv 132 | -------------------------------------------------------------------------------- /tests/color/test_hls.py: -------------------------------------------------------------------------------- 1 | # _____ ______ _____ 2 | # / ____/ /\ | ____ | __ \ 3 | # | | / \ | |__ | |__) | Caer - Modern Computer Vision 4 | # | | / /\ \ | __| | _ / Languages: Python, C, C++, Cuda 5 | # | |___ / ____ \ | |____ | | \ \ http://github.com/jasmcaus/caer 6 | # \_____\/_/ \_ \______ |_| \_\ 7 | 8 | # Licensed under the MIT License 9 | # SPDX-License-Identifier: MIT 10 | # Copyright (c) 2020-2025 The Caer Authors 11 | 12 | import caer 13 | import cv2 as cv 14 | import os 15 | 16 | here = os.path.dirname(os.path.dirname(__file__)) 17 | tens_path = os.path.join(here, 'data', 'green_fish.jpg') 18 | # BGR 19 | cv_bgr = cv.imread(tens_path) 20 | 21 | 22 | def test_hls2rgb(): 23 | cv_hls = cv.cvtColor(cv_bgr, cv.COLOR_BGR2HLS) 24 | cv_hls = caer.to_tensor(cv_hls, cspace="hls") 25 | 26 | rgb = caer.hls2rgb(cv_hls) 27 | 28 | assert len(rgb.shape) == 3 29 | assert isinstance(rgb, caer.Tensor) 30 | assert rgb.is_rgb() 31 | 32 | 33 | def test_hls2bgr(): 34 | cv_hls = cv.cvtColor(cv_bgr, cv.COLOR_BGR2HLS) 35 | cv_hls = caer.to_tensor(cv_hls, cspace="hls") 36 | 37 | bgr = caer.hls2bgr(cv_hls) 38 | 39 | assert len(bgr.shape) == 3 40 | assert isinstance(bgr, caer.Tensor) 41 | assert bgr.is_bgr() 42 | 43 | 44 | def test_hls2gray(): 45 | cv_hls = cv.cvtColor(cv_bgr, cv.COLOR_BGR2HLS) 46 | cv_hls = caer.to_tensor(cv_hls, cspace="hls") 47 | 48 | gray = caer.hls2gray(cv_hls) 49 | 50 | assert len(gray.shape) == 2 or (len(gray.shape) == 3 and gray.shape[-1] == 1) 51 | assert isinstance(gray, caer.Tensor) 52 | assert gray.is_gray() 53 | 54 | 55 | def test_hls2hsv(): 56 | cv_hls = cv.cvtColor(cv_bgr, cv.COLOR_BGR2HLS) 57 | cv_hls = caer.to_tensor(cv_hls, cspace="hls") 58 | 59 | hsv = caer.hls2hsv(cv_hls) 60 | 61 | assert len(hsv.shape) == 3 62 | assert isinstance(hsv, caer.Tensor) 63 | assert hsv.is_hsv() 64 | 65 | 66 | def test_hls2lab(): 67 | cv_hls = cv.cvtColor(cv_bgr, cv.COLOR_BGR2HLS) 68 | cv_hls = caer.to_tensor(cv_hls, cspace="hls") 69 | 70 | lab = caer.hls2lab(cv_hls) 71 | 72 | assert len(lab.shape) == 3 73 | assert isinstance(lab, caer.Tensor) 74 | assert lab.is_lab() 75 | 76 | 77 | def test_hls2yuv(): 78 | cv_hls = cv.cvtColor(cv_bgr, cv.COLOR_BGR2RGB) 79 | cv_hls = caer.to_tensor(cv_hls, cspace="rgb") 80 | yuv = caer.hls2yuv(cv_hls) 81 | 82 | assert len(yuv.shape) == 3 83 | assert isinstance(yuv, caer.Tensor) 84 | assert yuv.is_yuv() 85 | 86 | 87 | def test_hls2luv(): 88 | cv_hls = cv.cvtColor(cv_bgr, cv.COLOR_BGR2RGB) 89 | cv_hls = caer.to_tensor(cv_hls, cspace="rgb") 90 | luv = caer.hls2luv(cv_hls) 91 | 92 | assert len(luv.shape) == 3 93 | assert isinstance(luv, caer.Tensor) 94 | assert luv.is_luv() 95 | -------------------------------------------------------------------------------- /tests/color/test_hsv.py: -------------------------------------------------------------------------------- 1 | # _____ ______ _____ 2 | # / ____/ /\ | ____ | __ \ 3 | # | | / \ | |__ | |__) | Caer - Modern Computer Vision 4 | # | | / /\ \ | __| | _ / Languages: Python, C, C++, Cuda 5 | # | |___ / ____ \ | |____ | | \ \ http://github.com/jasmcaus/caer 6 | # \_____\/_/ \_ \______ |_| \_\ 7 | 8 | # Licensed under the MIT License 9 | # SPDX-License-Identifier: MIT 10 | # Copyright (c) 2020-2025 The Caer Authors 11 | 12 | import caer 13 | import cv2 as cv 14 | import os 15 | 16 | here = os.path.dirname(os.path.dirname(__file__)) 17 | tens_path = os.path.join(here, 'data', 'green_fish.jpg') 18 | # BGR 19 | cv_bgr = cv.imread(tens_path) 20 | 21 | 22 | def test_hsv2rgb(): 23 | cv_hsv = cv.cvtColor(cv_bgr, cv.COLOR_BGR2HSV) 24 | cv_hsv = caer.to_tensor(cv_hsv, cspace="hsv") 25 | 26 | rgb = caer.hsv2rgb(cv_hsv) 27 | 28 | assert len(rgb.shape) == 3 29 | assert isinstance(rgb, caer.Tensor) 30 | assert rgb.is_rgb() 31 | 32 | 33 | def test_hsv2bgr(): 34 | cv_hsv = cv.cvtColor(cv_bgr, cv.COLOR_BGR2HSV) 35 | cv_hsv = caer.to_tensor(cv_hsv, cspace="hsv") 36 | 37 | bgr = caer.hsv2bgr(cv_hsv) 38 | 39 | assert len(bgr.shape) == 3 40 | assert isinstance(bgr, caer.Tensor) 41 | assert bgr.is_bgr() 42 | 43 | 44 | def test_hsv2gray(): 45 | cv_hsv = cv.cvtColor(cv_bgr, cv.COLOR_BGR2HSV) 46 | cv_hsv = caer.to_tensor(cv_hsv, cspace="hsv") 47 | 48 | gray = caer.hsv2gray(cv_hsv) 49 | 50 | assert len(gray.shape) == 2 or (len(gray.shape) == 3 and gray.shape[-1] == 1) 51 | assert isinstance(gray, caer.Tensor) 52 | assert gray.is_gray() 53 | 54 | 55 | def test_hsv2hls(): 56 | cv_hsv = cv.cvtColor(cv_bgr, cv.COLOR_BGR2HSV) 57 | cv_hsv = caer.to_tensor(cv_hsv, cspace="hsv") 58 | 59 | hls = caer.hsv2hls(cv_hsv) 60 | 61 | assert len(hls.shape) == 3 62 | assert isinstance(hls, caer.Tensor) 63 | assert hls.is_hls() 64 | 65 | 66 | def test_hsv2lab(): 67 | cv_hsv = cv.cvtColor(cv_bgr, cv.COLOR_BGR2HSV) 68 | cv_hsv = caer.to_tensor(cv_hsv, cspace="hsv") 69 | 70 | lab = caer.hsv2lab(cv_hsv) 71 | 72 | assert len(lab.shape) == 3 73 | assert isinstance(lab, caer.Tensor) 74 | assert lab.is_lab() 75 | 76 | 77 | def test_hsv2yuv(): 78 | cv_hsv = cv.cvtColor(cv_bgr, cv.COLOR_BGR2RGB) 79 | cv_hsv = caer.to_tensor(cv_hsv, cspace="rgb") 80 | yuv = caer.hsv2yuv(cv_hsv) 81 | 82 | assert len(yuv.shape) == 3 83 | assert isinstance(yuv, caer.Tensor) 84 | assert yuv.is_yuv() 85 | 86 | 87 | def test_hsv2luv(): 88 | cv_hsv = cv.cvtColor(cv_bgr, cv.COLOR_BGR2RGB) 89 | cv_hsv = caer.to_tensor(cv_hsv, cspace="rgb") 90 | luv = caer.hsv2luv(cv_hsv) 91 | 92 | assert len(luv.shape) == 3 93 | assert isinstance(luv, caer.Tensor) 94 | assert luv.is_luv() 95 | -------------------------------------------------------------------------------- /tests/color/test_lab.py: -------------------------------------------------------------------------------- 1 | # _____ ______ _____ 2 | # / ____/ /\ | ____ | __ \ 3 | # | | / \ | |__ | |__) | Caer - Modern Computer Vision 4 | # | | / /\ \ | __| | _ / Languages: Python, C, C++, Cuda 5 | # | |___ / ____ \ | |____ | | \ \ http://github.com/jasmcaus/caer 6 | # \_____\/_/ \_ \______ |_| \_\ 7 | 8 | # Licensed under the MIT License 9 | # SPDX-License-Identifier: MIT 10 | # Copyright (c) 2020-2025 The Caer Authors 11 | 12 | import caer 13 | import cv2 as cv 14 | import os 15 | 16 | here = os.path.dirname(os.path.dirname(__file__)) 17 | tens_path = os.path.join(here, 'data', 'green_fish.jpg') 18 | # BGR 19 | cv_bgr = cv.imread(tens_path) 20 | 21 | 22 | def test_lab2rgb(): 23 | cv_lab = cv.cvtColor(cv_bgr, cv.COLOR_BGR2LAB) 24 | cv_lab = caer.to_tensor(cv_lab, cspace="lab") 25 | 26 | rgb = caer.lab2rgb(cv_lab) 27 | 28 | assert len(rgb.shape) == 3 29 | assert isinstance(rgb, caer.Tensor) 30 | assert rgb.is_rgb() 31 | 32 | 33 | def test_lab2bgr(): 34 | cv_lab = cv.cvtColor(cv_bgr, cv.COLOR_BGR2LAB) 35 | cv_lab = caer.to_tensor(cv_lab, cspace="lab") 36 | 37 | bgr = caer.lab2bgr(cv_lab) 38 | 39 | assert len(bgr.shape) == 3 40 | assert isinstance(bgr, caer.Tensor) 41 | assert bgr.is_bgr() 42 | 43 | 44 | def test_lab2gray(): 45 | cv_lab = cv.cvtColor(cv_bgr, cv.COLOR_BGR2LAB) 46 | cv_lab = caer.to_tensor(cv_lab, cspace="lab") 47 | 48 | gray = caer.lab2gray(cv_lab) 49 | 50 | assert len(gray.shape) == 2 or (len(gray.shape) == 3 and gray.shape[-1] == 1) 51 | assert isinstance(gray, caer.Tensor) 52 | assert gray.is_gray() 53 | 54 | 55 | def test_lab2hsv(): 56 | cv_lab = cv.cvtColor(cv_bgr, cv.COLOR_BGR2LAB) 57 | cv_lab = caer.to_tensor(cv_lab, cspace="lab") 58 | 59 | hsv = caer.lab2hsv(cv_lab) 60 | 61 | assert len(hsv.shape) == 3 62 | assert isinstance(hsv, caer.Tensor) 63 | assert hsv.is_hsv() 64 | 65 | 66 | def test_lab2hls(): 67 | cv_lab = cv.cvtColor(cv_bgr, cv.COLOR_BGR2LAB) 68 | cv_lab = caer.to_tensor(cv_lab, cspace="lab") 69 | 70 | hls = caer.lab2hls(cv_lab) 71 | 72 | assert len(hls.shape) == 3 73 | assert isinstance(hls, caer.Tensor) 74 | assert hls.is_hls() 75 | 76 | 77 | def test_lab2yuv(): 78 | cv_lab = cv.cvtColor(cv_bgr, cv.COLOR_BGR2RGB) 79 | cv_lab = caer.to_tensor(cv_lab, cspace="rgb") 80 | yuv = caer.lab2yuv(cv_lab) 81 | 82 | assert len(yuv.shape) == 3 83 | assert isinstance(yuv, caer.Tensor) 84 | assert yuv.is_yuv() 85 | 86 | 87 | def test_lab2luv(): 88 | cv_lab = cv.cvtColor(cv_bgr, cv.COLOR_BGR2RGB) 89 | cv_lab = caer.to_tensor(cv_lab, cspace="rgb") 90 | luv = caer.lab2luv(cv_lab) 91 | 92 | assert len(luv.shape) == 3 93 | assert isinstance(luv, caer.Tensor) 94 | assert luv.is_luv() 95 | -------------------------------------------------------------------------------- /tests/color/test_luv.py: -------------------------------------------------------------------------------- 1 | # _____ ______ _____ 2 | # / ____/ /\ | ____ | __ \ 3 | # | | / \ | |__ | |__) | Caer - Modern Computer Vision 4 | # | | / /\ \ | __| | _ / Languages: Python, C, C++, Cuda 5 | # | |___ / ____ \ | |____ | | \ \ http://github.com/jasmcaus/caer 6 | # \_____\/_/ \_ \______ |_| \_\ 7 | 8 | # Licensed under the MIT License 9 | # SPDX-License-Identifier: MIT 10 | # Copyright (c) 2020-2025 The Caer Authors 11 | 12 | import caer 13 | import cv2 as cv 14 | import os 15 | 16 | here = os.path.dirname(os.path.dirname(__file__)) 17 | tens_path = os.path.join(here, 'data', 'green_fish.jpg') 18 | # BGR 19 | cv_bgr = cv.imread(tens_path) 20 | 21 | 22 | def test_luv2rgb(): 23 | cv_luv = cv.cvtColor(cv_bgr, cv.COLOR_BGR2LUV) 24 | cv_luv = caer.to_tensor(cv_luv, cspace="luv") 25 | 26 | rgb = caer.luv2rgb(cv_luv) 27 | 28 | assert len(rgb.shape) == 3 29 | assert isinstance(rgb, caer.Tensor) 30 | assert rgb.is_rgb() 31 | 32 | 33 | def test_luv2bgr(): 34 | cv_luv = cv.cvtColor(cv_bgr, cv.COLOR_BGR2LUV) 35 | cv_luv = caer.to_tensor(cv_luv, cspace="luv") 36 | 37 | bgr = caer.luv2bgr(cv_luv) 38 | 39 | assert len(bgr.shape) == 3 40 | assert isinstance(bgr, caer.Tensor) 41 | assert bgr.is_bgr() 42 | 43 | 44 | def test_luv2gray(): 45 | cv_luv = cv.cvtColor(cv_bgr, cv.COLOR_BGR2LUV) 46 | cv_luv = caer.to_tensor(cv_luv, cspace="luv") 47 | 48 | gray = caer.luv2gray(cv_luv) 49 | 50 | assert len(gray.shape) == 2 or (len(gray.shape) == 3 and gray.shape[-1] == 1) 51 | assert isinstance(gray, caer.Tensor) 52 | assert gray.is_gray() 53 | 54 | 55 | def test_luv2hsv(): 56 | cv_luv = cv.cvtColor(cv_bgr, cv.COLOR_BGR2LUV) 57 | cv_luv = caer.to_tensor(cv_luv, cspace="luv") 58 | 59 | hsv = caer.luv2hsv(cv_luv) 60 | 61 | assert len(hsv.shape) == 3 62 | assert isinstance(hsv, caer.Tensor) 63 | assert hsv.is_hsv() 64 | 65 | 66 | def test_luv2hls(): 67 | cv_luv = cv.cvtColor(cv_bgr, cv.COLOR_BGR2LUV) 68 | cv_luv = caer.to_tensor(cv_luv, cspace="luv") 69 | 70 | hls = caer.luv2hls(cv_luv) 71 | 72 | assert len(hls.shape) == 3 73 | assert isinstance(hls, caer.Tensor) 74 | assert hls.is_hls() 75 | 76 | 77 | def test_luv2lab(): 78 | cv_luv = cv.cvtColor(cv_bgr, cv.COLOR_BGR2LUV) 79 | cv_luv = caer.to_tensor(cv_luv, cspace="luv") 80 | 81 | lab = caer.luv2lab(cv_luv) 82 | 83 | assert len(lab.shape) == 3 84 | assert isinstance(lab, caer.Tensor) 85 | assert lab.is_lab() 86 | 87 | 88 | def test_luv2yuv(): 89 | cv_luv = cv.cvtColor(cv_bgr, cv.COLOR_BGR2LUV) 90 | cv_luv = caer.to_tensor(cv_luv, cspace="luv") 91 | 92 | yuv = caer.luv2yuv(cv_luv) 93 | 94 | assert len(yuv.shape) == 3 95 | assert isinstance(yuv, caer.Tensor) 96 | assert yuv.is_yuv() 97 | -------------------------------------------------------------------------------- /tests/color/test_yuv.py: -------------------------------------------------------------------------------- 1 | # _____ ______ _____ 2 | # / ____/ /\ | ____ | __ \ 3 | # | | / \ | |__ | |__) | Caer - Modern Computer Vision 4 | # | | / /\ \ | __| | _ / Languages: Python, C, C++, Cuda 5 | # | |___ / ____ \ | |____ | | \ \ http://github.com/jasmcaus/caer 6 | # \_____\/_/ \_ \______ |_| \_\ 7 | 8 | # Licensed under the MIT License 9 | # SPDX-License-Identifier: MIT 10 | # Copyright (c) 2020-2025 The Caer Authors 11 | 12 | import caer 13 | import cv2 as cv 14 | import os 15 | 16 | here = os.path.dirname(os.path.dirname(__file__)) 17 | tens_path = os.path.join(here, 'data', 'green_fish.jpg') 18 | # BGR 19 | cv_bgr = cv.imread(tens_path) 20 | 21 | 22 | def test_yuv2rgb(): 23 | cv_yuv = cv.cvtColor(cv_bgr, cv.COLOR_BGR2YUV) 24 | cv_yuv = caer.to_tensor(cv_yuv, cspace="yuv") 25 | 26 | rgb = caer.yuv2rgb(cv_yuv) 27 | 28 | assert len(rgb.shape) == 3 29 | assert isinstance(rgb, caer.Tensor) 30 | assert rgb.is_rgb() 31 | 32 | 33 | def test_yuv2bgr(): 34 | cv_yuv = cv.cvtColor(cv_bgr, cv.COLOR_BGR2YUV) 35 | cv_yuv = caer.to_tensor(cv_yuv, cspace="yuv") 36 | 37 | bgr = caer.yuv2bgr(cv_yuv) 38 | 39 | assert len(bgr.shape) == 3 40 | assert isinstance(bgr, caer.Tensor) 41 | assert bgr.is_bgr() 42 | 43 | 44 | def test_yuv2gray(): 45 | cv_yuv = cv.cvtColor(cv_bgr, cv.COLOR_BGR2YUV) 46 | cv_yuv = caer.to_tensor(cv_yuv, cspace="yuv") 47 | 48 | gray = caer.yuv2gray(cv_yuv) 49 | 50 | assert len(gray.shape) == 2 or (len(gray.shape) == 3 and gray.shape[-1] == 1) 51 | assert isinstance(gray, caer.Tensor) 52 | assert gray.is_gray() 53 | 54 | 55 | def test_yuv2hsv(): 56 | cv_yuv = cv.cvtColor(cv_bgr, cv.COLOR_BGR2YUV) 57 | cv_yuv = caer.to_tensor(cv_yuv, cspace="yuv") 58 | 59 | hsv = caer.yuv2hsv(cv_yuv) 60 | 61 | assert len(hsv.shape) == 3 62 | assert isinstance(hsv, caer.Tensor) 63 | assert hsv.is_hsv() 64 | 65 | 66 | def test_yuv2hls(): 67 | cv_yuv = cv.cvtColor(cv_bgr, cv.COLOR_BGR2YUV) 68 | cv_yuv = caer.to_tensor(cv_yuv, cspace="yuv") 69 | 70 | hls = caer.yuv2hls(cv_yuv) 71 | 72 | assert len(hls.shape) == 3 73 | assert isinstance(hls, caer.Tensor) 74 | assert hls.is_hls() 75 | 76 | 77 | def test_yuv2lab(): 78 | cv_yuv = cv.cvtColor(cv_bgr, cv.COLOR_BGR2YUV) 79 | cv_yuv = caer.to_tensor(cv_yuv, cspace="yuv") 80 | 81 | lab = caer.yuv2lab(cv_yuv) 82 | 83 | assert len(lab.shape) == 3 84 | assert isinstance(lab, caer.Tensor) 85 | assert lab.is_lab() 86 | 87 | 88 | def test_yuv2luv(): 89 | cv_yuv = cv.cvtColor(cv_bgr, cv.COLOR_BGR2YUV) 90 | cv_yuv = caer.to_tensor(cv_yuv, cspace="yuv") 91 | 92 | luv = caer.yuv2luv(cv_yuv) 93 | 94 | assert len(luv.shape) == 3 95 | assert isinstance(luv, caer.Tensor) 96 | assert luv.is_luv() 97 | -------------------------------------------------------------------------------- /docs/sphinx-theme/js/highlight-navigation.js: -------------------------------------------------------------------------------- 1 | // Modified from https://stackoverflow.com/a/32396543 2 | window.highlightNavigation = { 3 | navigationListItems: document.querySelectorAll("#pytorch-right-menu li"), 4 | sections: document.querySelectorAll(".pytorch-article .section"), 5 | sectionIdTonavigationLink: {}, 6 | 7 | bind: function() { 8 | if (!sideMenus.displayRightMenu) { 9 | return; 10 | }; 11 | 12 | for (var i = 0; i < highlightNavigation.sections.length; i++) { 13 | var id = highlightNavigation.sections[i].id; 14 | highlightNavigation.sectionIdTonavigationLink[id] = 15 | document.querySelectorAll('#pytorch-right-menu li a[href="#' + id + '"]')[0]; 16 | } 17 | 18 | $(window).scroll(utilities.throttle(highlightNavigation.highlight, 100)); 19 | }, 20 | 21 | highlight: function() { 22 | var rightMenu = document.getElementById("pytorch-right-menu"); 23 | 24 | // If right menu is not on the screen don't bother 25 | if (rightMenu.offsetWidth === 0 && rightMenu.offsetHeight === 0) { 26 | return; 27 | } 28 | 29 | var scrollPosition = utilities.scrollTop(); 30 | var OFFSET_TOP_PADDING = 25; 31 | var offset = document.getElementById("header-holder").offsetHeight + 32 | document.getElementById("pytorch-page-level-bar").offsetHeight + 33 | OFFSET_TOP_PADDING; 34 | 35 | var sections = highlightNavigation.sections; 36 | 37 | for (var i = (sections.length - 1); i >= 0; i--) { 38 | var currentSection = sections[i]; 39 | var sectionTop = utilities.offset(currentSection).top; 40 | 41 | if (scrollPosition >= sectionTop - offset) { 42 | var navigationLink = highlightNavigation.sectionIdTonavigationLink[currentSection.id]; 43 | var navigationListItem = utilities.closest(navigationLink, "li"); 44 | 45 | if (navigationListItem && !navigationListItem.classList.contains("active")) { 46 | for (var i = 0; i < highlightNavigation.navigationListItems.length; i++) { 47 | var el = highlightNavigation.navigationListItems[i]; 48 | if (el.classList.contains("active")) { 49 | el.classList.remove("active"); 50 | } 51 | } 52 | 53 | navigationListItem.classList.add("active"); 54 | 55 | // Scroll to active item. Not a requested feature but we could revive it. Needs work. 56 | 57 | // var menuTop = $("#pytorch-right-menu").position().top; 58 | // var itemTop = navigationListItem.getBoundingClientRect().top; 59 | // var TOP_PADDING = 20 60 | // var newActiveTop = $("#pytorch-side-scroll-right").scrollTop() + itemTop - menuTop - TOP_PADDING; 61 | 62 | // $("#pytorch-side-scroll-right").animate({ 63 | // scrollTop: newActiveTop 64 | // }, 100); 65 | } 66 | 67 | break; 68 | } 69 | } 70 | } 71 | }; 72 | -------------------------------------------------------------------------------- /tests/color/test_rgb.py: -------------------------------------------------------------------------------- 1 | # _____ ______ _____ 2 | # / ____/ /\ | ____ | __ \ 3 | # | | / \ | |__ | |__) | Caer - Modern Computer Vision 4 | # | | / /\ \ | __| | _ / Languages: Python, C, C++, Cuda 5 | # | |___ / ____ \ | |____ | | \ \ http://github.com/jasmcaus/caer 6 | # \_____\/_/ \_ \______ |_| \_\ 7 | 8 | # Licensed under the MIT License 9 | # SPDX-License-Identifier: MIT 10 | # Copyright (c) 2020-2025 The Caer Authors 11 | 12 | import caer 13 | import cv2 as cv 14 | import os 15 | 16 | here = os.path.dirname(os.path.dirname(__file__)) 17 | tens_path = os.path.join(here, 'data', 'green_fish.jpg') 18 | # BGR 19 | cv_bgr = cv.imread(tens_path) 20 | cv_rgb = cv.cvtColor(cv_bgr, cv.COLOR_BGR2RGB) 21 | cv_rgb = caer.to_tensor(cv_rgb, cspace="rgb") 22 | 23 | 24 | def test_rgb2bgr(): 25 | cv_rgb = cv.cvtColor(cv_bgr, cv.COLOR_BGR2RGB) 26 | cv_rgb = caer.to_tensor(cv_rgb, cspace="rgb") 27 | bgr = caer.rgb2bgr(cv_rgb) 28 | 29 | assert len(bgr.shape) == 3 30 | assert isinstance(bgr, caer.Tensor) 31 | assert bgr.is_bgr() 32 | 33 | 34 | def test_rgb2gray(): 35 | cv_rgb = cv.cvtColor(cv_bgr, cv.COLOR_BGR2RGB) 36 | cv_rgb = caer.to_tensor(cv_rgb, cspace="rgb") 37 | gray = caer.rgb2gray(cv_rgb) 38 | 39 | assert len(gray.shape) == 2 or (len(gray.shape) == 3 and gray.shape[-1] == 1) 40 | assert isinstance(gray, caer.Tensor) 41 | assert gray.is_gray() 42 | 43 | 44 | def test_rgb2hsv(): 45 | cv_rgb = cv.cvtColor(cv_bgr, cv.COLOR_BGR2RGB) 46 | cv_rgb = caer.to_tensor(cv_rgb, cspace="rgb") 47 | hsv = caer.rgb2hsv(cv_rgb) 48 | 49 | assert len(hsv.shape) == 3 50 | assert isinstance(hsv, caer.Tensor) 51 | assert hsv.is_hsv() 52 | 53 | 54 | def test_rgb2hls(): 55 | cv_rgb = cv.cvtColor(cv_bgr, cv.COLOR_BGR2RGB) 56 | cv_rgb = caer.to_tensor(cv_rgb, cspace="rgb") 57 | hls = caer.rgb2hls(cv_rgb) 58 | 59 | assert len(hls.shape) == 3 60 | assert isinstance(hls, caer.Tensor) 61 | assert hls.is_hls() 62 | 63 | 64 | def test_rgb2lab(): 65 | cv_rgb = cv.cvtColor(cv_bgr, cv.COLOR_BGR2RGB) 66 | cv_rgb = caer.to_tensor(cv_rgb, cspace="rgb") 67 | lab = caer.rgb2lab(cv_rgb) 68 | 69 | assert len(lab.shape) == 3 70 | assert isinstance(lab, caer.Tensor) 71 | assert lab.is_lab() 72 | 73 | 74 | def test_rgb2yuv(): 75 | cv_rgb = cv.cvtColor(cv_bgr, cv.COLOR_BGR2RGB) 76 | cv_rgb = caer.to_tensor(cv_rgb, cspace="rgb") 77 | yuv = caer.rgb2yuv(cv_rgb) 78 | 79 | assert len(yuv.shape) == 3 80 | assert isinstance(yuv, caer.Tensor) 81 | assert yuv.is_yuv() 82 | 83 | 84 | def test_rgb2luv(): 85 | cv_rgb = cv.cvtColor(cv_bgr, cv.COLOR_BGR2RGB) 86 | cv_rgb = caer.to_tensor(cv_rgb, cspace="rgb") 87 | luv = caer.rgb2luv(cv_rgb) 88 | 89 | assert len(luv.shape) == 3 90 | assert isinstance(luv, caer.Tensor) 91 | assert luv.is_luv() 92 | -------------------------------------------------------------------------------- /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | Contributing to Caer 2 | ========================================== 3 | 4 | If you have improvements to `caer`, send us your pull requests! We'd love to accept your patches! For those just getting started, Github has a [how to](https://help.github.com/articles/using-pull-requests/). All bug fixes, new functionality, new tutorials etc. are (and should be) submitted via GitHub's mechanism of pull requests. 5 | 6 | If you want to contribute, start working through the `caer` codebase, read the [Documentation](https://github.com/jasmcaus/caer/blob/master/docs/), navigate to the [Issues](https://github.com/jasmcaus/caer/issues) tab and start looking through interesting issues. 7 | 8 | ***NOTE***: Only original source code from you and other people that have been working on the PR can be accepted into the main repository. 9 | 10 | 11 | Before you start contributing you should 12 | ---------------------------------------- 13 | 14 | - Make sure you agree to the `caer` MIT license before you contribute your code 15 | 16 | - If you are submitting a new algorithm implementation, do a quick search over the internet to see whether the algorithm is patented or not. 17 | 18 | - If you are going to fix a bug, check that it hasn't yet been spotted or there is someone working on it. In the latter, you might provide support or suggestion in the issue or in the linked pull request. 19 | 20 | - If you have a question about the software, then this is **NOT** the right place. Feel free to read the official [documentation](https://github.com/jasmcaus/caer/blob/master/docs/) or if that does not help, you can contact one of the maintainers (use this as your last resort. Most of the time, we may not have the time to reply to your messages.) 21 | 22 | Before you open up anything on the Caer GitHub page, be sure that you are at the right place with your problem. 23 | 24 | 25 | Reporting issues 26 | ------------------------ 27 | 28 | You can report issues in the `caer` codebase by navigating to the [Issues](https://github.com/jasmcaus/caer/issues) tab. When reporting issues, please include as much detail as possible about your operating system, `caer` version and Python version. Whenever possible, include a brief, self-contained code example that demonstrates the problem. 29 | 30 | 31 | A note on feature enhancements/API changes 32 | ------------------------ 33 | 34 | If you are interested in adding a new feature to Caer, consider submitting your feature proposal as a pull request using the label `suggest-feature` which is the preferred way for discussing new features and changes to the API. 35 | 36 | 37 | Last, but certainly not the least! **Make sure you get due credit**. We try to highlight all the contributions and list major ones in the [Contributors List](https://github.com/jasmcaus/caer/blob/master/CONTRIBUTORS) and release announcements, but sometimes we may inadvertently forget to do that. Please do not hesitate to remind us, and we will update it accordingly. 38 | 39 | Happy Contributing! -------------------------------------------------------------------------------- /docs/sphinx-theme/caer_sphinx_theme/footer.html: -------------------------------------------------------------------------------- 1 | 71 | 72 | --------------------------------------------------------------------------------