Skip to content

Python library to perform forward and backward projection of 2D coordinates in camera space to geographic coordinates on ODM datasets

License

Notifications You must be signed in to change notification settings

OpenDroneMap/CameraLib

Repository files navigation

CameraLib

A Python library to perform forward and backward projection of 2D coordinates in camera space to geographic coordinates on ODM datasets. In simple terms, with an ODM dataset at hand you can use this library to ask:

  • Given a pixel coordinate in an image, where does it correspond on the map?
  • And it's inverse: given a location on the map, which images and pixels correspond to it?

image

Install

pip install -U https://github.com/OpenDroneMap/CameraLib/archive/main.zip

Note we developed the library using Python 3.12. If you're having issues with other versions of Python, you might need to relax the versions in requirements.txt.

Usage

Check the documentation and examples.

Along with functions for doing coordinates projection, in the cameralib.utils package we also offer utilities to read certain annotation file formats. A use case for this is to use a software such as X-AnyLabeling to annotate an image and then use this library to project the polygon/bounding boxes to geographic coordinates.

Required Files in ODM project

CameraLib requires the following files from an ODM project. It's important that you process a dataset with the --dsm or --dtm option.

  • odm_dem/dsm.tif or odm_dem/dtm.tif
  • odm_report/shots.geojson
  • cameras.json

Running the Examples

After installing cameralib you can download any of the examples into a folder of your choice and run:

python helloworld.py

Contributing

We welcome contributions! Pull requests are welcome.

Support the Project

There are many ways to contribute to the project:

  • ⭐️ us on GitHub.
  • Help us test the application.
  • Spread the word about OpenDroneMap on social media.
  • Help answer questions on the community forum
  • Become a contributor!

License

The code in this repository is licensed under the AGPLv3.

About

Python library to perform forward and backward projection of 2D coordinates in camera space to geographic coordinates on ODM datasets

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages