camorph


Namecamorph JSON
Version 1.0.0 PyPI version JSON
download
home_pageNone
SummaryCamorph is a python library for converting different camera parameter representations into each other
upload_time2025-07-15 11:47:47
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseThe Clear BSD License Copyright (c) 2022 Fraunhofer IIS All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
keywords camera parameter convention conversion
VCS
bugtrack_url
requirements cycler fonttools isodate kiwisolver matplotlib numpy packaging pillow pyparsing pyquaternion python-dateutil pyyaml rdflib setuptools-scm six tomli typing-extensions
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Camorph
<font size=5>

[Paper](https://www.int-arch-photogramm-remote-sens-spatial-inf-sci.net/XLVIII-2-W1-2022/29/2022/isprs-archives-XLVIII-2-W1-2022-29-2022.pdf)
</font>
<center>
<img src='Header.png' width=90%/>
</center>

This is the gitlab project for camorph, a camera parameter converting tool written in python 3.9.

## Release Notes
### v1.0.0 (July 10, 2025)
* Clarified the meaning of the "MPEG-OMAF" format in the README

### v0.3.6 (April 29, 2025)
* Merged PR regarding COLMAP image path fix
* Merged PR regarding NeRF principal point fix
### v0.3.5 (September 2, 2024)
* Fixed an issue with FULL_OPENCV models when writing binary COLMAP files
### v0.3.4 (June 20, 2024)
* Fixed an issue with shallow copying in the read_file() for NeRF when using individual image resolutions

## Documentation

Documentation can be found [here](docs/index.md).

## Quickstart

Some quick tips on how to use camorph.

### Installation

If you want to work on camorph, clone the repo and install the conda environment by running

```
conda env create -f camorph_win.yml
```

Otherwise, you can also install camorph with pip

```
pip install git+https://github.com/Fraunhofer-IIS/camorph
```

### Usage as Python Library

Use the library to convert camera parameter representations:

```
import camorph.camorph as camorph
 
 
cams = camorph.read_cameras('COLMAP',r'\\path\to\colmap')
 
camorph.visualize(cams)
 
camorph.write_cameras('fbx', r'\\path\to\file.fbx', cams)
```

``camorph.read_cameras()`` takes a format name and path as a string and returns a list of Cameras.

``camorph.visualize()`` creates a visualization of Cameras with Matplotlib.

``camorph.write_cameras()`` takes a format name, a path as a string and a list of cameras and writes the output file(s) to the specified path.

### Usage as CLI

You can use the command line interface by calling
```
python -m camorph -h
```
or when installed with pip
```
camorph -h
```
This will output the help for the command line interface

```
usage: camorph [-h] -i input_path [input_path ...] -if input_format [-o output_path] [-of output_format] [-v]
               [-c config] [-ft file_type] [-pt] [-cr crop] [-s scale] [-id image_dir] [-ci]

Convert Cameras from different formats to each other

optional arguments:
  -h, --help            show this help message and exit
  -i input_path [input_path ...], --input input_path [input_path ...]
                        the input path of the camera file(s) to read
  -if input_format, --input_format input_format
                        the format of the input camera file(s)
  -o output_path, --output output_path
                        the output path where the camera file(s) should be saved
  -of output_format, --output_format output_format
                        the format of the output camera file(s)
  -v, --visualize       when this parameter is present, the cameras will be visualized.
  -c config, --config config
                        the path to a config.json file for missing crucial properties
  -ft file_type, --file_type file_type
                        some formats support different types of output files, for example bin for binary and txt for
                        ascii files
  -pt, --posetrace      treat the input as a posetrace and ignore any source images.
  -cr crop, --crop crop
                        crop source image attributes by the specified top left and bottom right corner. Format:
                        "leftcorner_x,leftcorner_y,rightcorner_x,rightcorner_y". ATTENTION: THIS DOES NOT MODIFY THE IMAGES, ONLY THE PROPERTIES IN THE FILE!
  -s scale, --scale scale
                        scale source image attributes by the specified factor. ATTENTION: THIS DOES NOT MODIFY THE IMAGES, ONLY THE PROPERTIES IN THE FILE!
  -id image_dir, --image-dir image_dir
                        replace the directory for the source images with this.
  -ci, --check-images   check if images exist and are of the right resolution.
```

For example

```
camorph -i \path\to\json -if nerf -o \path\to\output -of fbx
```

### Crucial Properties
If there are missing crucial properties, camorph will automatically create a `config.json` in the target folder.
To edit this file, please refer to the ["Crucial Properties" section of the documentation](docs/sphinx/crucial_properties.md)

### Pose Trace
If you want to convert a camera animation, which does not have source images (sometimes also referred to as *pose trace*), you can add the `-pt` argument to ignore any source image requirements.

### Cropping and Scaling
This option crops and scales the **attributes of images in the file**. For example, colmap stores the resolution of the images, which can be modified by this parameter.
> ❗❗❗ **THIS DOES NOT MODIFY THE IMAGES THEMSELVES!** ❗❗❗

## Currently Supported Formats

- Computer Graphics
   - **FBX** (Key: "fbx")

- Photogrammetry
   - **COLMAP** (Key: "colmap")
   - **Meshroom** (Key: "meshroom")
   - **Reality Capture** (Key: "reality_capture")
   - **Local Light Field Fusion** (Key: "llff")

- Game Engines
   - **Unity** (Key: "unity")

- Virtual Reality / Immersive Video
   - **MPEG-OMAF** (Key: "mpeg_omaf") -> This format is the JSON format used in the software packages RVS (https://gitlab.com/mpeg-i-visual/rvs) and TMIV (https://gitlab.com/mpeg-i-visual/tmiv) which rely on the MPEG-OMAF coordinate system; for short, we called it MPEG-OMAF.

- Machine Learning
   - **NeRF** (Key: "nerf")

## Citation 

```
@article{Brand2022CAMORPHAT,
  title={CAMORPH: A TOOLBOX FOR CONVERSION BETWEEN CAMERA PARAMETER
CONVENTIONS},
  author={B. Brand and Michel B{\"a}tz and Joachim Keinert},
  journal={The International Archives of the Photogrammetry, Remote Sensing and Spatial Information Sciences},
  year={2022}
}
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "camorph",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "camera parameter convention, conversion",
    "author": null,
    "author_email": "Benjamin Brand <BenniBrand@gmx.de>",
    "download_url": "https://files.pythonhosted.org/packages/6a/6c/1bbb22c24b70fa665876264082e8b027bf634138a49bd5ec6e1252c513d3/camorph-1.0.0.tar.gz",
    "platform": null,
    "description": "# Camorph\n<font size=5>\n\n[Paper](https://www.int-arch-photogramm-remote-sens-spatial-inf-sci.net/XLVIII-2-W1-2022/29/2022/isprs-archives-XLVIII-2-W1-2022-29-2022.pdf)\n</font>\n<center>\n<img src='Header.png' width=90%/>\n</center>\n\nThis is the gitlab project for camorph, a camera parameter converting tool written in python 3.9.\n\n## Release Notes\n### v1.0.0 (July 10, 2025)\n* Clarified the meaning of the \"MPEG-OMAF\" format in the README\n\n### v0.3.6 (April 29, 2025)\n* Merged PR regarding COLMAP image path fix\n* Merged PR regarding NeRF principal point fix\n### v0.3.5 (September 2, 2024)\n* Fixed an issue with FULL_OPENCV models when writing binary COLMAP files\n### v0.3.4 (June 20, 2024)\n* Fixed an issue with shallow copying in the read_file() for NeRF when using individual image resolutions\n\n## Documentation\n\nDocumentation can be found [here](docs/index.md).\n\n## Quickstart\n\nSome quick tips on how to use camorph.\n\n### Installation\n\nIf you want to work on camorph, clone the repo and install the conda environment by running\n\n```\nconda env create -f camorph_win.yml\n```\n\nOtherwise, you can also install camorph with pip\n\n```\npip install git+https://github.com/Fraunhofer-IIS/camorph\n```\n\n### Usage as Python Library\n\nUse the library to convert camera parameter representations:\n\n```\nimport camorph.camorph as camorph\n \n \ncams = camorph.read_cameras('COLMAP',r'\\\\path\\to\\colmap')\n \ncamorph.visualize(cams)\n \ncamorph.write_cameras('fbx', r'\\\\path\\to\\file.fbx', cams)\n```\n\n``camorph.read_cameras()`` takes a format name and path as a string and returns a list of Cameras.\n\n``camorph.visualize()`` creates a visualization of Cameras with Matplotlib.\n\n``camorph.write_cameras()`` takes a format name, a path as a string and a list of cameras and writes the output file(s) to the specified path.\n\n### Usage as CLI\n\nYou can use the command line interface by calling\n```\npython -m camorph -h\n```\nor when installed with pip\n```\ncamorph -h\n```\nThis will output the help for the command line interface\n\n```\nusage: camorph [-h] -i input_path [input_path ...] -if input_format [-o output_path] [-of output_format] [-v]\n               [-c config] [-ft file_type] [-pt] [-cr crop] [-s scale] [-id image_dir] [-ci]\n\nConvert Cameras from different formats to each other\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -i input_path [input_path ...], --input input_path [input_path ...]\n                        the input path of the camera file(s) to read\n  -if input_format, --input_format input_format\n                        the format of the input camera file(s)\n  -o output_path, --output output_path\n                        the output path where the camera file(s) should be saved\n  -of output_format, --output_format output_format\n                        the format of the output camera file(s)\n  -v, --visualize       when this parameter is present, the cameras will be visualized.\n  -c config, --config config\n                        the path to a config.json file for missing crucial properties\n  -ft file_type, --file_type file_type\n                        some formats support different types of output files, for example bin for binary and txt for\n                        ascii files\n  -pt, --posetrace      treat the input as a posetrace and ignore any source images.\n  -cr crop, --crop crop\n                        crop source image attributes by the specified top left and bottom right corner. Format:\n                        \"leftcorner_x,leftcorner_y,rightcorner_x,rightcorner_y\". ATTENTION: THIS DOES NOT MODIFY THE IMAGES, ONLY THE PROPERTIES IN THE FILE!\n  -s scale, --scale scale\n                        scale source image attributes by the specified factor. ATTENTION: THIS DOES NOT MODIFY THE IMAGES, ONLY THE PROPERTIES IN THE FILE!\n  -id image_dir, --image-dir image_dir\n                        replace the directory for the source images with this.\n  -ci, --check-images   check if images exist and are of the right resolution.\n```\n\nFor example\n\n```\ncamorph -i \\path\\to\\json -if nerf -o \\path\\to\\output -of fbx\n```\n\n### Crucial Properties\nIf there are missing crucial properties, camorph will automatically create a `config.json` in the target folder.\nTo edit this file, please refer to the [\"Crucial Properties\" section of the documentation](docs/sphinx/crucial_properties.md)\n\n### Pose Trace\nIf you want to convert a camera animation, which does not have source images (sometimes also referred to as *pose trace*), you can add the `-pt` argument to ignore any source image requirements.\n\n### Cropping and Scaling\nThis option crops and scales the **attributes of images in the file**. For example, colmap stores the resolution of the images, which can be modified by this parameter.\n> \u2757\u2757\u2757 **THIS DOES NOT MODIFY THE IMAGES THEMSELVES!** \u2757\u2757\u2757\n\n## Currently Supported Formats\n\n- Computer Graphics\n   - **FBX** (Key: \"fbx\")\n\n- Photogrammetry\n   - **COLMAP** (Key: \"colmap\")\n   - **Meshroom** (Key: \"meshroom\")\n   - **Reality Capture** (Key: \"reality_capture\")\n   - **Local Light Field Fusion** (Key: \"llff\")\n\n- Game Engines\n   - **Unity** (Key: \"unity\")\n\n- Virtual Reality / Immersive Video\n   - **MPEG-OMAF** (Key: \"mpeg_omaf\") -> This format is the JSON format used in the software packages RVS (https://gitlab.com/mpeg-i-visual/rvs) and TMIV (https://gitlab.com/mpeg-i-visual/tmiv) which rely on the MPEG-OMAF coordinate system; for short, we called it MPEG-OMAF.\n\n- Machine Learning\n   - **NeRF** (Key: \"nerf\")\n\n## Citation \n\n```\n@article{Brand2022CAMORPHAT,\n  title={CAMORPH: A TOOLBOX FOR CONVERSION BETWEEN CAMERA PARAMETER\nCONVENTIONS},\n  author={B. Brand and Michel B{\\\"a}tz and Joachim Keinert},\n  journal={The International Archives of the Photogrammetry, Remote Sensing and Spatial Information Sciences},\n  year={2022}\n}\n```\n",
    "bugtrack_url": null,
    "license": "The Clear BSD License\n        \n        Copyright (c) 2022 Fraunhofer IIS\n        All rights reserved.\n        \n        Redistribution and use in source and binary forms, with or without modification,\n        are permitted (subject to the limitations in the disclaimer below) provided that\n        the following conditions are met:\n        \n             * Redistributions of source code must retain the above copyright notice,\n             this list of conditions and the following disclaimer.\n        \n             * Redistributions in binary form must reproduce the above copyright\n             notice, this list of conditions and the following disclaimer in the\n             documentation and/or other materials provided with the distribution.\n        \n             * Neither the name of the copyright holder nor the names of its\n             contributors may be used to endorse or promote products derived from this\n             software without specific prior written permission.\n        \n        NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY\n        THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND\n        CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n        LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A\n        PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR\n        CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n        EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n        PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR\n        BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER\n        IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n        ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n        POSSIBILITY OF SUCH DAMAGE.\n        ",
    "summary": "Camorph is a python library for converting different camera parameter representations into each other",
    "version": "1.0.0",
    "project_urls": {
        "Homepage": "https://github.com/Fraunhofer-IIS/camorph"
    },
    "split_keywords": [
        "camera parameter convention",
        " conversion"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "56b507248962edd111c21a1b4b18ab838d1f119b54c6dd84c411d585a6e57036",
                "md5": "872b93148aef6d84da9a497b0419deff",
                "sha256": "fb3b2e380fe725897c3527449c73841a87221b66472ae1f18caf41fb910dc1ae"
            },
            "downloads": -1,
            "filename": "camorph-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "872b93148aef6d84da9a497b0419deff",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 62352,
            "upload_time": "2025-07-15T11:47:46",
            "upload_time_iso_8601": "2025-07-15T11:47:46.244785Z",
            "url": "https://files.pythonhosted.org/packages/56/b5/07248962edd111c21a1b4b18ab838d1f119b54c6dd84c411d585a6e57036/camorph-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "6a6c1bbb22c24b70fa665876264082e8b027bf634138a49bd5ec6e1252c513d3",
                "md5": "d51291a04e6f17dc11701b891336cbbd",
                "sha256": "64fbcba9c0e107ebdde314c9b319c5b282c14d5f4c45be634c99d4af99f7f621"
            },
            "downloads": -1,
            "filename": "camorph-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "d51291a04e6f17dc11701b891336cbbd",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 49149,
            "upload_time": "2025-07-15T11:47:47",
            "upload_time_iso_8601": "2025-07-15T11:47:47.964950Z",
            "url": "https://files.pythonhosted.org/packages/6a/6c/1bbb22c24b70fa665876264082e8b027bf634138a49bd5ec6e1252c513d3/camorph-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-15 11:47:47",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Fraunhofer-IIS",
    "github_project": "camorph",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "cycler",
            "specs": [
                [
                    "==",
                    "0.11.0"
                ]
            ]
        },
        {
            "name": "fonttools",
            "specs": [
                [
                    "==",
                    "4.37.4"
                ]
            ]
        },
        {
            "name": "isodate",
            "specs": [
                [
                    "==",
                    "0.6.1"
                ]
            ]
        },
        {
            "name": "kiwisolver",
            "specs": [
                [
                    "==",
                    "1.4.4"
                ]
            ]
        },
        {
            "name": "matplotlib",
            "specs": [
                [
                    "==",
                    "3.5.0"
                ]
            ]
        },
        {
            "name": "numpy",
            "specs": [
                [
                    "==",
                    "1.21.2"
                ]
            ]
        },
        {
            "name": "packaging",
            "specs": [
                [
                    "==",
                    "21.3"
                ]
            ]
        },
        {
            "name": "pillow",
            "specs": [
                [
                    "==",
                    "9.2.0"
                ]
            ]
        },
        {
            "name": "pyparsing",
            "specs": [
                [
                    "==",
                    "3.0.9"
                ]
            ]
        },
        {
            "name": "pyquaternion",
            "specs": [
                [
                    "==",
                    "0.9.9"
                ]
            ]
        },
        {
            "name": "python-dateutil",
            "specs": [
                [
                    "==",
                    "2.8.2"
                ]
            ]
        },
        {
            "name": "pyyaml",
            "specs": [
                [
                    "==",
                    "6.0"
                ]
            ]
        },
        {
            "name": "rdflib",
            "specs": [
                [
                    "==",
                    "6.1.1"
                ]
            ]
        },
        {
            "name": "setuptools-scm",
            "specs": [
                [
                    "==",
                    "7.0.5"
                ]
            ]
        },
        {
            "name": "six",
            "specs": [
                [
                    "==",
                    "1.16.0"
                ]
            ]
        },
        {
            "name": "tomli",
            "specs": [
                [
                    "==",
                    "2.0.1"
                ]
            ]
        },
        {
            "name": "typing-extensions",
            "specs": [
                [
                    "==",
                    "4.3.0"
                ]
            ]
        }
    ],
    "lcname": "camorph"
}
        
Elapsed time: 0.74887s