Metadata-Version: 2.4
Name: deltacamera
Version: 0.6.3
Summary: Manipulate camera calibration parameters and warp images for computer vision tasks.
Author-email: István Sárándi <istvan.sarandi@uni-tuebingen.de>
License: MIT License
        
        Copyright (c) 2023 István Sárándi
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/isarandi/deltacamera
Project-URL: Repository, https://github.com/isarandi/deltacamera
Project-URL: Documentation, https://deltacamera.readthedocs.io/
Project-URL: Issues, https://github.com/isarandi/deltacamera/issues
Project-URL: Changelog, https://github.com/isarandi/deltacamera/releases
Project-URL: Author, https://istvansarandi.com
Keywords: camera,calibration,computer-vision,image-warping,distortion,lens-distortion,reprojection
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Topic :: Scientific/Engineering :: Image Processing
Classifier: Topic :: Scientific/Engineering :: Information Analysis
Classifier: Topic :: Software Development :: Libraries
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Operating System :: OS Independent
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: opencv-python
Requires-Dist: numpy
Requires-Dist: scipy
Requires-Dist: numba
Requires-Dist: shapely
Requires-Dist: msgpack-numpy
Requires-Dist: boxlib
Requires-Dist: rlemasklib>=0.7.0
Provides-Extra: test
Requires-Dist: pytest>=7.0; extra == "test"
Requires-Dist: pytest-cov; extra == "test"
Requires-Dist: scikit-image; extra == "test"
Requires-Dist: pyrender; extra == "test"
Requires-Dist: trimesh; extra == "test"
Provides-Extra: lint
Requires-Dist: ruff; extra == "lint"
Requires-Dist: pre-commit; extra == "lint"
Provides-Extra: docs
Requires-Dist: sphinx; extra == "docs"
Requires-Dist: pydata-sphinx-theme; extra == "docs"
Requires-Dist: sphinx-autoapi; extra == "docs"
Requires-Dist: sphinxcontrib-bibtex; extra == "docs"
Requires-Dist: sphinx-markdown-builder; extra == "docs"
Requires-Dist: setuptools-scm; extra == "docs"
Requires-Dist: toml; extra == "docs"
Provides-Extra: gui
Requires-Dist: PyQt6>=6.5.0; extra == "gui"
Provides-Extra: dev
Requires-Dist: deltacamera[docs,lint,test]; extra == "dev"
Dynamic: license-file

# DeltaCamera

This is a computer vision / image processing library for changing camera calibration models, coordinate transformations, and image warping/undistortion to account for camera modifications and lens distortion.

## Main use cases

- **Convert coordinates** between world, camera and image space, handing lens distortion models according to the 14-parameter extended Brown–Conrady and the 4-parameter Kannala–Brandt fisheye models.
- **Reproject** image points and entire images between different camera calibration settings (e.g., rotate the camera or change lens distortion).
- Modify cameras with **intuitive methods** such as `camera.zoomed`, `camera.rotated`, `camera.image_resized`, `camera.turned_towards`, etc.

## Benefits

- **Speed:** The critical functions are accelerated with Numba and intermediate computations are cached for high performance.
- **Accuracy:** We use a more accurate inversion of Brown–Conrady compared to OpenCV. OpenCV uses only fixed-point iteration, we use Newton's method in addition to that.
- **Tracking of pixel validity:** When warping images, we keep track of which pixels in the output image are valid (i.e., map to valid pixels in the input image), taking into account also the valid region of the lens distortion model (outside of which distortion folds back on itself, and would cause artifacts if not detected). The valid region can be obtained as a Shapely polygon, an RLEMaskLib mask or as NaNs in the return values. This feature is missing from OpenCV.
- **Linear color interpolation:** When warping images, we use linear interpolation in linear color space (gamma corrected), which avoids artifacts when warping images with strong contrast.
- **Anti-aliasing:** When warping images, we use supersampling to avoid aliasing artifacts when downsampling parts of the image.

## Installation

```bash
pip install deltacamera
```

It is recommended to then run the Numba precompilation step (takes around 1–2 minutes). This will make image warping and coordinate transformations fast already on first use.

```bash
python -m deltacamera.precompile
```

## Documentation

Full documentation is available at [deltacamera.readthedocs.io](https://deltacamera.readthedocs.io).
